Hi Jason,

yeah this one is really awkward and I can confirm I've seen this one
just recently.
With the same setup.
But didn't really bother to get down further now cause the objects
where actually persisted.
To my knowledge the transaction manager should be provided by aries
therefore a specialized
transaction tooling shouldn't be required but I might be wrong.
As soon as I find some time I'll try to dig into this :)

regards, Achim

2012/7/24 Jason <[email protected]>:
> Hi all,
>
> I have been running into an exception lately and can't seem to remedy the
> problem.  I am getting a "javax.persistence.TransactionRequiredException: No
> transaction currently active" exception.  I am using Karaf v2.2.8, ActiveMQ
> 5.6.0, OpenJPA 2.1.1, and CXF 2.6.1.  I followed the Apache Aries sample
> blog application, so there is a datasource registered via blueprint...looks
> like this:
>
> <?xml version="1.0" encoding="UTF-8"?>
>
> <blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0";
> xmlns:cm="http://aries.apache.org/blueprint/xmlns/blueprint-cm/v1.1.0";
>
>   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
> default-activation="lazy">
>
>   <cm:property-placeholder persistent-id="edu.unc.mapseq.ds">
>
>     <cm:default-properties>
>
> ....snip....
>
>     </cm:default-properties>
>
>   </cm:property-placeholder>
>
>   <bean id="mapseq-ds-jta" class="org.postgresql.xa.PGXADataSource">
>
>     <property name="user" value="${username}" />
>
>     <property name="password" value="${password}" />
>
>     <property name="serverName" value="${serverName}" />
>
>     <property name="databaseName" value="${databaseName}" />
>
>     <property name="portNumber" value="${port}" />
>
>   </bean>
>
>   <service id="mapseqXADataSource" ref="mapseq-ds-jta"
> interface="javax.sql.XADataSource">
>
>     <service-properties>
>
>       <entry key="osgi.jndi.service.name" value="jdbc/mapseqJTA" />
>
>     </service-properties>
>
>   </service>
>
>   <bean id="mapseq-ds-no-jta" class="org.postgresql.ds.PGPoolingDataSource">
>
>     <property name="user" value="${username}" />
>
>     <property name="password" value="${password}" />
>
>     <property name="serverName" value="${serverName}" />
>
>     <property name="databaseName" value="${databaseName}" />
>
>     <property name="portNumber" value="${port}" />
>
>     <property name="initialConnections" value="${maxIdle}" />
>
>     <property name="maxConnections" value="${maxActive}" />
>
>   </bean>
>
>   <service id="mapseqDataSource" ref="mapseq-ds-no-jta"
> interface="javax.sql.DataSource">
>
>     <service-properties>
>
>       <entry key="osgi.jndi.service.name" value="jdbc/mapseqNoJTA" />
>
>     </service-properties>
>
>   </service>
>
> </blueprint>
>
>
> Here is the persistence.xml:
>
> <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="mapseq" transaction-type="JTA">
>
>
> <provider>org.apache.openjpa.persistence.PersistenceProviderImpl</provider>
>
>
> <jta-data-source>aries:services/javax.sql.DataSource/(osgi.jndi.service.name=jdbc/mapseqJTA)</jta-data-source>
>
>
> <non-jta-data-source>aries:services/javax.sql.DataSource/(osgi.jndi.service.name=jdbc/mapseqNoJTA)</non-jta-data-source>
>
> ...snip...
>
>     <exclude-unlisted-classes>true</exclude-unlisted-classes>
>
>     <properties>
>
>       <!-- <property name="openjpa.jdbc.SynchronizeMappings"
> value="buildSchema(ForeignKeys=true)" /> -->
>
>       <!-- <property name="openjpa.Log" value="DefaultLevel=TRACE,
> Runtime=TRACE, Tool=TRACE, SQL=TRACE" /> -->
>
>       <property name="openjpa.jdbc.MappingDefaults"
> value="ForeignKeyDeleteAction=restrict, JoinForeignKeyDeleteAction=restrict"
> />
>
>       <property name="openjpa.Log" value="DefaultLevel=WARN, Runtime=INFO,
> Tool=INFO, SQL=WARN" />
>
>       <property name="openjpa.jdbc.DBDictionary"
> value="postgres(SearchStringEscape=\, SupportsXMLColumn=false)" />
>
>       <property name="openjpa.DataCache" value="false" />
>
>       <property name="openjpa.QueryCache" value="false" />
>
>     </properties>
>
>   </persistence-unit>
>
> </persistence>
>
>
> And finally, the blueprint.xml file to register JPA DAO services:
>
> <?xml version="1.0" encoding="UTF-8"?>
>
> <blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0";
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
>
>   xmlns:tx="http://aries.apache.org/xmlns/transactions/v1.0.0";
> xmlns:jpa="http://aries.apache.org/xmlns/jpa/v1.0.0";
>
>   default-activation="lazy">
>
>   <bean id="accessControlDAOImpl"
> class="edu.unc.mapseq.dao.jpa.AccessControlDAOImpl" init-method="init">
>
>     <tx:transaction method="*" value="Required" />
>
>     <jpa:context property="entityManager" unitname="mapseq" />
>
>   </bean>
>
>   <service ref="accessControlDAOImpl"
> interface="edu.unc.mapseq.dao.AccessControlDAO" />
> ...snip...
>
> </blueprint>
>
>
> Here is part of the stacktrace:
>
> Caused by: javax.persistence.TransactionRequiredException: No transaction
> currently active
>
>     at
> org.apache.aries.jpa.container.context.transaction.impl.JTAPersistenceContextRegistry.getCurrentPersistenceContext(JTAPersistenceContextRegistry.java:103)
>
>     at
> org.apache.aries.jpa.container.context.transaction.impl.JTAEntityManager.getPersistenceContext(JTAEntityManager.java:83)
>
>     at
> org.apache.aries.jpa.container.context.transaction.impl.JTAEntityManager.persist(JTAEntityManager.java:278)
>
>     at edu.unc.mapseq.dao.jpa.BaseDAOImpl.save(BaseDAOImpl.java:36)
>
>     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native
> Method)[:1.6.0_24]
>
>     at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)[:1.6.0_24]
>
>     at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)[:1.6.0_24]
>
>     at java.lang.reflect.Method.invoke(Method.java:616)[:1.6.0_24]
>
>     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 $Proxy112.save(Unknown Source)
>
>     at
> edu.unc.mapseq.ws.impl.HTSFSampleServiceImpl.save(HTSFSampleServiceImpl.java:45)[234:mapseq-web-service-htsf-sample:0.0.1.SNAPSHOT]
>
>
> The exception occurs whenever I try to do anything that is transaction
> related (like persisting an entity).  I have set the logging in Karaf to
> DEBUG and I can't seem to find anything out of the ordinary.  Anyone seen
> this before??? Suggested solutions? Suggestions for debugging further?
>
>
> Regards,
> Jason
>



-- 

Apache Karaf <http://karaf.apache.org/> Committer & PMC
OPS4J Pax Web <http://wiki.ops4j.org/display/paxweb/Pax+Web/>
Committer & Project Lead
OPS4J Pax for Vaadin
<http://team.ops4j.org/wiki/display/PAXVAADIN/Home> Commiter & Project
Lead
blog <http://notizblog.nierbeck.de/>

Reply via email to