Return-Path: X-Original-To: apmail-aries-user-archive@www.apache.org Delivered-To: apmail-aries-user-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id BF79FC305 for ; Fri, 27 Apr 2012 23:20:36 +0000 (UTC) Received: (qmail 64989 invoked by uid 500); 27 Apr 2012 23:20:36 -0000 Delivered-To: apmail-aries-user-archive@aries.apache.org Received: (qmail 64920 invoked by uid 500); 27 Apr 2012 23:20:35 -0000 Mailing-List: contact user-help@aries.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: user@aries.apache.org Delivered-To: mailing list user@aries.apache.org Received: (qmail 64910 invoked by uid 99); 27 Apr 2012 23:20:35 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 27 Apr 2012 23:20:35 +0000 X-ASF-Spam-Status: No, hits=-0.7 required=5.0 tests=RCVD_IN_DNSWL_LOW,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of dmw.andrus@gmail.com designates 74.125.82.48 as permitted sender) Received: from [74.125.82.48] (HELO mail-wg0-f48.google.com) (74.125.82.48) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 27 Apr 2012 23:20:31 +0000 Received: by wgbdq11 with SMTP id dq11so954638wgb.17 for ; Fri, 27 Apr 2012 16:20:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:date:message-id:subject:from:to:content-type; bh=yXIpOgEQm91wRnDHFJU6lVQDjU7c5M0Qs7iB+O15/TE=; b=aumWUhozmXX4qD44Qv+k/mkdsfjUid+VKySEZvxvVdwz7sYsZwK8RCSoUrlAbua0ku 5l4dnqyYfP//uLpUWjdlqHGupzJCGrFPetNzSic+6h1dVBcJOZd5HvvAMCf6vjO1vO0u dcQ+2qiyS7MJPbC5u20XI0P44NB8HSF5RQ1cJWwmX2G/gMl+JoVusfzzlsX660GItUTa MOkDi6xrM8jAWO1/U3R0GPoyRci6nuQ5APB+ur/NofD/c06ILbwjzIY+vH5JCGZPsM2M AziVQWRZu+cn4n/1NX5p/xf7mRaTKjw5DfkvY0OnLcXrG7I6GAyeaec8STRG1F2yIiyk +rzQ== MIME-Version: 1.0 Received: by 10.180.101.65 with SMTP id fe1mr9966197wib.21.1335568809613; Fri, 27 Apr 2012 16:20:09 -0700 (PDT) Received: by 10.216.10.148 with HTTP; Fri, 27 Apr 2012 16:20:09 -0700 (PDT) Date: Fri, 27 Apr 2012 19:20:09 -0400 Message-ID: Subject: Aries JPA with JTA Transactions From: Diane Andrus To: user@aries.apache.org Content-Type: text/plain; charset=ISO-8859-1 X-Virus-Checked: Checked by ClamAV on apache.org Hi, I'm trying to get a JTA transaction working in Karaf on a very simple model. I was saving & retrieving the model via my hibernate mapping at some point, but now I am not. I started with this tutorial (which seems very good in getting the concept of jpa & osgi) http://jaxenter.com/tutorial-using-jpa-in-an-osgi-environment-36661.html, but, it doesn't use a DataSource and JTA transactions, and make Aries manage my transactions. I didn't think it would be so hard. Most of this is pretty verbatim from the Aries JPA home page. There's this cryptic remark, that I'm not quite sure what it means.... "To access to the datasource, you must provide within the or depending if you use a JTA transaction manager or not. org.apache.openjpa.persistence.PersistenceProviderImpl osgi:service/javax.sql.DataSource/(osgi.jndi.service.name=jdbc/reportincidentdb)" Is there a JTA transaction manager bundle that I have to deploy as well? I'm using karaf, and I just installed the jpa, jndi, & transaction features. I have some commons bundles & the derby driver and I believe all of the dependencies that I need running....but I am missing some secret sauce here. I'm using hibernate as my JPA provider (which is probably the problem....some missing library or crazy classloading issue) My current error: 2012-04-27 18:30:10,518 | INFO | FelixStartLevel | ConnectionProviderFactory | ection.ConnectionProviderFactory 173 | 65 - hibernate-wrapper - 1.0.0.SNAPSHOT | Initializing connection provider: org.hibernate.ejb.connection.InjectedDataSourceConnectionProvider 2012-04-27 18:30:10,522 | INFO | FelixStartLevel | ctedDataSourceConnectionProvider | ctedDataSourceConnectionProvider 62 | 65 - hibernate-wrapper - 1.0.0.SNAPSHOT | Using provided datasource 2012-04-27 18:30:10,534 | DEBUG | lixDispatchQueue | container | ? ? | 53 - org.apache.aries.jpa.container - 0.3.0 | FrameworkEvent ERROR java.lang.IllegalStateException: The bundle com.mycompany.PersistenceModel_1.0.0.SNAPSHOT is not started. at org.apache.aries.jpa.container.unit.impl.DelayedLookupDataSource.getDs(DelayedLookupDataSource.java:50)[53:org.apache.aries.jpa.container:0.3.0] at org.apache.aries.jpa.container.unit.impl.DelayedLookupDataSource.getConnection(DelayedLookupDataSource.java:74)[53:org.apache.aries.jpa.container:0.3.0] at org.hibernate.ejb.connection.InjectedDataSourceConnectionProvider.getConnection(InjectedDataSourceConnectionProvider.java:71)[65:gov.navair.dep.hibernate-wrapper:1.0.0.SNAPSHOT] at org.hibernate.cfg.SettingsFactory.buildSettings(SettingsFactory.java:113)[65:gov.navair.dep.hibernate-wrapper:1.0.0.SNAPSHOT] at org.hibernate.cfg.Configuration.buildSettingsInternal(Configuration.java:2836)[65:gov.navair.dep.hibernate-wrapper:1.0.0.SNAPSHOT] at org.hibernate.cfg.Configuration.buildSettings(Configuration.java:2832)[65:gov.navair.dep.hibernate-wrapper:1.0.0.SNAPSHOT] at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1843)[65:gov.navair.dep.hibernate-wrapper:1.0.0.SNAPSHOT] at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:906)[65:gov.navair.dep.hibernate-wrapper:1.0.0.SNAPSHOT] at org.hibernate.ejb.HibernatePersistence.createContainerEntityManagerFactory(HibernatePersistence.java:74)[65:gov.navair.dep.hibernate-wrapper:1.0.0.SNAPSHOT] at org.apache.aries.jpa.container.impl.EntityManagerFactoryManager.createEntityManagerFactories(EntityManagerFactoryManager.java:263)[53:org.apache.aries.jpa.container:0.3.0] at org.apache.aries.jpa.container.impl.EntityManagerFactoryManager.bundleStateChange(EntityManagerFactoryManager.java:153)[53:org.apache.aries.jpa.container:0.3.0] at org.apache.aries.jpa.container.impl.PersistenceBundleManager.modifiedBundle(PersistenceBundleManager.java:283)[53:org.apache.aries.jpa.container:0.3.0] at org.osgi.util.tracker.BundleTracker$Tracked.customizerModified(BundleTracker.java:453)[karaf.jar:2.2.5] at org.osgi.util.tracker.AbstractTracked.track(AbstractTracked.java:237)[karaf.jar:2.2.5] at org.osgi.util.tracker.BundleTracker$Tracked.bundleChanged(BundleTracker.java:413)[karaf.jar:2.2.5] at org.apache.felix.framework.util.EventDispatcher.invokeBundleListenerCallback(EventDispatcher.java:807)[org.apache.felix.framework-3.0.9.jar:] at org.apache.felix.framework.util.EventDispatcher.fireEventImmediately(EventDispatcher.java:729)[org.apache.felix.framework-3.0.9.jar:] at org.apache.felix.framework.util.EventDispatcher.fireBundleEvent(EventDispatcher.java:610)[org.apache.felix.framework-3.0.9.jar:] at org.apache.felix.framework.Felix.fireBundleEvent(Felix.java:3761)[org.apache.felix.framework-3.0.9.jar:] at org.apache.felix.framework.Felix.access$600(Felix.java:80)[org.apache.felix.framework-3.0.9.jar:] at org.apache.felix.framework.Felix$FelixResolver.fireResolvedEvents(Felix.java:4299)[org.apache.felix.framework-3.0.9.jar:] at org.apache.felix.framework.Felix$FelixResolver.resolve(Felix.java:4065)[org.apache.felix.framework-3.0.9.jar:] at org.apache.felix.framework.Felix.resolveBundle(Felix.java:3439)[org.apache.felix.framework-3.0.9.jar:] at org.apache.felix.framework.Felix.startBundle(Felix.java:1734)[org.apache.felix.framework-3.0.9.jar:] at org.apache.felix.framework.Felix.setActiveStartLevel(Felix.java:1163)[org.apache.felix.framework-3.0.9.jar:] at org.apache.felix.framework.StartLevelImpl.run(StartLevelImpl.java:264)[org.apache.felix.framework-3.0.9.jar:] And it's crazy weird, because then my model bundle status is ACTIVE, even though it failed to really start. So, of course, my service won't start, b/c model bundle never finished it's JPA stuff and it never got Aries to export an Entity Manager Factory for it.... I've actually lost track of everything I've tried. I started out with wanting to have a clean model bundle, not dependent on jaxb or jpa stuff, but, that didn't seem to work. So, I'm at the point where I just want a JTA transaction working with Aries taking care of transactions for me. That would be my goal for now. I hope its some simple thing I missed. Any help would be appreciated...Please Thanks, Diane ========== Bundle #1: Datasource I pretty much copied by datasource config from the main page of Aries JPA. ========== Bundle #2: Persistence Model java class: com/mycompany/persistencemodel/App - simple POJO public class App { private Integer appId; private String name; private String status; private String version; private String description; ....default constructor & generated getter & setter for each property.... } META-INF/persistence.xml org.hibernate.ejb.HibernatePersistence osgi:service/javax.sql.DataSource/(osgi.jndi.service.name=jdbc/derbyds) mappings/app.hbm.xml (and yes...META-INF/persistence.xml in my pom.xml) mappings/app.hbm.xml ========== Bundle #3 hibernate wrapper from http://jaxenter.com/tutorial-using-jpa-in-an-osgi-environment-36661.html ========== Bundle #4 Persistence Service