tomee-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Michael Baylis <mich...@baylishome.me.uk>
Subject JUnit embedded OPENEJB and XAResource problems
Date Fri, 06 Jan 2012 14:11:40 GMT
Hi Folks,
            I am receiving the following error with an embedded OpenEJB 
session for use with junit tests.  I'm using IBM JDK 6, OpenEJB 4 and 
Derby or MySQL.   I can find only one solution to this via google, but 
that requires changing OpenEJB code.   Is there a property I can set in 
the InitialContext to prevent OpenJPA from using XA transaction 
management and use local instead?  Or is there another solution I am 
missing?

Cheers,

Michael

Exception in thread "main" javax.ejb.EJBException: The bean encountered 
a non-application exception; nested exception is:
<openjpa-2.1.1-r422266:1148538 fatal general error> 
org.apache.openjpa.persistence.PersistenceException: Connection does not 
have a registered XAResource jdbc:derby:firstdb, UserName=sa, Apache 
Derby Embedded JDBC Driver
     at 
org.apache.openejb.core.ivm.BaseEjbProxyHandler.convertException(BaseEjbProxyHandler.java:363)
     at 
org.apache.openejb.core.ivm.BaseEjbProxyHandler.invoke(BaseEjbProxyHandler.java:288)
     at $Proxy56.getTestString(Unknown Source)
     at t.TG1.main(TG1.java:36)
Caused by: <openjpa-2.1.1-r422266:1148538 fatal general error> 
org.apache.openjpa.persistence.PersistenceException: Connection does not 
have a registered XAResource jdbc:derby:firstdb, UserName=sa, Apache 
Derby Embedded JDBC Driver
     at 
org.apache.openjpa.jdbc.sql.DBDictionaryFactory.newDBDictionary(DBDictionaryFactory.java:102)
     at 
org.apache.openjpa.jdbc.conf.JDBCConfigurationImpl.getDBDictionaryInstance(JDBCConfigurationImpl.java:603)
     at 
org.apache.openjpa.jdbc.meta.MappingRepository.endConfiguration(MappingRepository.java:1510)
     at 
org.apache.openjpa.lib.conf.Configurations.configureInstance(Configurations.java:518)
     at 
org.apache.openjpa.lib.conf.Configurations.configureInstance(Configurations.java:443)
     at 
org.apache.openjpa.lib.conf.PluginValue.instantiate(PluginValue.java:104)
     at 
org.apache.openjpa.conf.MetaDataRepositoryValue.instantiate(MetaDataRepositoryValue.java:68)
     at 
org.apache.openjpa.lib.conf.ObjectValue.instantiate(ObjectValue.java:83)
     at 
org.apache.openjpa.conf.OpenJPAConfigurationImpl.newMetaDataRepositoryInstance(OpenJPAConfigurationImpl.java:949)
     at 
org.apache.openjpa.conf.OpenJPAConfigurationImpl.getMetaDataRepositoryInstance(OpenJPAConfigurationImpl.java:940)
     at 
org.apache.openjpa.kernel.AbstractBrokerFactory.makeReadOnly(AbstractBrokerFactory.java:637)
     at 
org.apache.openjpa.kernel.AbstractBrokerFactory.newBroker(AbstractBrokerFactory.java:204)
     at 
org.apache.openjpa.kernel.DelegatingBrokerFactory.newBroker(DelegatingBrokerFactory.java:156)
     at 
org.apache.openjpa.persistence.EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:227)
     at 
org.apache.openjpa.persistence.EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:60)
     at 
org.apache.openejb.persistence.JtaEntityManagerRegistry.getEntityManager(JtaEntityManagerRegistry.java:115)
     at 
org.apache.openejb.persistence.JtaEntityManager.getEntityManager(JtaEntityManager.java:77)
     at 
org.apache.openejb.persistence.JtaEntityManager.find(JtaEntityManager.java:150)
     at 
uk.me.baylishome.homeaccounts.ejb.impl.TestEJB.getTestString(TestEJB.java:29)
     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
     at 
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:60)
     at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:37)
     at java.lang.reflect.Method.invoke(Method.java:611)
     at 
org.apache.openejb.core.interceptor.ReflectionInvocationContext$Invocation.invoke(ReflectionInvocationContext.java:181)
     at 
org.apache.openejb.core.interceptor.ReflectionInvocationContext.proceed(ReflectionInvocationContext.java:163)
     at 
org.apache.openejb.monitoring.StatsInterceptor.record(StatsInterceptor.java:174)
     at 
org.apache.openejb.monitoring.StatsInterceptor.invoke(StatsInterceptor.java:93)
     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
     at 
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:60)
     at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:37)
     at java.lang.reflect.Method.invoke(Method.java:611)
     at 
org.apache.openejb.core.interceptor.ReflectionInvocationContext$Invocation.invoke(ReflectionInvocationContext.java:181)
     at 
org.apache.openejb.core.interceptor.ReflectionInvocationContext.proceed(ReflectionInvocationContext.java:163)
     at 
org.apache.openejb.cdi.CdiInterceptor.invoke(CdiInterceptor.java:129)
     at 
org.apache.openejb.cdi.CdiInterceptor.access$000(CdiInterceptor.java:45)
     at org.apache.openejb.cdi.CdiInterceptor$1.call(CdiInterceptor.java:66)
     at 
org.apache.openejb.cdi.CdiInterceptor.aroundInvoke(CdiInterceptor.java:72)
     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
     at 
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:60)
     at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:37)
     at java.lang.reflect.Method.invoke(Method.java:611)
     at 
org.apache.openejb.core.interceptor.ReflectionInvocationContext$Invocation.invoke(ReflectionInvocationContext.java:181)
     at 
org.apache.openejb.core.interceptor.ReflectionInvocationContext.proceed(ReflectionInvocationContext.java:163)
     at 
org.apache.openejb.core.interceptor.InterceptorStack.invoke(InterceptorStack.java:130)
     at 
org.apache.openejb.core.stateless.StatelessContainer._invoke(StatelessContainer.java:226)
     at 
org.apache.openejb.core.stateless.StatelessContainer.invoke(StatelessContainer.java:178)
     at 
org.apache.openejb.core.ivm.EjbObjectProxyHandler.synchronizedBusinessMethod(EjbObjectProxyHandler.java:255)
     at 
org.apache.openejb.core.ivm.EjbObjectProxyHandler.businessMethod(EjbObjectProxyHandler.java:235)
     at 
org.apache.openejb.core.ivm.EjbObjectProxyHandler._invoke(EjbObjectProxyHandler.java:92)
     at 
org.apache.openejb.core.ivm.BaseEjbProxyHandler.invoke(BaseEjbProxyHandler.java:284)
     ... 2 more
Caused by: java.sql.SQLException: Connection does not have a registered 
XAResource jdbc:derby:firstdb, UserName=sa, Apache Derby Embedded JDBC 
Driver
     at 
org.apache.commons.dbcp.managed.TransactionRegistry.getXAResource(TransactionRegistry.java:78)
     at 
org.apache.commons.dbcp.managed.TransactionContext.setSharedConnection(TransactionContext.java:88)
     at 
org.apache.commons.dbcp.managed.ManagedConnection.updateTransactionStatus(ManagedConnection.java:131)
     at 
org.apache.commons.dbcp.managed.ManagedConnection.<init>(ManagedConnection.java:55)
     at 
org.apache.commons.dbcp.managed.ManagedDataSource.getConnection(ManagedDataSource.java:77)
     at 
org.apache.commons.dbcp.BasicDataSource.getConnection(BasicDataSource.java:1044)
     at 
org.apache.openjpa.lib.jdbc.DelegatingDataSource.getConnection(DelegatingDataSource.java:131)
     at 
org.apache.openjpa.lib.jdbc.DecoratingDataSource.getConnection(DecoratingDataSource.java:106)
     at 
org.apache.openjpa.jdbc.sql.DBDictionaryFactory.newDBDictionary(DBDictionaryFactory.java:91)
     ... 51 more


Mime
View raw message