Hi David,
thank you for your efforts, I really appreciate it.
I tried the new SNAPSHOT libraries, and the lookup works very well. Thank
you again for providing a great support. However, I run into other problems
(maybe because of SNAPSHOT?). I just want to give feedback on it.
- the startup/shutdown behaviour of openejb may have changed? I start
openejb in every junit test @BeforeClass, and call OpenEJB.destroy() in
@AfterClass. Running a single test works fine, running all tests together
(e.g. maven test) fail after the first test. If I do not call
OpenEJB.destroy() in @AfterClass, all tests run again fine, so I suppose
that OpenEJB.destroy() is the cause. Below is a stacktrace.
-------------------------------------------------------------------------------
Test set: de.easycredit.ed02.env.testframework.embedded.SimpleTest
-------------------------------------------------------------------------------
Tests run: 2, Failures: 0, Errors: 2, Skipped: 0, Time elapsed: 0.032 sec
<<< FAILURE!
de.easycredit.ed02.env.testframework.embedded.SimpleTest Time elapsed:
0.141 sec <<< ERROR!
javax.naming.NamingException: Cannot instantiate a LocalInitialContext.
Exception: java.lang.NullPointerException null [Root exception is
java.lang.NullPointerException]
at
org.apache.openejb.client.LocalInitialContextFactory.getLocalInitialContext(LocalInitialContextFactory.java:96)
at
org.apache.openejb.client.LocalInitialContextFactory.getInitialContext(LocalInitialContextFactory.java:42)
at
javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:667)
at
javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:247)
at javax.naming.InitialContext.init(InitialContext.java:223)
at javax.naming.InitialContext.<init>(InitialContext.java:197)
at
de.easycredit.ed02.env.testframework.openejb.OpenEJBFactory.initContainer(OpenEJBFactory.java:59)
at
de.easycredit.ed02.env.testframework.BeanFactory.initContainer(BeanFactory.java:208)
at
de.easycredit.ed02.env.testframework.embedded.SimpleTest.onBeforeClass(SimpleTest.java:36)
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)
at
org.junit.internal.runners.BeforeAndAfterRunner.invokeMethod(BeforeAndAfterRunner.java:74)
at
org.junit.internal.runners.BeforeAndAfterRunner.runBefores(BeforeAndAfterRunner.java:50)
at
org.junit.internal.runners.BeforeAndAfterRunner.runProtected(BeforeAndAfterRunner.java:33)
at
org.junit.internal.runners.TestClassRunner.run(TestClassRunner.java:52)
at
org.apache.maven.surefire.junit4.JUnit4TestSet.execute(JUnit4TestSet.java:62)
at
org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.executeTestSet(AbstractDirectoryTestSuite.java:140)
at
org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.execute(AbstractDirectoryTestSuite.java:127)
at org.apache.maven.surefire.Surefire.run(Surefire.java:177)
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)
at
org.apache.maven.surefire.booter.SurefireBooter.runSuitesInProcess(SurefireBooter.java:345)
at
org.apache.maven.surefire.booter.SurefireBooter.main(SurefireBooter.java:1009)
Caused by: java.lang.NullPointerException
at
org.apache.openejb.client.LocalInitialContext.getContainerSystemEjbContext(LocalInitialContext.java:191)
at
org.apache.openejb.client.LocalInitialContext.<init>(LocalInitialContext.java:52)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at
sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
at
sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
at java.lang.reflect.Constructor.newInstance(Constructor.java:494)
at
org.apache.openejb.client.LocalInitialContextFactory.getLocalInitialContext(LocalInitialContextFactory.java:84)
... 26 more
- The validation of deployment of multiple persistence units seems to have
changed on 3.1-SNAPSHOT. We have multiple persistence jars belonging to same
ear, each of the jar have its own META-INF/persistence.xml with
unit-name="berechtigung". the deployement/tests run well with 3.0, with 3.1
I get following stacktraces.
Apache OpenEJB 3.1-SNAPSHOT build: 20080915-09:46
http://openejb.apache.org/
INFO - openejb.home = D:\projekte\HEAD\ed02\sys\berechtigung\login-impl
INFO - openejb.base = D:\projekte\HEAD\ed02\sys\berechtigung\login-impl
INFO - Configuring Service(id=Default Security Service,
type=SecurityService, provider-id=Default Security Service)
INFO - Configuring Service(id=Default Transaction Manager,
type=TransactionManager, provider-id=Default Transaction Manager)
INFO - Configuring Service(id=DefaultDS, type=Resource, provider-id=Default
JDBC Database)
INFO - Configuring Service(id=operativDS, type=Resource, provider-id=Default
JDBC Database)
INFO - Found EjbModule in classpath:
D:\projekte\HEAD\ed02\sys\berechtigung\login-impl\target\test-classes
INFO - Found EjbModule in classpath:
D:\m2_repository\repository\de\easycredit\ed02\sys\core\core-technical\4.0-SNAPSHOT\core-technical-4.0-SNAPSHOT.jar
INFO - Found EjbModule in classpath:
D:\projekte\HEAD\ed02\sys\berechtigung\partner-impl\target\test-classes
INFO - Found EjbModule in classpath:
D:\projekte\HEAD\ed02\sys\berechtigung\login-impl\target\classes
INFO - Found EjbModule in classpath:
D:\m2_repository\repository\de\easycredit\ed02\sys\core\core-business-impl\4.0-SNAPSHOT\core-business-impl-4.0-SNAPSHOT.jar
INFO - Found PersistenceModule in classpath:
D:\projekte\HEAD\ed02\sys\berechtigung\berechtigung-journal\target\test-classes
INFO - Found EjbModule in classpath:
D:\projekte\HEAD\ed02\sys\berechtigung\partner-impl\target\classes
INFO - Found EjbModule in classpath:
D:\projekte\HEAD\ed02\sys\berechtigung\rechte-impl\target\classes
INFO - Found EjbModule in classpath:
D:\projekte\HEAD\ed02\sys\berechtigung\berechtigung-core\target\classes
INFO - Found EjbModule in classpath:
D:\m2_repository\repository\de\easycredit\ed02\env\testframework\4.0-SNAPSHOT\testframework-4.0-SNAPSHOT.jar
INFO - Found EjbModule in classpath:
D:\projekte\HEAD\ed02\sys\berechtigung\rechte-impl\target\test-classes
INFO - Beginning load:
D:\projekte\HEAD\ed02\sys\berechtigung\login-impl\target\test-classes
INFO - Beginning load:
D:\m2_repository\repository\de\easycredit\ed02\sys\core\core-technical\4.0-SNAPSHOT\core-technical-4.0-SNAPSHOT.jar
INFO - Beginning load:
D:\projekte\HEAD\ed02\sys\berechtigung\partner-impl\target\test-classes
INFO - Beginning load:
D:\projekte\HEAD\ed02\sys\berechtigung\login-impl\target\classes
INFO - Beginning load:
D:\m2_repository\repository\de\easycredit\ed02\sys\core\core-business-impl\4.0-SNAPSHOT\core-business-impl-4.0-SNAPSHOT.jar
INFO - Beginning load:
D:\projekte\HEAD\ed02\sys\berechtigung\berechtigung-journal\target\test-classes
INFO - Beginning load:
D:\projekte\HEAD\ed02\sys\berechtigung\partner-impl\target\classes
INFO - Beginning load:
D:\projekte\HEAD\ed02\sys\berechtigung\rechte-impl\target\classes
INFO - Beginning load:
D:\projekte\HEAD\ed02\sys\berechtigung\berechtigung-core\target\classes
INFO - Beginning load:
D:\m2_repository\repository\de\easycredit\ed02\env\testframework\4.0-SNAPSHOT\testframework-4.0-SNAPSHOT.jar
INFO - Beginning load:
D:\projekte\HEAD\ed02\sys\berechtigung\rechte-impl\target\test-classes
INFO - Configuring enterprise application: classpath.ear
INFO - Configuring Service(id=Default Stateless Container, type=Container,
provider-id=Default Stateless Container)
INFO - Auto-creating a container for bean DBServiceImpl:
Container(type=STATELESS, id=Default Stateless Container)
INFO - Configuring Service(id=Default Stateful Container, type=Container,
provider-id=Default Stateful Container)
INFO - Auto-creating a container for bean PartnerElementServiceImpl:
Container(type=STATEFUL, id=Default Stateful Container)
INFO - Configuring PersistenceUnit(name=berechtigung,
provider=org.hibernate.ejb.HibernatePersistence)
INFO - Auto-creating a Resource with id 'operativDSNonJta' of type
'DataSource for 'berechtigung'.
INFO - Configuring Service(id=operativDSNonJta, type=Resource,
provider-id=operativDS)
INFO - Adjusting berechtigung <jta-data-source> to 'operativDS'
INFO - Adjusting berechtigung <non-jta-data-source> to 'operativDSNonJta'
INFO - Configuring PersistenceUnit(name=berechtigungPartner,
provider=org.hibernate.ejb.HibernatePersistence)
INFO - Adjusting berechtigungPartner <jta-data-source> to 'operativDS'
INFO - Adjusting berechtigungPartner <non-jta-data-source> to
'operativDSNonJta'
INFO - Configuring PersistenceUnit(name=berechtigung,
provider=org.hibernate.ejb.HibernatePersistence)
INFO - Adjusting berechtigung <jta-data-source> to 'operativDS'
INFO - Adjusting berechtigung <non-jta-data-source> to 'operativDSNonJta'
INFO - Configuring PersistenceUnit(name=challenge_wertelisten,
provider=org.hibernate.ejb.HibernatePersistence)
INFO - Adjusting challenge_wertelisten <jta-data-source> to 'operativDS'
INFO - Adjusting challenge_wertelisten <non-jta-data-source> to
'operativDSNonJta'
INFO - Configuring PersistenceUnit(name=berechtigung,
provider=org.hibernate.ejb.HibernatePersistence)
INFO - Adjusting berechtigung <jta-data-source> to 'operativDS'
INFO - Adjusting berechtigung <non-jta-data-source> to 'operativDSNonJta'
INFO - Configuring PersistenceUnit(name=berechtigungPartner,
provider=org.hibernate.ejb.HibernatePersistence)
INFO - Adjusting berechtigungPartner <jta-data-source> to 'operativDS'
INFO - Adjusting berechtigungPartner <non-jta-data-source> to
'operativDSNonJta'
INFO - Configuring PersistenceUnit(name=berechtigung,
provider=org.hibernate.ejb.HibernatePersistence)
INFO - Adjusting berechtigung <jta-data-source> to 'operativDS'
INFO - Adjusting berechtigung <non-jta-data-source> to 'operativDSNonJta'
INFO - Configuring PersistenceUnit(name=berechtigung,
provider=org.hibernate.ejb.HibernatePersistence)
INFO - Adjusting berechtigung <jta-data-source> to 'operativDS'
INFO - Adjusting berechtigung <non-jta-data-source> to 'operativDSNonJta'
ERROR - FAIL ... DBServiceImpl: Persistence unit not found for
@PersistenceContext(name="entityManager", unitName=""). Available units
[berechtigung, berechtigung, berechtigung, berechtigung, berechtigung,
berechtigungPartner, berechtigungPartner, challenge_wertelisten]
ERROR - Invalid
EjbModule(path=D:\projekte\HEAD\ed02\sys\berechtigung\partner-impl\target\test-classes)
ERROR - FAIL ... BerechtigungsvorlagenDAOImpl: @PersistenceContext unitName
has multiple matches: unitName "berechtigung" has 8 possible matches.
ERROR - FAIL ... LoginJournalEintragDAOImpl: @PersistenceContext unitName
has multiple matches: unitName "berechtigung" has 8 possible matches.
ERROR - FAIL ... LoginServiceDAOImpl: @PersistenceContext unitName has
multiple matches: unitName "berechtigung" has 8 possible matches.
ERROR - Invalid
EjbModule(path=D:\projekte\HEAD\ed02\sys\berechtigung\login-impl\target\classes)
ERROR - FAIL ... PersonServiceImpl: @PersistenceContext unitName has
multiple matches: unitName "berechtigung" has 8 possible matches.
ERROR - FAIL ... PersonServiceImpl: @PersistenceContext unitName has
multiple matches: unitName "berechtigung" has 8 possible matches.
ERROR - Invalid
EjbModule(path=D:\projekte\HEAD\ed02\sys\berechtigung\berechtigung-journal\target\test-classes)
ERROR - FAIL ... KreditgeberDAOHibernateJpa: Persistence unit not found for
@PersistenceContext(name="em", unitName=""). Available units [berechtigung,
berechtigung, berechtigung, berechtigung, berechtigung, berechtigungPartner,
berechtigungPartner, challenge_wertelisten]
ERROR - FAIL ... LandDAOHibernateJpa: Persistence unit not found for
@PersistenceContext(name="em", unitName=""). Available units [berechtigung,
berechtigung, berechtigung, berechtigung, berechtigung, berechtigungPartner,
berechtigungPartner, challenge_wertelisten]
ERROR - FAIL ... PartnerverwaltungAdminServiceImpl: @PersistenceContext
unitName has multiple matches: unitName "berechtigungPartner" has 8 possible
matches.
ERROR - FAIL ... PartnerverwaltungServiceImpl: Persistence unit not found
for @PersistenceContext(name="entityManager", unitName=""). Available units
[berechtigung, berechtigung, berechtigung, berechtigung, berechtigung,
berechtigungPartner, berechtigungPartner, challenge_wertelisten]
ERROR - FAIL ... VertragspartnerDAOHibernateJpa: Persistence unit not
found
for @PersistenceContext(name="em", unitName=""). Available units
[berechtigung, berechtigung, berechtigung, berechtigung, berechtigung,
berechtigungPartner, berechtigungPartner, challenge_wertelisten]
ERROR - FAIL ... VertriebskanalZuordnungDAOHibernateJpa: Persistence unit
not found for @PersistenceContext(name="em", unitName=""). Available units
[berechtigung, berechtigung, berechtigung, berechtigung, berechtigung,
berechtigungPartner, berechtigungPartner, challenge_wertelisten]
ERROR - FAIL ... VertriebsstelleDAOHibernateJpa: Persistence unit not
found
for @PersistenceContext(name="em", unitName=""). Available units
[berechtigung, berechtigung, berechtigung, berechtigung, berechtigung,
berechtigungPartner, berechtigungPartner, challenge_wertelisten]
ERROR - FAIL ... VPFusionenDAOHibernateJpa: Persistence unit not found for
@PersistenceContext(name="em", unitName=""). Available units [berechtigung,
berechtigung, berechtigung, berechtigung, berechtigung, berechtigungPartner,
berechtigungPartner, challenge_wertelisten]
ERROR - FAIL ... PartnerJournalServiceImpl: @PersistenceContext unitName has
multiple matches: unitName "berechtigungPartner" has 8 possible matches.
ERROR - FAIL ... PartnerElementServiceImpl: Persistence unit not found for
@PersistenceContext(name="entityManager", unitName=""). Available units
[berechtigung, berechtigung, berechtigung, berechtigung, berechtigung,
berechtigungPartner, berechtigungPartner, challenge_wertelisten]
ERROR - Invalid
EjbModule(path=D:\projekte\HEAD\ed02\sys\berechtigung\partner-impl\target\classes)
ERROR - FAIL ... AufgabenbereichHibernateJpaDAO: @PersistenceContext
unitName has multiple matches: unitName "berechtigung" has 8 possible
matches.
ERROR - FAIL ... RolleHibernateJpaDAO: @PersistenceContext unitName has
multiple matches: unitName "berechtigung" has 8 possible matches.
ERROR - Invalid
EjbModule(path=D:\projekte\HEAD\ed02\sys\berechtigung\rechte-impl\target\classes)
INFO - Set the 'openejb.validation.output.level' system property to VERBOSE
for increased validation details.
WARN - Jar not loaded. classpath.ear. Module failed validation.
AppModule(path=classpath.ear)
WARN - Property "Cache" not supported by "Default Stateful Container"
WARN - Property "Passivator" not supported by "Default Stateful Container"
WARN - Property "TimeOut" not supported by "Default Stateful Container"
WARN - Property "PoolSize" not supported by "Default Stateful Container"
WARN - Property "BulkPassivate" not supported by "Default Stateful
Container"
David Blevins wrote:
>
>
> On Sep 4, 2008, at 10:33 AM, David Blevins wrote:
>
>> Hi Andreas,
>>
>> We could probably hook that up. If you want a temporary workaround
>> you could create the UserTransaction yourself like so:
>>
>> UserTransaction utx = new
>> org.apache.openejb.core.CoreUserTransaction(null);
>>
>> Shouldn't be too difficult to get the JNDI lookup in there, but it
>> will probably be next week before I can get to it.
>
>
> Got this hooked up for you. Now a local client can lookup any of
> these three:
>
> context.lookup("java:comp/TransactionManager")
>
> context.lookup("java:comp/UserTransaction")
>
> context.lookup("java:comp/TransactionSynchronizationRegistry")
>
>
> Published new 3.1-SNAPSHOT jars to the people.apache.org maven repo if
> you'd like to give it a try.
>
> -David
>
>
>
--
View this message in context:
http://www.nabble.com/UserTransaction-in-openejb-tp19313741p19529648.html
Sent from the OpenEJB Dev mailing list archive at Nabble.com.