Topic
IC4NOTICE: developerWorks Community will be offline May 29-30, 2015 while we upgrade to the latest version of IBM Connections. For more information, read our upgrade FAQ.
No replies
jacomac71
jacomac71
1 Post
ACCEPTED ANSWER

Pinned topic Liberty: How to change default JPA provider?

‏2014-01-29T09:31:29Z |

Hi,

In order to program against the JPA 2.1 API, I would like to use eclipseLink, rather than the default OpenJPA JPA provider. How can this be achieved in the WAS 8.5 Liberty profile?

I tried with not using the jpa-2.0 feature and setting up a shared library which is referenced by my webapp, but with no success.

Here's my server.xml:

<server description="new server">

    <!-- Enable features -->
    <featureManager>
        <feature>jsp-2.2</feature>
        <feature>localConnector-1.0</feature>
    </featureManager>

    <httpEndpoint host="localhost" httpPort="9080" httpsPort="9443"
        id="defaultHttpEndpoint" />

    <applicationMonitor updateTrigger="mbean" />

    <webApplication id="System" location="System.war" name="System">
        <classloader commonLibraryRef="mysql" />
        <classloader commonLibraryRef="eclipseLink" />
    </webApplication>

    <library id="mysql" name="mysql-jdbc-driver">
        <fileset dir="C:\Users\jacomac\.m2\repository\mysql\mysql-connector-java\5.1.26" includes="*.jar"/>
    </library>

    <library id="eclipseLink" name="eclipse-jpa-impl">
        <fileset dir="C:\Users\jacomac\.m2\repository\org\eclipse\persistence\eclipselink\2.5.2-M1" includes="*.jar"/>
        <fileset dir="C:\Users\jacomac\.m2\repository\org\eclipse\persistence\javax.persistence\2.1.0" includes="*.jar"/>
        <fileset dir="C:\Users\jacomac\.m2\repository\org\eclipse\persistence\commonj.sdo\2.1.1" includes="*.jar"/>
    </library>
</server>

This is the error I get:

java.lang.NoClassDefFoundError: javax/persistence/Persistence