Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

OpenJPA in OSGi not finding MySQL JDBC Connector Bundle

I am currently working on an OSGi project on Felix (v4.0.3). I need to use JPA so I have installed the Apache Aries JPA bundles. I also installed OpenJPA and I need it to connect to a MySQL Database, using the MySQL Connector Bundle. Unfortunately it does not work, OpenJPA says it cannot find the MySQL JDBC class and I cannot figure out what's broken, maybe I am doing something wrong. I'll explain below what I installed precisely along with the persistence.xml file and the actual exception I get.

Here's the list of the Apache Aries bundles I installed :

  1. org.apache.aries.jpa.api-0.3.jar
  2. org.apache.aries.jpa.container.context-0.3.jar
  3. org.apache.aries.jpa.container-0.3.jar
  4. org.apache.aries.util-0.4.jar

I then installed the dependencies of those Apache Aries JPA bundles. I downloaded them from Springsource :

  1. com.springsource.javax.transaction-1.1.0.jar
  2. com.springsource.org.apache.log4j-1.2.16.jar
  3. com.springsource.slf4j.api-1.6.1.jar
  4. com.springsource.slf4j.log4j-1.6.1.jar
  5. javax.persistence_2.0.4.v201112161009.jar (this one is from EclipseLink in case it matters)

I also installed OpenJPA and all its dependencies. I found bundles 2 to 5 (commons-*) in the lib folder of the apache-openjpa-2.2.0 downloaded folder. I downloaded Serp here because the jar found in the lib folder wasn't an OSGi bundle. Finally I found the last two bundles (#7 and #8) in Springsource :

  1. openjpa-2.2.0.jar
  2. commons-collections-3.2.1.jar
  3. commons-dbcp-1.4.jar
  4. commons-lang-2.4.jar
  5. commons-pool-1.5.4.jar
  6. org.apache.servicemix.bundles.serp-1.13.1_4.jar
  7. com.springsource.javax.servlet-2.5.0.jar
  8. com.springsource.org.objectweb.asm-3.2.0.jar

Once I finally had OpenJPA installed, I still needed the MySQL JDBC Driver bundle, which I also got from the Springsource repository along with its commons-logging dependency :

  1. com.springsource.com.mysql.jdbc-5.1.6.jar
  2. com.springsource.org.apache.commons.logging-1.1.1.jar

Now at this point the list of bundles installed is getting quite large. I said I installed OpenJPA but it's only because I could not figure out how to use any other provider with Aries. I initially wanted to use EclipseLink but apparently Apache Aries does not detect it as a provider and according to this blog you have to make yet another bundle containing your own activator for Aries to notice EclipseLink. I tried it but it didn't work so I fell back on using OpenJPA instead.

So now I have two questions :

  • How can I make OpenJPA notice my MySQL Bundle ?

OR alternatively :

  • How can I make Apache Aries notice EclipseLink ?

Here's the persistence.xml file I use :

<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_2_0.xsd"
version="2.0" xmlns="http://java.sun.com/xml/ns/persistence">
<persistence-unit name="userManager.model" transaction-type="RESOURCE_LOCAL">
    <provider>org.apache.openjpa.persistence.PersistenceProviderImpl</provider>
    <class>org.project.dao.entity.UserEntity</class>
    <properties>
        <property name="openjpa.ConnectionDriverName" value="com.mysql.jdbc.Driver" />
        <property name="openjpa.ConnectionURL" value="jdbc:mysql://localhost:3306/usermanager?autoReconnect=true" />
        <property name="openjpa.ConnectionUserName" value="root" />
        <property name="openjpa.ConnectionPassword" value="root" />            
    </properties>
</persistence-unit>
</persistence>

The error occurs when the following Constructor of my DAO class is executed :

    @PersistenceContext(unitName="userManager.model")
private EntityManager em;
private EntityManagerFactory emf;

public UserDAOBean() {
    em = emf.createEntityManager();
}

Here's the error I get with OpenJPA not finding MySQL. Of course it is worth mentioning that both the URL and the username/password do work :

<openjpa-2.2.0-r422266:1244990 nonfatal general error> org.apache.openjpa.persistence.PersistenceException: There were errors initializing your configuration: <openjpa-2.2.0-r422266:1244990 fatal user error> org.apache.openjpa.util.UserException: A connection could not be obtained for driver class "com.mysql.jdbc.Driver" and URL "jdbc:mysql://localhost:3306/usermanager?autoReconnect=true".  You may have specified an invalid URL.
at org.apache.openjpa.jdbc.schema.DataSourceFactory.newConnectException(DataSourceFactory.java:255)
at org.apache.openjpa.jdbc.schema.DataSourceFactory.newDataSource(DataSourceFactory.java:123)
at org.apache.openjpa.jdbc.conf.JDBCConfigurationImpl.createConnectionFactory(JDBCConfigurationImpl.java:844)
at org.apache.openjpa.jdbc.conf.JDBCConfigurationImpl.getConnectionFactory(JDBCConfigurationImpl.java:732)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.apache.openjpa.lib.conf.ConfigurationImpl.instantiateAll(ConfigurationImpl.java:295)
at org.apache.openjpa.conf.OpenJPAConfigurationImpl.instantiateAll(OpenJPAConfigurationImpl.java:1671)
at org.apache.openjpa.kernel.AbstractBrokerFactory.makeReadOnly(AbstractBrokerFactory.java:646)
at org.apache.openjpa.kernel.AbstractBrokerFactory.newBroker(AbstractBrokerFactory.java:203)
at org.apache.openjpa.kernel.DelegatingBrokerFactory.newBroker(DelegatingBrokerFactory.java:156)
at org.apache.openjpa.persistence.EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:227)
at org.apache.openjpa.persistence.EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:154)
at org.apache.openjpa.persistence.EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:60)
at org.apache.aries.jpa.container.impl.CountingEntityManagerFactory.createEntityManager(CountingEntityManagerFactory.java:64)
at javax.persistence.EntityManagerFactory$$Proxy.createEntityManager(Unknown Source)

I've cut the exception (it keeps going on and on) until this point :

Caused by: java.lang.ClassNotFoundException: com.mysql.jdbc.Driver not found by org.apache.openjpa [12]
at org.apache.felix.framework.BundleWiringImpl.findClassOrResourceByDelegation(BundleWiringImpl.java:1460)
at org.apache.felix.framework.BundleWiringImpl.access$400(BundleWiringImpl.java:72)
at org.apache.felix.framework.BundleWiringImpl$BundleClassLoader.loadClass(BundleWiringImpl.java:1843)
at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:169)
at org.apache.openjpa.jdbc.schema.DataSourceFactory.newDataSource(DataSourceFactory.java:85)
... 108 more

PS: I couldn't post the links to Aries, OpenJPA or EclipseLink because of the spam restriction, sorry :/

like image 885
Hyzual Avatar asked Aug 08 '12 09:08

Hyzual


2 Answers

Thanks to Holly Cummins and after another bunch of hours of research, I've been able to find a solution to my problem. I'll detail it below, this is going to be a very long answer.

If you want to use EclipseLink with Apache Aries (which I find orders of magnitude simpler to install than OpenJPA for OSGi because it's contained in only 5 bundles), you will have to checkout the EclipseLink - Aries adapter directly from apache because it has not been released yet.

Go to an appropriate folder and execute the following command to get it :

svn checkout https://svn.apache.org/repos/asf/aries/trunk/jpa/jpa-container-eclipselink-adapter/

You should get a folder named jpa-container-eclipselink-adapter. Now, assuming that you are using Linux and have Maven installed, run the following commands :

cd jpa-container-eclipselink-adapter
mvn clean install

Once Maven has successfully compiled the source of the adapter, you will find it in your Maven repository using the path

<maven-repo>/org/apache/aries/jpa/org.apache.aries.jpa.eclipselink.adapter/0.3.1-SNAPSHOT/org.apache.aries.jpa.eclipselink.adapter-0.3.1-SNAPSHOT.jar

You'll have to deploy this bundle with the others (copying it in the bundle folder for Felix).

So that was for the EclipseLink part, now in order to make your persistence actually work you'll have to use Blueprint with Aries. Here is the list of all the bundles you'll need to get from the [http://aries.apache.org/downloads/currentrelease.html](Apache Aries download page)

  1. org.apache.aries.blueprint
  2. org.apache.aries.proxy
  3. org.apache.aries.jndi.api
  4. org.apache.aries.jndi
  5. org.apache.aries.blueprint
  6. org.apache.aries.jpa.api
  7. org.apache.aries.jpa.container.context
  8. org.apache.aries.jpa.container
  9. org.apache.aries.transaction.blueprint
  10. org.apache.aries.transaction.manager (This one is listed twice on their site, it's just a duplicate)
  11. org.apache.aries.util

Once you're done downloading Aries, you still need dependencies (get them from SpringSource). These are the bundles for SLF4J, Log4J, SLF4J Log4J Binding and javax.transaction 1.1 API.

  1. http://ebr.springsource.com/repository/app/bundle/version/detail?name=com.springsource.slf4j.api&version=1.6.1
  2. http://ebr.springsource.com/repository/app/bundle/version/detail?name=com.springsource.slf4j.log4j&version=1.6.1
  3. http://ebr.springsource.com/repository/app/bundle/version/detail?name=com.springsource.javax.transaction&version=1.1.0
  4. http://ebr.springsource.com/repository/app/bundle/version/detail?name=com.springsource.org.apache.log4j&version=1.2.16

You'll also need the bundles from EclipseLink (you need the OSGi bundle version)

http://www.eclipse.org/eclipselink/downloads/

Open the zip and get the following files :

  1. org.eclipse.persistence.antlr
  2. org.eclipse.persistence.asm
  3. org.eclipse.persistence.core
  4. org.eclipse.persistence.jpa
  5. javax.persistence

Finally, assuming that you want to use a MySQL database, you'll need the bundles for the MySQL JDBC Driver (downloaded from Springsource)

  1. http://ebr.springsource.com/repository/app/bundle/version/detail?name=com.springsource.com.mysql.jdbc&version=5.1.6
  2. http://ebr.springsource.com/repository/app/bundle/version/detail?name=com.springsource.org.apache.commons.logging&version=1.1.1

Once you have all those bundles installed, you need to use a non-jta-datasource that you will get through JNDI. Here's a persistence.xml file that you can change for your needs :

<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_2_0.xsd"
    version="2.0" xmlns="http://java.sun.com/xml/ns/persistence">
    <persistence-unit name="userManager" transaction-type="RESOURCE_LOCAL">
        <provider>org.eclipse.persistence.jpa.PersistenceProvider</provider>
        <non-jta-data-source>osgi:service/javax.sql.DataSource/(osgi.jndi.service.name=jdbc/userManagerDS)</non-jta-data-source>
        <class>com.example.dao.entity.UserEntity</class>
        <exclude-unlisted-classes>true</exclude-unlisted-classes>
        <properties>  
            <!-- EclipseLink should create the database schema automatically -->
            <!-- <property name="eclipselink.ddl-generation" value="create-tables" /> 
            <property name="eclipselink.ddl-generation.output-mode" value="database" /> -->
        </properties>
    </persistence-unit>
</persistence>

See the javax.sql.Datasource in the non-jta-data-source tag ? That's what we'll define using Blueprint xml. In order to do so, you'll first need to add the OSGI-INF/blueprint/ folders in your persistence bundle (the one containing your DAOs and Entities). This is the default folder where blueprint xml files are located, any xml file located here will be scanned. Once that's done, create the blueprint.xml file (the name can be changed) and paste (and modify) the following code :

        <bean id="dataSource" class="com.mysql.jdbc.jdbc2.optional.MysqlDataSource">
        <property name="url" value="jdbc:mysql://localhost:3306/usermanager?autoReconnect=true" />
        <property name="user" value="root" />
        <property name="password" value="root" />
    </bean>

    <service id="MySQLDataSource" interface="javax.sql.DataSource" ref="dataSource">
        <service-properties>
            <entry key="osgi.jndi.service.name" value="jdbc/userManagerDS" />
        </service-properties>
    </service>

    <service id="userDAOService" interface="com.example.dao.remote.UserDAORemote">
        <bean class="com.example.dao.beans.UserDAOBean">
            <jpa:unit index="0" unitname="userManager" />
        </bean>
    </service>
</blueprint>

Here, we are doing two things. First, we tell Aries to create the userManagerDS datasource and configure it with the JDBC Driver, URL, user and password. This is the same datasource that we used in the persistence.xml file.

Then, we inject the EntityManagerFactory in our DAO. Our DAO is the com.example.dao.beans.UserDAOBean class, we need to add its name to the bean tag. This class will have to implement an interface and we'll need to add this interface to the service tag. Now the final jpa:unit tag tells Aries to inject the EntityManagerFactory related to the persistence unit called userManager (the same name we used in the persistence.xml) by using the first constructor of UserDAOBean. This is done by using the index="0" attribute. This also means you have to have some code like the following in your DAO :

private EntityManager em;
private EntityManagerFactory emf;

public UserDAOBean(EntityManagerFactory emf) {
    this.emf = emf;
    this.em = emf.createEntityManager();
}

It's also possible to inject the EMF using a setter. Here are further resources to help you use Blueprint :

  • http://aries.apache.org/modules/jpaproject.html
  • http://aries.apache.org/modules/blueprint.html
  • http://mail-archives.apache.org/mod_mbox/aries-user/201104.mbox/%[email protected]%3E

Optional : Be careful, if you are using Felix, adding the javax.transaction bundle will cause a "uses constraint violation" because the system bundle (bundle 0) also exports this API. You'll have to keep it from exporting it by changing the following line in the config.properties :

#org.osgi.framework.system.packages=

You'll have to put in here the list of all the packages that the previous bundle exported. Unfortunately, there's no way to "remove" a package, you have to redefine the entire list of packages to be exported. Here's mine, I hope it helps (yes it is very, very long) :

org.osgi.framework.system.packages=org.osgi.framework;version=1.6.0, org.osgi.framework.launch;version=1.0.0, org.osgi.framework.wiring;version=1.0.0, org.osgi.framework.startlevel;version=1.0.0, org.osgi.framework.hooks.bundle;version=1.0.0, org.osgi.framework.hooks.resolver;version=1.0.0, org.osgi.framework.hooks.service;version=1.1.0, org.osgi.framework.hooks.weaving;version=1.0.0, org.osgi.service.packageadmin;version=1.2.0, org.osgi.service.startlevel;version=1.1.0, org.osgi.service.url;version=1.0.0, org.osgi.util.tracker;version=1.5.0, javax.accessibility;version=0.0.0.1_006_JavaSE, javax.activation;version=0.0.0.1_006_JavaSE, javax.activity;version=0.0.0.1_006_JavaSE, javax.annotation.processing;version=0.0.0.1_006_JavaSE, javax.annotation;version=0.0.0.1_006_JavaSE, javax.crypto.interfaces;version=0.0.0.1_006_JavaSE, javax.crypto.spec;version=0.0.0.1_006_JavaSE, javax.crypto;version=0.0.0.1_006_JavaSE, javax.imageio.event;version=0.0.0.1_006_JavaSE, javax.imageio.metadata;version=0.0.0.1_006_JavaSE, javax.imageio.plugins.bmp;version=0.0.0.1_006_JavaSE, javax.imageio.plugins.jpeg;version=0.0.0.1_006_JavaSE, javax.imageio.spi;version=0.0.0.1_006_JavaSE, javax.imageio.stream;version=0.0.0.1_006_JavaSE, javax.imageio;version=0.0.0.1_006_JavaSE, javax.jws.soap;version=0.0.0.1_006_JavaSE, javax.jws;version=0.0.0.1_006_JavaSE, javax.lang.model.element;version=0.0.0.1_006_JavaSE, javax.lang.model.type;version=0.0.0.1_006_JavaSE, javax.lang.model.util;version=0.0.0.1_006_JavaSE, javax.lang.model;version=0.0.0.1_006_JavaSE, javax.management.loading;version=0.0.0.1_006_JavaSE, javax.management.modelmbean;version=0.0.0.1_006_JavaSE, javax.management.monitor;version=0.0.0.1_006_JavaSE, javax.management.openmbean;version=0.0.0.1_006_JavaSE, javax.management.relation;version=0.0.0.1_006_JavaSE, javax.management.remote.rmi;version=0.0.0.1_006_JavaSE, javax.management.remote;version=0.0.0.1_006_JavaSE, javax.management.timer;version=0.0.0.1_006_JavaSE, javax.management;version=0.0.0.1_006_JavaSE, javax.naming.directory;version=0.0.0.1_006_JavaSE, javax.naming.event;version=0.0.0.1_006_JavaSE, javax.naming.ldap;version=0.0.0.1_006_JavaSE, javax.naming.spi;version=0.0.0.1_006_JavaSE, javax.naming;version=0.0.0.1_006_JavaSE, javax.net.ssl;version=0.0.0.1_006_JavaSE, javax.net;version=0.0.0.1_006_JavaSE, javax.print.attribute.standard;version=0.0.0.1_006_JavaSE, javax.print.attribute;version=0.0.0.1_006_JavaSE, javax.print.event;version=0.0.0.1_006_JavaSE, javax.print;version=0.0.0.1_006_JavaSE, javax.rmi.CORBA;version=0.0.0.1_006_JavaSE, javax.rmi.ssl;version=0.0.0.1_006_JavaSE, javax.rmi;version=0.0.0.1_006_JavaSE, javax.script;version=0.0.0.1_006_JavaSE, javax.security.auth.callback;version=0.0.0.1_006_JavaSE, javax.security.auth.kerberos;version=0.0.0.1_006_JavaSE, javax.security.auth.login;version=0.0.0.1_006_JavaSE, javax.security.auth.spi;version=0.0.0.1_006_JavaSE, javax.security.auth.x500;version=0.0.0.1_006_JavaSE, javax.security.auth;version=0.0.0.1_006_JavaSE, javax.security.cert;version=0.0.0.1_006_JavaSE, javax.security.sasl;version=0.0.0.1_006_JavaSE, javax.sound.midi.spi;version=0.0.0.1_006_JavaSE, javax.sound.midi;version=0.0.0.1_006_JavaSE, javax.sound.sampled.spi;version=0.0.0.1_006_JavaSE, javax.sound.sampled;version=0.0.0.1_006_JavaSE, javax.sql.rowset.serial;version=0.0.0.1_006_JavaSE, javax.sql.rowset.spi;version=0.0.0.1_006_JavaSE, javax.sql.rowset;version=0.0.0.1_006_JavaSE, javax.sql;version=0.0.0.1_006_JavaSE, javax.swing.border;version=0.0.0.1_006_JavaSE, javax.swing.colorchooser;version=0.0.0.1_006_JavaSE, javax.swing.event;version=0.0.0.1_006_JavaSE, javax.swing.filechooser;version=0.0.0.1_006_JavaSE, javax.swing.plaf.basic;version=0.0.0.1_006_JavaSE, javax.swing.plaf.metal;version=0.0.0.1_006_JavaSE, javax.swing.plaf.multi;version=0.0.0.1_006_JavaSE, javax.swing.plaf.synth;version=0.0.0.1_006_JavaSE, javax.swing.plaf;version=0.0.0.1_006_JavaSE, javax.swing.table;version=0.0.0.1_006_JavaSE, javax.swing.text.html.parser;version=0.0.0.1_006_JavaSE, javax.swing.text.html;version=0.0.0.1_006_JavaSE, javax.swing.text.rtf;version=0.0.0.1_006_JavaSE, javax.swing.text;version=0.0.0.1_006_JavaSE, javax.swing.tree;version=0.0.0.1_006_JavaSE, javax.swing.undo;version=0.0.0.1_006_JavaSE, javax.swing;version=0.0.0.1_006_JavaSE, javax.tools;version=0.0.0.1_006_JavaSE, javax.transaction.xa;version=0.0.0.1_006_JavaSE, javax.transaction;version=0.0.0.1_006_JavaSE, javax.xml.bind.annotation.adapters;version=0.0.0.1_006_JavaSE, javax.xml.bind.annotation;version=0.0.0.1_006_JavaSE, javax.xml.bind.attachment;version=0.0.0.1_006_JavaSE, javax.xml.bind.helpers;version=0.0.0.1_006_JavaSE, javax.xml.bind.util;version=0.0.0.1_006_JavaSE, javax.xml.bind;version=0.0.0.1_006_JavaSE, javax.xml.crypto.dom;version=0.0.0.1_006_JavaSE, javax.xml.crypto.dsig.dom;version=0.0.0.1_006_JavaSE, javax.xml.crypto.dsig.keyinfo;version=0.0.0.1_006_JavaSE, javax.xml.crypto.dsig.spec;version=0.0.0.1_006_JavaSE, javax.xml.crypto.dsig;version=0.0.0.1_006_JavaSE, javax.xml.crypto;version=0.0.0.1_006_JavaSE, javax.xml.datatype;version=0.0.0.1_006_JavaSE, javax.xml.namespace;version=0.0.0.1_006_JavaSE, javax.xml.parsers;version=0.0.0.1_006_JavaSE, javax.xml.soap;version=0.0.0.1_006_JavaSE, javax.xml.stream.events;version=0.0.0.1_006_JavaSE, javax.xml.stream.util;version=0.0.0.1_006_JavaSE, javax.xml.stream;version=0.0.0.1_006_JavaSE, javax.xml.transform.dom;version=0.0.0.1_006_JavaSE, javax.xml.transform.sax;version=0.0.0.1_006_JavaSE, javax.xml.transform.stax;version=0.0.0.1_006_JavaSE, javax.xml.transform.stream;version=0.0.0.1_006_JavaSE, javax.xml.transform;version=0.0.0.1_006_JavaSE, javax.xml.validation;version=0.0.0.1_006_JavaSE, javax.xml.ws.handler.soap;version=0.0.0.1_006_JavaSE, javax.xml.ws.handler;version=0.0.0.1_006_JavaSE, javax.xml.ws.http;version=0.0.0.1_006_JavaSE, javax.xml.ws.soap;version=0.0.0.1_006_JavaSE, javax.xml.ws.spi;version=0.0.0.1_006_JavaSE, javax.xml.ws.wsaddressing;version=0.0.0.1_006_JavaSE, javax.xml.ws;version=0.0.0.1_006_JavaSE, javax.xml.xpath;version=0.0.0.1_006_JavaSE, javax.xml;version=0.0.0.1_006_JavaSE, org.ietf.jgss;version=0.0.0.1_006_JavaSE, org.omg.CORBA.DynAnyPackage;version=0.0.0.1_006_JavaSE, org.omg.CORBA.ORBPackage;version=0.0.0.1_006_JavaSE, org.omg.CORBA.TypeCodePackage;version=0.0.0.1_006_JavaSE, org.omg.CORBA.portable;version=0.0.0.1_006_JavaSE, org.omg.CORBA;version=0.0.0.1_006_JavaSE, org.omg.CORBA_2_3.portable;version=0.0.0.1_006_JavaSE, org.omg.CORBA_2_3;version=0.0.0.1_006_JavaSE, org.omg.CosNaming.NamingContextExtPackage;version=0.0.0.1_006_JavaSE, org.omg.CosNaming.NamingContextPackage;version=0.0.0.1_006_JavaSE, org.omg.CosNaming;version=0.0.0.1_006_JavaSE, org.omg.Dynamic;version=0.0.0.1_006_JavaSE, org.omg.DynamicAny.DynAnyFactoryPackage;version=0.0.0.1_006_JavaSE, org.omg.DynamicAny.DynAnyPackage;version=0.0.0.1_006_JavaSE, org.omg.DynamicAny;version=0.0.0.1_006_JavaSE, org.omg.IOP.CodecFactoryPackage;version=0.0.0.1_006_JavaSE, org.omg.IOP.CodecPackage;version=0.0.0.1_006_JavaSE, org.omg.IOP;version=0.0.0.1_006_JavaSE, org.omg.Messaging;version=0.0.0.1_006_JavaSE, org.omg.PortableInterceptor.ORBInitInfoPackage;version=0.0.0.1_006_JavaSE, org.omg.PortableInterceptor;version=0.0.0.1_006_JavaSE, org.omg.PortableServer.CurrentPackage;version=0.0.0.1_006_JavaSE, org.omg.PortableServer.POAManagerPackage;version=0.0.0.1_006_JavaSE, org.omg.PortableServer.POAPackage;version=0.0.0.1_006_JavaSE, org.omg.PortableServer.ServantLocatorPackage;version=0.0.0.1_006_JavaSE, org.omg.PortableServer.portable;version=0.0.0.1_006_JavaSE, org.omg.PortableServer;version=0.0.0.1_006_JavaSE, org.omg.SendingContext;version=0.0.0.1_006_JavaSE, org.omg.stub.java.rmi;version=0.0.0.1_006_JavaSE, org.w3c.dom.bootstrap;version=0.0.0.1_006_JavaSE, org.w3c.dom.events;version=0.0.0.1_006_JavaSE, org.w3c.dom.ls;version=0.0.0.1_006_JavaSE, org.w3c.dom;version=0.0.0.1_006_JavaSE, org.xml.sax.ext;version=0.0.0.1_006_JavaSE, org.xml.sax.helpers;version=0.0.0.1_006_JavaSE, org.xml.sax;version=0.0.0.1_006_JavaSE
like image 51
Hyzual Avatar answered Nov 25 '22 06:11

Hyzual


You may have better luck using a JNDI datasource rather than a direct jdbc connection. The Aries blog sample has a blog.datasource bundle which registers a datasource using Blueprint. The list of required bundles is longer than what you currently have, but you can just copy them all from the blog-assembly/target directory or pom.xml.

Alternatively, Aries have an org.apache.aries.jpa.eclipselink.adapter which does the same thing as the article you linked to. Aries use it for testing against EclipseLink, so it definitely should work. You could also look at the Aries tests to see how it's used and see if there's an EclipseLink test you can copy.

like image 20
Holly Cummins Avatar answered Nov 25 '22 06:11

Holly Cummins