-----Original Message-----
From: Hans J. Prueller [mailto:[EMAIL PROTECTED]
Sent: Monday, February 05, 2007 12:54 PM
To: [EMAIL PROTECTED]
Subject: AW: Using OpenJPA within an "old" J2EE1.4 container
with managed transactions?
If that doesn't work, can you post the complete stack trace?
Thank you for your help. Unfortunately it did NOT work. I'm
not sure what
the exact problem is, here are the strack-traces:
first case:
====================================================================
openjpa.ManagedRuntime:
jndi(TransactionManagerName=java:comp/UserTransaction)
2007-02-05 21:33:32,109 : IMSSystemBean.initializeJPA :
initializing JPA
persist
ence.
2007-02-05 21:33:33,796 : IMSSystemBean.initializeJPA : testing JPA
persistence
156 INFO [RMI TCP Connection(7)-192.168.0.6]
openjpa.Runtime - Starting
OpenJ
PA 0.9.6-incubating
359 INFO [RMI TCP Connection(7)-192.168.0.6]
openjpa.jdbc.JDBC - OpenJPA
will
now connect to the database to attempt to determine what
type of database
dicti
onary to use. To prevent this connection in the future, set your
openjpa.jdbc.D
BDictionary configuration property to the appropriate value for your
database (s
ee the documentation for available values).
469 INFO [RMI TCP Connection(7)-192.168.0.6]
openjpa.jdbc.JDBC - Using
dictio
nary class "org.apache.openjpa.jdbc.sql.MySQLDictionary" (MySQL
5.0.27-community
-nt ,MySQL-AB JDBC Driver mysql-connector-java-5.0.4 ( $Date:
2006-10-19
17:47:4
8 +0200 (Thu, 19 Oct 2006) $, $Revision: 5908 $ )).
812 INFO [RMI TCP Connection(7)-192.168.0.6]
openjpa.MetaData - Found 1
class
es with metadata in 15 milliseconds.
844 INFO [RMI TCP Connection(7)-192.168.0.6]
openjpa.MetaData - Found 1
class
es with metadata in 0 milliseconds.
1094 INFO [RMI TCP Connection(7)-192.168.0.6]
openjpa.MetaData - Parsing
clas
s "com.lbslogics.ims.util.JPATestObject".
1094 INFO [RMI TCP Connection(7)-192.168.0.6]
openjpa.MetaData - Parsing
pack
age "com.lbslogics.ims.util.JPATestObject".
1359 INFO [RMI TCP Connection(7)-192.168.0.6]
openjpa.jdbc.Schema -
Reading t
able information for schema name "null", table name "JPATestObject".
1437 INFO [RMI TCP Connection(7)-192.168.0.6]
openjpa.jdbc.Schema -
Reading s
equence information for schema "null", sequence name "null".
<4|false|0.9.6-incubating>
org.apache.openjpa.persistence.InvalidStateException:
You cannot access the EntityTransaction when using managed
transactions.
at
org.apache.openjpa.persistence.EntityManagerImpl.getTransaction
(Entit
yManagerImpl.java:360)
at
com.lbslogics.ims.system.ejb.IMSSystemBean.initializeJPA
(IMSSystemBea
n.java:1102)
at
com.lbslogics.ims.system.ejb.IMSSystemBean.startup
(IMSSystemBean.java
:1061)
at
org.objectweb.jonas_gen.com.lbslogics.ims.system.interfaces.JOnASIMS
S
ystemBean2005147373Remote.startup(JOnASIMSSystemBean2005147373
Remote.java:23
4)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native
Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke
(NativeMethodAccessorImpl.
java:39)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke
(DelegatingMethodAcces
sorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at
sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:294)
at
org.objectweb.carol.rmi.jrmp.server.JUnicastServerRef.dispatch
(JUnica
stServerRef.java:143)
at sun.rmi.transport.Transport$1.run(Transport.java:153)
at java.security.AccessController.doPrivileged(Native
Method)
at sun.rmi.transport.Transport.serviceCall(Transport.java:
149)
at
sun.rmi.transport.tcp.TCPTransport.handleMessages
(TCPTransport.java:4
66)
at
sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run
(TCPTransport
.java:707)
at java.lang.Thread.run(Thread.java:595)
2007-02-05 21:33:35,187 : IMSSystemBean.startup : ERROR while
initializing
JPA:
You cannot access the EntityTransaction when using managed
transactions.
second case:
====================================================================
openjpa.ManagedRuntime: jndi(TransactionManagerName=/
UserTransaction)
<0|false|0.9.6-incubating>
org.apache.openjpa.persistence.PersistenceException:
/UserTransaction
at
org.apache.openjpa.kernel.AbstractBrokerFactory.syncWithManagedTrans
a
ction(AbstractBrokerFactory.java:633)
at
org.apache.openjpa.kernel.BrokerImpl.initialize(BrokerImpl.java:292)
at
org.apache.openjpa.kernel.AbstractBrokerFactory.newBroker
(AbstractBro
kerFactory.java:165)
at
org.apache.openjpa.kernel.DelegatingBrokerFactory.newBroker
(Delegatin
gBrokerFactory.java:139)
at
org.apache.openjpa.persistence.EntityManagerFactoryImpl.createEntity
M
anager(EntityManagerFactoryImpl.java:187)
at
org.apache.openjpa.persistence.EntityManagerFactoryImpl.createEntity
M
anager(EntityManagerFactoryImpl.java:140)
at
org.apache.openjpa.persistence.EntityManagerFactoryImpl.createEntity
M
anager(EntityManagerFactoryImpl.java:52)
at
com.lbslogics.ims.system.ejb.IMSSystemBean.initializeJPA
(IMSSystemBea
n.java:1099)
at
com.lbslogics.ims.system.ejb.IMSSystemBean.startup
(IMSSystemBean.java
:1061)
at
org.objectweb.jonas_gen.com.lbslogics.ims.system.interfaces.JOnASIMS
S
ystemBean2005147373Remote.startup(JOnASIMSSystemBean2005147373
Remote.java:23
4)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native
Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke
(NativeMethodAccessorImpl.
java:39)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke
(DelegatingMethodAcces
sorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at
sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:294)
at
org.objectweb.carol.rmi.jrmp.server.JUnicastServerRef.dispatch
(JUnica
stServerRef.java:143)
at sun.rmi.transport.Transport$1.run(Transport.java:153)
at java.security.AccessController.doPrivileged(Native
Method)
at sun.rmi.transport.Transport.serviceCall(Transport.java:
149)
at
sun.rmi.transport.tcp.TCPTransport.handleMessages
(TCPTransport.java:4
66)
at
sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run
(TCPTransport
.java:707)
at java.lang.Thread.run(Thread.java:595)
Caused by: javax.naming.NameNotFoundException: /UserTransaction
at
com.sun.jndi.rmi.registry.RegistryContext.lookup
(RegistryContext.java
:95)
at javax.naming.InitialContext.lookup(InitialContext.java:
355)
at
org.objectweb.carol.jndi.spi.AbsContext.lookup(AbsContext.java:140)
at
org.objectweb.carol.jndi.spi.AbsContext.lookup(AbsContext.java:150)
at javax.naming.InitialContext.lookup(InitialContext.java:
351)
at
org.objectweb.carol.jndi.spi.MultiContext.lookup
(MultiContext.java:11
8)
at javax.naming.InitialContext.lookup(InitialContext.java:
351)
at
org.apache.openjpa.ee.JNDIManagedRuntime.getTransactionManager
(JNDIMa
nagedRuntime.java:51)
at
org.apache.openjpa.kernel.AbstractBrokerFactory.syncWithManagedTrans
a
ction(AbstractBrokerFactory.java:598)
... 21 more
2007-02-05 21:44:10,921 : IMSSystemBean.startup : ERROR while
initializing
JPA:
/UserTransaction
*************************************************
From my understanding it seems that there is a fatal error in
the second
case, like openJPA was not able to even lookup JOnAS'
transaction manager.
It seems to me that in the first case, the transaction
manager lookup worked
but there is another subsequent error?
<4|false|0.9.6-incubating>
org.apache.openjpa.persistence.InvalidStateException:
You cannot access the EntityTransaction when using managed
transactions.
at
org.apache.openjpa.persistence.EntityManagerImpl.getTransaction
(Entit
yManagerImpl.java:360)
Can you explain what this message means exactly?
thank you in advance,
HANS
-----Ursprüngliche Nachricht-----
Von: Marc Prud'hommeaux [mailto:[EMAIL PROTECTED]
Im Auftrag von
Marc Prud'hommeaux
Gesendet: Montag, 05. Februar 2007 21:19
An: [EMAIL PROTECTED]
Betreff: Re: Using OpenJPA within an "old" J2EE1.4
container with managed
transactions?
Hans-
We might not have Jonas' TransactionManager location configured in
the automatic TM lookup in OpenJPA. Can you try to manually specify
it with the following property:
openjpa.ManagedRuntime: jndi(TransactionManagerName=java:comp/
UserTransaction)
if that doesn't work, try:
openjpa.ManagedRuntime: jndi(TransactionManagerName=/
UserTransaction)
(apparently, Jonas' UserTransaction implementation is also their
TransactionManager implementation)
If that doesn't work, can you post the complete stack trace?
If it does work, please let us know so we can add it to the list of
auto-discovered transaction managers.
On Feb 5, 2007, at 12:05 PM, Hans J. Prueller wrote:
Hi there,
I'm trying to migrate our "old" J2EE1.4 / EJB2.1 applications
persistence to
openJPA. Currently I got stuck when
trying to configure OpenJPA persistence, when creating the
EntityManagerFactory and the EntityManager instance,
I get the following error:
<4|true|0.9.6-incubating>
org.apache.openjpa.persistence.InvalidStateException:
Could not perform automatic lookup of EJB container's
javax.transaction.Transact
ionManager implementation. Please ensure that you are running the
application fr
om within an EJB 1.1 compliant EJB container, and then set the
org.apache.openjp
a.ManagedRuntime property to the appropriate value to obtain the
TransactionMana
ger.
at
org.apache.openjpa.ee.AutomaticManagedRuntime.getTransactionManager(
A
utomaticManagedRuntime.java:180)
at
org.apache.openjpa.kernel.AbstractBrokerFactory.syncWithManagedTrans
a
ction(AbstractBrokerFactory.java:598)
at
org.apache.openjpa.kernel.BrokerImpl.initialize(BrokerImpl.java:292)
at
org.apache.openjpa.kernel.AbstractBrokerFactory.newBroker
(AbstractBro
kerFactory.java:165)
at
org.apache.openjpa.kernel.DelegatingBrokerFactory.newBroker
(Delegatin
gBrokerFactory.java:139)
at
org.apache.openjpa.persistence.EntityManagerFactoryImpl.createEntity
M
anager(EntityManagerFactoryImpl.java:187)
Currently I'm running the application within the JOnAS 4.8.3 J2EE
Server.
How can I configure open JPA to
use the provided managed Transactions of JOnAS? (this
works also with
Hibernate 2.x so I assume it should
somehow be possible with openJPA?)
any help appreciated!
regards,
HANS
===========================
virtually hanzz...
<http://hanzz.zapto.org> http://hanzz.zapto.org (personal)
<http://www.cse.dmu.ac.uk/~hansp> http://www.cse.dmu.ac.uk/~hansp
(research)