javajpaosgieclipselinkaries

Apache Aries JPA with Eclipselink: java.lang.LinkageError


I'm trying to use Apache Aries JPA in combination with Eclipselink (and an MSSQL database). My OSGi framework is Apache Felix, and I'm using DS (by using BndTools). After a long process of trial and error, I found the necessary bundles:

When I start this configuration, I get following Exception:

java.lang.NoClassDefFoundError: javax/sql/DataSource
at org.eclipse.persistence.jpa.PersistenceProvider.createContainerEntityManagerFactoryImpl(PersistenceProvider.java:328)
at org.eclipse.persistence.jpa.PersistenceProvider.createContainerEntityManagerFactory(PersistenceProvider.java:313)

Which bundle should contain the javax.sql.DataSource class? I expected this to be part of the JDK.

Does anyone have an idea by what this is caused or how I can fix this? Of how I can get Apache Aries JPA running with Eclipselink in a DS environment?

Thanks.


Solution

  • Have you looked at the examples/tutorials in the OSGi enRoute project? These walk you through the process of using JPA with OSGi.

    It's not clear from the information you have provided how you are trying to make use of Aries JPA, nor what versions of the libraries you are trying to use. The version of Java can also have an impact (Java 9 and 10 removed some entries from the JRE classpath). Depending on what you are doing you probably have too many bundles installed, and they are almost certainly in the wrong place.

    Just guessing (based on your statement that you have a bundle that supplies a DataSourceFactory service without saying what that bundle is) you have a wrapped JDBC driver? Has that wrapping been done correctly? If not then that could easily be the source of your NoClassDefFoundError.

    As for the bundles, was this the output of a resolve operation? It looks like maybe this has been assembled manually...