[jboss-user] [EJB 3.0] - Persistence context injection problem - is it a bug ?
cyril.joui@supinfo.com
do-not-reply at jboss.com
Mon Jan 22 04:04:17 EST 2007
Hello,
I have a very strange problem.
I try to deploy 2 applications (in the same JBoss AS) with same session and entity beans (and 1 persistence unit for each application of course !).
Application which deploies first, deploies well, but the second one try to use the unit context of the first application !
Here is the log (first application which deploies) :
anonymous wrote :
| 09:49:15,219 INFO [EARDeployer] Init J2EE application: file:/home/popom/Documents/labosun/2006-2007/Devs/LaboSite/jboss/server/default/deploy/AppEjb1EAR.ear
| 09:49:15,935 INFO [Ejb3Deployment] EJB3 deployment time took: 531
| 09:49:16,004 INFO [JmxKernelAbstraction] installing MBean: persistence.units:ear=AppEjb1EAR.ear,jar=AppEjb1.jar,unitName=app1EM with dependencies:
| 09:49:16,006 INFO [JmxKernelAbstraction] jboss.jca:name=MysqlDS,service=DataSourceBinding
| 09:49:16,110 INFO [Version] Hibernate EntityManager 3.2.0.GA
| 09:49:16,192 INFO [Version] Hibernate Annotations 3.2.0.GA
| 09:49:16,202 INFO [Environment] Hibernate 3.2.0.ga
| 09:49:16,210 INFO [Environment] hibernate.properties not found
| 09:49:16,212 INFO [Environment] Bytecode provider name : javassist
| 09:49:16,218 INFO [Environment] using JDK 1.4 java.sql.Timestamp handling
| 09:49:16,438 INFO [Ejb3Configuration] found EJB3 Entity bean: com.supinfo.entities.Category
| 09:49:16,443 WARN [Ejb3Configuration] Persistence provider caller does not implements the EJB3 spec correctly. PersistenceUnitInfo.getNewTempClassLoader() is null.
| 09:49:16,617 INFO [Configuration] Reading mappings from resource: META-INF/orm.xml
| 09:49:16,620 INFO [Ejb3Configuration] [PersistenceUnit: app1EM] no META-INF/orm.xml found
| 09:49:16,758 INFO [AnnotationBinder] Binding entity from annotated class: com.supinfo.entities.Category
| 09:49:16,878 INFO [EntityBinder] Bind entity com.supinfo.entities.Category on table LS3_CATEGORY
| 09:49:17,190 INFO [ConnectionProviderFactory] Initializing connection provider: org.hibernate.ejb.connection.InjectedDataSourceConnectionProvider
| 09:49:17,194 INFO [InjectedDataSourceConnectionProvider] Using provided datasource
| 09:49:17,878 INFO [SettingsFactory] RDBMS: MySQL, version: 5.0.24a-Debian_9-log
| 09:49:17,878 INFO [SettingsFactory] JDBC driver: MySQL-AB JDBC Driver, version: mysql-connector-java-3.1.11 ( $Date: 2005-09-21 18:20:03 +0000 (Wed, 21 Sep 2005) $, $Revision: 4287 $ )
| 09:49:17,974 INFO [Dialect] Using dialect: org.hibernate.dialect.MySQLDialect
| 09:49:17,981 INFO [TransactionFactoryFactory] Transaction strategy: org.hibernate.ejb.transaction.JoinableCMTTransactionFactory
| 09:49:17,985 INFO [TransactionManagerLookupFactory] instantiating TransactionManagerLookup: org.hibernate.transaction.JBossTransactionManagerLookup
| 09:49:17,989 INFO [TransactionManagerLookupFactory] instantiated TransactionManagerLookup
| 09:49:17,990 INFO [SettingsFactory] Automatic flush during beforeCompletion(): disabled
| 09:49:17,990 INFO [SettingsFactory] Automatic session close at end of transaction: disabled
| 09:49:17,990 INFO [SettingsFactory] JDBC batch size: 15
| 09:49:17,990 INFO [SettingsFactory] JDBC batch updates for versioned data: disabled
| 09:49:17,991 INFO [SettingsFactory] Scrollable result sets: enabled
| 09:49:17,992 INFO [SettingsFactory] JDBC3 getGeneratedKeys(): enabled
| 09:49:17,992 INFO [SettingsFactory] Connection release mode: auto
| 09:49:17,993 INFO [SettingsFactory] Maximum outer join fetch depth: 2
| 09:49:17,994 INFO [SettingsFactory] Default batch fetch size: 1
| 09:49:17,994 INFO [SettingsFactory] Generate SQL with comments: disabled
| 09:49:17,994 INFO [SettingsFactory] Order SQL updates by primary key: disabled
| 09:49:17,994 INFO [SettingsFactory] Query translator: org.hibernate.hql.ast.ASTQueryTranslatorFactory
| 09:49:17,999 INFO [ASTQueryTranslatorFactory] Using ASTQueryTranslatorFactory
| 09:49:17,999 INFO [SettingsFactory] Query language substitutions: {}
| 09:49:18,000 INFO [SettingsFactory] JPA-QL strict compliance: enabled
| 09:49:18,000 INFO [SettingsFactory] Second-level cache: enabled
| 09:49:18,000 INFO [SettingsFactory] Query cache: disabled
| 09:49:18,000 INFO [SettingsFactory] Cache provider: org.hibernate.cache.HashtableCacheProvider
| 09:49:18,002 INFO [SettingsFactory] Optimize cache for minimal puts: disabled
| 09:49:18,003 INFO [SettingsFactory] Structured second-level cache entries: disabled
| 09:49:18,090 INFO [SettingsFactory] Statistics: disabled
| 09:49:18,091 INFO [SettingsFactory] Deleted entity synthetic identifier rollback: disabled
| 09:49:18,092 INFO [SettingsFactory] Default entity-mode: pojo
| 09:49:18,201 INFO [SessionFactoryImpl] building session factory
| 09:49:18,540 INFO [SessionFactoryObjectFactory] Not binding factory to JNDI, no JNDI name configured
| 09:49:18,547 INFO [SchemaUpdate] Running hbm2ddl schema update
| 09:49:18,547 INFO [SchemaUpdate] fetching database metadata
| 09:49:18,548 INFO [SchemaUpdate] updating schema
| 09:49:18,645 INFO [TableMetadata] table found: MYTESTS.LS3_CATEGORY
| 09:49:18,646 INFO [TableMetadata] columns: [code, idcateg, label, language]
| 09:49:18,646 INFO [TableMetadata] foreign keys: []
| 09:49:18,646 INFO [TableMetadata] indexes: [primary]
| 09:49:18,647 INFO [SchemaUpdate] schema update complete
| 09:49:18,651 INFO [NamingHelper] JNDI InitialContext properties:{java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory, java.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces}
| 09:49:18,795 INFO [JmxKernelAbstraction] installing MBean: jboss.j2ee:ear=AppEjb1EAR.ear,jar=AppEjb1.jar,name=HelloServiceBean,service=EJB3 with dependencies:
| 09:49:18,796 INFO [JmxKernelAbstraction] persistence.units:ear=AppEjb1EAR.ear,jar=AppEjb1.jar,unitName=app1EM
| 09:49:19,054 INFO [EJBContainer] STARTED EJB: com.supinfo.session.bean.HelloServiceBean ejbName: HelloServiceBean
| 09:49:19,147 INFO [EJB3Deployer] Deployed: file:/home/popom/Documents/labosun/2006-2007/Devs/LaboSite/jboss/server/default/tmp/deploy/tmp1902AppEjb1EAR.ear-contents/AppEjb1.jar
|
And the second one (same application) :
anonymous wrote :
| 09:49:19,158 INFO [EARDeployer] Init J2EE application: file:/home/popom/Documents/labosun/2006-2007/Devs/LaboSite/jboss/server/default/deploy/AppEjb2EAR.ear
| 09:49:19,304 INFO [Ejb3Deployment] EJB3 deployment time took: 15
| 09:49:19,308 INFO [JmxKernelAbstraction] installing MBean: persistence.units:ear=AppEjb2EAR.ear,jar=AppEjb2.jar,unitName=app2EM with dependencies:
| 09:49:19,308 INFO [JmxKernelAbstraction] jboss.jca:name=MysqlDS,service=DataSourceBinding
| 09:49:19,399 INFO [Ejb3Configuration] found EJB3 Entity bean: com.supinfo.entities.Category
| 09:49:19,400 WARN [Ejb3Configuration] Persistence provider caller does not implements the EJB3 spec correctly. PersistenceUnitInfo.getNewTempClassLoader() is null.
| 09:49:19,401 INFO [Configuration] Reading mappings from resource: META-INF/orm.xml
| 09:49:19,403 INFO [Ejb3Configuration] [PersistenceUnit: app2EM] no META-INF/orm.xml found
| 09:49:19,403 INFO [AnnotationBinder] Binding entity from annotated class: com.supinfo.entities.Category
| 09:49:19,404 INFO [EntityBinder] Bind entity com.supinfo.entities.Category on table LS3_CATEGORY
| 09:49:19,634 INFO [ConnectionProviderFactory] Initializing connection provider: org.hibernate.ejb.connection.InjectedDataSourceConnectionProvider
| 09:49:19,635 INFO [InjectedDataSourceConnectionProvider] Using provided datasource
| 09:49:19,635 INFO [SettingsFactory] RDBMS: MySQL, version: 5.0.24a-Debian_9-log
| 09:49:19,635 INFO [SettingsFactory] JDBC driver: MySQL-AB JDBC Driver, version: mysql-connector-java-3.1.11 ( $Date: 2005-09-21 18:20:03 +0000 (Wed, 21 Sep 2005) $, $Revision: 4287 $ )
| 09:49:19,636 INFO [Dialect] Using dialect: org.hibernate.dialect.MySQLDialect
| 09:49:19,636 INFO [TransactionFactoryFactory] Transaction strategy: org.hibernate.ejb.transaction.JoinableCMTTransactionFactory
| 09:49:19,636 INFO [TransactionManagerLookupFactory] instantiating TransactionManagerLookup: org.hibernate.transaction.JBossTransactionManagerLookup
| 09:49:19,636 INFO [TransactionManagerLookupFactory] instantiated TransactionManagerLookup
| 09:49:19,637 INFO [SettingsFactory] Automatic flush during beforeCompletion(): disabled
| 09:49:19,637 INFO [SettingsFactory] Automatic session close at end of transaction: disabled
| 09:49:19,637 INFO [SettingsFactory] JDBC batch size: 15
| 09:49:19,637 INFO [SettingsFactory] JDBC batch updates for versioned data: disabled
| 09:49:19,637 INFO [SettingsFactory] Scrollable result sets: enabled
| 09:49:19,637 INFO [SettingsFactory] JDBC3 getGeneratedKeys(): enabled
| 09:49:19,638 INFO [SettingsFactory] Connection release mode: auto
| 09:49:19,638 INFO [SettingsFactory] Maximum outer join fetch depth: 2
| 09:49:19,638 INFO [SettingsFactory] Default batch fetch size: 1
| 09:49:19,638 INFO [SettingsFactory] Generate SQL with comments: disabled
| 09:49:19,638 INFO [SettingsFactory] Order SQL updates by primary key: disabled
| 09:49:19,638 INFO [SettingsFactory] Query translator: org.hibernate.hql.ast.ASTQueryTranslatorFactory
| 09:49:19,638 INFO [ASTQueryTranslatorFactory] Using ASTQueryTranslatorFactory
| 09:49:19,639 INFO [SettingsFactory] Query language substitutions: {}
| 09:49:19,640 INFO [SettingsFactory] JPA-QL strict compliance: enabled
| 09:49:19,640 INFO [SettingsFactory] Second-level cache: enabled
| 09:49:19,640 INFO [SettingsFactory] Query cache: disabled
| 09:49:19,640 INFO [SettingsFactory] Cache provider: org.hibernate.cache.HashtableCacheProvider
| 09:49:19,640 INFO [SettingsFactory] Optimize cache for minimal puts: disabled
| 09:49:19,640 INFO [SettingsFactory] Structured second-level cache entries: disabled
| 09:49:19,641 INFO [SettingsFactory] Statistics: disabled
| 09:49:19,641 INFO [SettingsFactory] Deleted entity synthetic identifier rollback: disabled
| 09:49:19,641 INFO [SettingsFactory] Default entity-mode: pojo
| 09:49:19,651 INFO [SessionFactoryImpl] building session factory
| 09:49:19,658 INFO [SessionFactoryObjectFactory] Not binding factory to JNDI, no JNDI name configured
| 09:49:19,658 INFO [SchemaUpdate] Running hbm2ddl schema update
| 09:49:19,659 INFO [SchemaUpdate] fetching database metadata
| 09:49:19,659 INFO [SchemaUpdate] updating schema
| 09:49:19,669 INFO [TableMetadata] table found: MYTESTS.LS3_CATEGORY
| 09:49:19,670 INFO [TableMetadata] columns: [code, idcateg, label, language]
| 09:49:19,671 INFO [TableMetadata] foreign keys: []
| 09:49:19,671 INFO [TableMetadata] indexes: [primary]
| 09:49:19,671 INFO [SchemaUpdate] schema update complete
| 09:49:19,671 INFO [NamingHelper] JNDI InitialContext properties:{java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory, java.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces}
| 09:49:19,673 INFO [JmxKernelAbstraction] installing MBean: jboss.j2ee:ear=AppEjb2EAR.ear,jar=AppEjb2.jar,name=HelloServiceBean,service=EJB3 with dependencies:
|
| 09:49:19,673 INFO [JmxKernelAbstraction] persistence.units:unitName=app1EM
|
| 09:49:19,675 INFO [EJB3Deployer] Deployed: file:/home/popom/Documents/labosun/2006-2007/Devs/LaboSite/jboss/server/default/tmp/deploy/tmp1903AppEjb2EAR.ear-contents/AppEjb2.jar
| 09:49:19,764 INFO [EARDeployer] Started J2EE application: file:/home/popom/Documents/labosun/2006-2007/Devs/LaboSite/jboss/server/default/deploy/AppEjb2EAR.ear
|
|
Second application try to use app1EM instead of app2EM !
Here is the Session Bean of app1 :
anonymous wrote :
| @Stateless
| @Local(HelloServiceLocal.class)
| public class HelloServiceBean implements HelloServiceLocal {
|
| @PersistenceContext(unitName = "app1EM")
| private EntityManager em;
|
| public String sayHello(String name) {
| System.out.println("EM " + em);
| return "hello : " + name;
| }
| }
|
Here is the session bean of app2 :
anonymous wrote :
| @Stateless
| @Local(HelloServiceLocal.class)
| public class HelloServiceBean implements HelloServiceLocal {
|
| @PersistenceContext(unitName = "app2EM")
| private EntityManager em;
|
| public String sayHello(String name) {
| System.out.println("EM " + em);
| return "hello : " + name;
| }
| }
|
Does anyone can help me please ?
It seems to work on JBoss 4.0.4RC1 ... I try to use JBoss 4.0.5.GA now but I have this problem ...
Thanks by advance !!
Cyril
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4004736#4004736
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4004736
More information about the jboss-user
mailing list