I've been banging my head against a wall for well over a week trying to get this to work. So now I'm coming to the experts for help.
I've got Karaf 2.2.5, OpenJPA 2.2.0, and Aries 0.3 installed. I've got an entity configured via the persistence.xml. The DataSources are loaded and a connection to the DB is acquired. But when I call em.getTransaction().begin() the whole hing blows up. It seems I'm winding up with the default JTAEntityManager that doesn't support Transacations, but attempts to set the TransactionManager via the properties section in the persistence.xml file aren't working. Any ideas on what I'm doing wrong? My persistence.xml: <?xml version="1.0" encoding="UTF-8"?> <persistence 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" version="1.0"> <persistence-unit name="metadataPersistenceUnit" transaction-type="JTA"> <description>Persistence unit for Metadata</description> <provider>org.apache.openjpa.persistence.PersistenceProviderImpl</provider> <jta-data-source>osgi:service/javax.sql.XADataSource/(osgi.jndi.service.name=jdbc/jta)</jta-data-source> <non-jta-data-source>osgi:service/javax.sql.DataSource/(osgi.jndi.service.name=jdbc/nojta)</non-jta-data-source> <class>MetadataEntity</class> <exclude-unlisted-classes>true</exclude-unlisted-classes> <properties> <property name="openjpa.Log" value="DefaultLevel=TRACE" /> <property name="openjpa.RuntimeUnenhancedClasses" value="unsupported" /> <property name="openjpa.jdbc.SynchronizeMappings" value="buildSchema" /> <property name="openjpa.TransactionMode" value="managed"/> <property name="openjpa.ManagedRuntime" value="jndi(TransactionManagerName=osgi:service/javax.transaction.TransactionManager)"/> </properties> </persistence-unit> </persistence> Here's the stack trace I get when trying to persist an Entity to the DB: Caused by: java.lang.IllegalStateException: Transaction management is not available for container managed EntityManagers at org.apache.aries.jpa.container.context.transaction.impl.JTAEntityManager.getTransaction(JTAEntityManager.java:244) at xxx.xxx.xxx.xxx(MetadataDAOImpl.java:65) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)[:1.6.0_17] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)[:1.6.0_17] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)[:1.6.0_17] at java.lang.reflect.Method.invoke(Method.java:597)[:1.6.0_17] at org.apache.aries.proxy.impl.ProxyHandler$1.invoke(ProxyHandler.java:50) at org.apache.aries.blueprint.proxy.Collaborator.invoke(Collaborator.java:91) at org.apache.aries.proxy.impl.ProxyHandler.invoke(ProxyHandler.java:78) at xxx.xxx.xxx(Unknown Source) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)[:1.6.0_17] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)[:1.6.0_17] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)[:1.6.0_17] at java.lang.reflect.Method.invoke(Method.java:597)[:1.6.0_17] at org.apache.aries.proxy.impl.ProxyHandler$1.invoke(ProxyHandler.java:50) at org.apache.aries.proxy.impl.DefaultWrapper.invoke(DefaultWrapper.java:31) at org.apache.aries.proxy.impl.ProxyHandler.invoke(ProxyHandler.java:78) at $Proxy33.saveNewMetadatas(Unknown Source) -- View this message in context: http://openjpa.208410.n2.nabble.com/OpenJPA-transactions-tp7411924p7411924.html Sent from the OpenJPA Users mailing list archive at Nabble.com.