-
1. Re: EntityManager is null if network disconnected
phantom Mar 28, 2008 6:54 AM (in response to phantom)DataBase installed localy and has address: 127.0.0.1
-
2. Re: EntityManager is null if network disconnected
nickarls Mar 28, 2008 7:00 AM (in response to phantom)Could you post the full stack trace? Could be some xml schema file it tries to fetch online(?)
-
3. Re: EntityManager is null if network disconnected
phantom Mar 28, 2008 10:01 AM (in response to phantom)I define my entityManager as:
<persistence:managed-persistence-context auto-create="true" name="entityManager"> <persistence:persistence-unit-jndi-name>java:/XXXEntityDatasource</persistence:persistence-unit-jndi-name> </persistence:managed-persistence-context>
Persistence unit defined as:
<persistence version="1.0" xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd"> <persistence-unit name="XXXPU"> <description>XXX Persistence Unit</description> <jta-data-source>java:/XXXDATASOURCE</jta-data-source> <class>org.XXX.Case</class> <class>org.XXX.Category</class> <class>org.XXX.Problematic</class> <class>org.XXX.Solution</class> <class>org.XXX.User</class> <properties> <property name="jboss.entity.manager.factory.jndi.name" value="java:/XXXEntityDatasource"/> <property name="hibernate.search.default.indexBase" value="./.donotdelete"/> <property name="hibernate.ejb.event.post-insert" value="org.hibernate.search.event.FullTextIndexEventListener"/> <property name="hibernate.ejb.event.post-update" value="org.hibernate.search.event.FullTextIndexEventListener"/> <property name="hibernate.ejb.event.post-delete" value="org.hibernate.search.event.FullTextIndexEventListener"/> </properties> </persistence-unit> </persistence>
DataSource defined as:
<?xml version="1.0" encoding="UTF-8"?> <datasources> <local-tx-datasource> <jndi-name>XXXDATASOURCE</jndi-name> <connection-url>jdbc:postgresql://127.0.0.1/XXX</connection-url> <driver-class>org.postgresql.Driver</driver-class> <user-name>XXX</user-name> <password>XXX</password> <min-pool-size>10</min-pool-size> <max-pool-size>50</max-pool-size> <valid-connection-checker-class-name>org.jboss.resource.adapter.jdbc.vendor.PostgreSQLValidConnectionChecker</valid-connection-checker-class-name> </local-tx-datasource> </datasources>
Header of components.xml:
<?xml version="1.0" encoding="UTF-8"?> <components xmlns="http://jboss.com/products/seam/components" xmlns:core="http://jboss.com/products/seam/core" xmlns:persistence="http://jboss.com/products/seam/persistence" xmlns:security="http://jboss.com/products/seam/security" xmlns:web="http://jboss.com/products/seam/web" xmlns:theme="http://jboss.com/products/seam/theme" xmlns:framework="http://jboss.com/products/seam/framework" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation= "http://jboss.com/products/seam/core http://jboss.com/products/seam/core-1.2.xsd http://jboss.com/products/seam/security http://jboss.com/products/seam/security-1.2.xsd http://jboss.com/products/seam/web http://jboss.com/products/seam/web-1.2.xsd http://jboss.com/products/seam/theme http://jboss.com/products/seam/theme-1.2.xsd http://jboss.com/products/seam/framework http://jboss.com/products/seam/framework-1.2.xsd http://jboss.com/products/seam/components http://jboss.com/products/seam/components-1.2.xsd">
All was copied from examples. I don't know the reason of this strange bug, because, let me note, everything work OK if network connected.
-
4. Re: EntityManager is null if network disconnected
damianharvey.damianharvey.gmail.com Mar 28, 2008 10:08 AM (in response to phantom)It's probably due to the fact that you're using Seam 2.0.1 but your components.xml is using the schemas from 1.2. As Nicklas said it's trying to load the schemas over the net because it doesn't have them in the local JARs.
Change your components.xml:
http://jboss.com/products/seam/components http://jboss.com/products/seam/components-2.0.xsd" etc
Cheers,
Damian.
-
5. Re: EntityManager is null if network disconnected
phantom Mar 28, 2008 10:42 AM (in response to phantom)I update header of components.xml file to:
<?xml version="1.0" encoding="UTF-8"?> <components xmlns="http://jboss.com/products/seam/components" xmlns:core="http://jboss.com/products/seam/core" xmlns:persistence="http://jboss.com/products/seam/persistence" xmlns:security="http://jboss.com/products/seam/security" xmlns:web="http://jboss.com/products/seam/web" xmlns:theme="http://jboss.com/products/seam/theme" xmlns:framework="http://jboss.com/products/seam/framework" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation= "http://jboss.com/products/seam/core http://jboss.com/products/seam/core-2.0.xsd http://jboss.com/products/seam/bpm http://jboss.com/products/seam/bpm-2.0.xsd http://jboss.com/products/seam/persistence http://jboss.com/products/seam/persistence-2.0.xsd http://jboss.com/products/seam/security http://jboss.com/products/seam/security-2.0.xsd http://jboss.com/products/seam/framework http://jboss.com/products/seam/framework-2.0.xsd http://jboss.com/products/seam/components http://jboss.com/products/seam/components-2.0.xsd">
The same situation occur...
Exception:
org.jboss.seam.RequiredException: @In attribute requires non-null value: navigation.entityManager org.jboss.seam.Component.getValueToInject(Component.java:2168) org.jboss.seam.Component.injectAttributes(Component.java:1598) org.jboss.seam.Component.inject(Component.java:1416) org.jboss.seam.core.BijectionInterceptor.aroundInvoke(BijectionInterceptor.java:45) org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68) org.jboss.seam.core.MethodContextInterceptor.aroundInvoke(MethodContextInterceptor.java:42) org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68) org.jboss.seam.intercept.RootInterceptor.invoke(RootInterceptor.java:107) org.jboss.seam.intercept.JavaBeanInterceptor.interceptInvocation(JavaBeanInterceptor.java:166) org.jboss.seam.intercept.JavaBeanInterceptor.invoke(JavaBeanInterceptor.java:102) org.XXX.Navigation_$$_javassist_0.getNavigationLine(Navigation_$$_javassist_0.java) sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) java.lang.reflect.Method.invoke(Method.java:585) javax.el.BeanELResolver.getValue(BeanELResolver.java:62)
But let me note, that this exception rendered on default tomcat error page - not on the debug page of Seam. (Debug mode in Seame is enabled.)
Before it occur if there were some problems with deploing Resource Servlet of the seam.... -
6. Re: EntityManager is null if network disconnected
nickarls Mar 28, 2008 10:48 AM (in response to phantom)Show all errors and stack traces you can, they can be a indication of some other problem...
-
7. Re: EntityManager is null if network disconnected
phantom Mar 28, 2008 11:10 AM (in response to phantom)I fix the problem. Thank you!
The reason was incorrect (old style) header in pages.xml due to following exception occur:
2008-03-28 12:55:27,076 ERROR [org.jboss.seam.jsf.SeamPhaseListener] uncaught exception java.lang.RuntimeException: org.dom4j.DocumentException: jboss.com Nested exception: jboss.com at org.jboss.seam.navigation.Pages.getDocumentRoot(Pages.java:956) at org.jboss.seam.navigation.Pages.parse(Pages.java:914) at org.jboss.seam.navigation.Pages.initialize(Pages.java:108) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:585)
For someone it may be interesting how to upgrade from 1.2 to 2.0.1 (post on russian language) : http://dblogs.ru/2008/03/22/upgrade-jboss-seam-from-12-to-2/
There are my problems discribed during upgrade -
8. Re: EntityManager is null if network disconnected
madsph.mph.lenio.dk Sep 11, 2008 1:38 PM (in response to phantom)Could you (or someone else who solved the problem) please post your pages.xml headers? The link to the russian page seams to be dead, and I get the same errors as you had before your fix. As far as I can tell my pages.xml contains the same headers as the ones from the eaxmples i downloaded with seam 2.0.3.CR1:
|<?xml version="1.0" encoding="UTF-8"?> <pages xmlns="http://jboss.com/products/seam/pages" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://jboss.com/products/seam/pages http://jboss.comproducts/seam/pages-2.0.xsd" |
My components.xml headers are also similar to the examples:
<components xmlns="http://jboss.com/products/seam/components" xmlns:core="http://jboss.com/products/seam/core" xmlns:persistence="http://jboss.com/products/seam/persistence" xmlns:drools="http://jboss.com/products/seam/drools" xmlns:bpm="http://jboss.com/products/seam/bpm" xmlns:security="http://jboss.com/products/seam/security" xmlns:mail="http://jboss.com/products/seam/mail" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:transaction="http://jboss.com/products/seam/transaction" xmlns:web="http://jboss.com/products/seam/web" xmlns:async="http://jboss.com/products/seam/async" xsi:schemaLocation= "http://jboss.com/products/seam/core http://jboss.com/products/seam/core-2.0.xsd http://jboss.com/products/seam/persistence http://jboss.com/products/seam/persistence-2.0.xsd http://jboss.com/products/seam/drools http://jboss.com/products/seam/drools-2.0.xsd http://jboss.com/products/seam/bpm http://jboss.com/products/seam/bpm-2.0.xsd http://jboss.com/products/seam/security http://jboss.com/products/seam/security-2.0.xsd http://jboss.com/products/seam/mail http://jboss.com/products/seam/mail-2.0.xsd http://jboss.com/products/seam/components http://jboss.com/products/seam/components-2.0.xsd http://jboss.com/products/seam/transaction http://jboss.com/products/seam/transaction-2.0.xsd http://jboss.com/products/seam/web http://jboss.com/products/seam/web-2.0.xsd http://jboss.com/products/seam/async http://jboss.com/products/seam/async-2.0.xsd http://jboss.com/products/seam/pages http://jboss.com/products/seam/pages-2.0.xsd" >
Thanks in advance.
-
9. Re: EntityManager is null if network disconnected
luxspes Sep 11, 2008 4:36 PM (in response to phantom)
Eleas Naryzhny wrote on Mar 28, 2008 06:54:
DataBase installed localy and has address: 127.0.0.1
Have you tried to connect to the database using plain JDBC (for example using Sql Squirrel if the problem is only happening when the network is disconnected maybe the problem is at the JDBC level. Are you working on windows? (If so you may need to install the Microsoft Loopback Adapter, maybe postgresql needs it)