For JPA integration with OSGi, take a look at the Apache Aries project- http://incubator.apache.org/aries/
The JPA module provides the OpenJPA+OSGi glue to expose us as a service and to discover persistence-units within bundles. There are two samples (Blog and AriesTrader) provided, which should help you get going, even though the samples use Eclipse Equinox right now, take a look at the following for the basic JPA bundling - https://svn.apache.org/repos/asf/incubator/aries/trunk/samples/blog/blog-persistence-jpa/ -Donald On 5/5/10 4:31 PM, Jason Reilly wrote: > Hi all, > > I am trying to get a project that uses OpenJPA deployed as a Service in > the Apache Karaf OSGi container. I am getting an exception when I do an > osgi:install of my project. The exception message is: > > javax.persistence.PersistenceException: No persistence providers for > "rsp" after trying the following discovered implementations: NONE > > > This is what my META-INF/persistence.xml looks like: > > <?xml version="1.0"?> > > <persistence xmlns="http://java.sun.com/xml/ns/persistence" > xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="1.0"> > > <persistence-unit name="rsp"> > > > <provider>org.apache.openjpa.persistence.PersistenceProviderImpl</provider> > > ....snip classes.... > > <properties> > > <property name="openjpa.ConnectionURL" > value="jdbc:postgresql://localhost:5432/rsp"/> > > <property name="openjpa.ConnectionDriverName" > value="org.postgresql.Driver"/> > > <property name="openjpa.ConnectionUserName" value=""/> > > <property name="openjpa.ConnectionPassword" value=""/> > > <property name="openjpa.Log" value="DefaultLevel=WARN, Tool=INFO"/> > > </properties> > > </persistence-unit> > > </persistence> > > > Here is a list of relevant installed bundles: > > [ 95] [Active ] [ ] [ 60] Commons Lang (2.4) > > [ 102] [Active ] [ ] [ 60] Commons Collections (3.2.1) > > [ 103] [Active ] [ ] [ 60] Commons Pool (1.5.3) > > [ 122] [Active ] [ ] [ 60] postgresql-8.4-701.jdbc4 (0) > > [ 145] [Active ] [ ] [ 60] Apache Geronimo JSR-317 JPA > 2.0 Spec API (1.1) > > [ 146] [Active ] [ ] [ 60] Apache Geronimo JSR-303 Bean > Validation Spec API (1.1) > > [ 148] [Active ] [ ] [ 60] > mvn:org.apache.openjpa/openjpa-all/2.1.0-SNAPSHOT > > > The Karaf version is 1.5.0-SNAPSHOT. > Any insight on how to remedy this error would be great &, of course, let > me know if I need to provide more info. > > Thanks, > Jason >
