0

I'm trying to walk through the JPA-RS tutorials like:
http://java.dzone.com/articles/introducing-eclipselink-jpa-rs or
http://www.eclipse.org/eclipselink/documentation/2.5/solutions/restful_jpa.htm

But after trying to deploy (using the maven and glassfish plugin) the application on my glassfish I get the following error stacktrace:

WebModule[/rest]Servlet /rest threw load() exception java.lang.ClassNotFoundException: 
org.eclipse.persistence.jpa.rs.resources.MetadataResource at 
org.glassfish.web.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1783) at
org.glassfish.web.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1633
) at org.eclipse.persistence.jpa.rs.service.JPARSApplication.(JPARSApplication.java:62) at 
sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at 
sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) at 
...

I do not find the class in my imported dependencies:

<dependency>
    <groupId>javax</groupId>
    <artifactId>javaee-api</artifactId>
    <version>7.0</version>
    <scope>provided</scope>
</dependency>
<dependency>
    <groupId>org.eclipse.persistence</groupId>
    <artifactId>eclipselink</artifactId>
    <version>2.5.0</version>
    <scope>provided</scope>
</dependency>
<dependency>
    <groupId>javax.ws.rs</groupId>
    <artifactId>javax.ws.rs-api</artifactId>
    <version>2.0.1</version>
    <scope>provided</scope>
</dependency>
<dependency>
    <groupId>org.eclipse.persistence</groupId>
    <artifactId>org.eclipse.persistence.jpars</artifactId>
    <version>2.6.0</version>
</dependency>

By searching for that error, I getting no one who is sharing the same problem with me. Are you able to help me by getting an solution for that problem? Tell me if you need more conext/background information about the project.

Kind regards.

Dennis Kriechel
  • 3,719
  • 14
  • 40
  • 62
jakblu
  • 3
  • 5

1 Answers1

0

Use your eclipselink dependencies of the same version: either both eclipselink and org.eclipse.persistence.jpars should be 2.6.0 or both should be 2.5.0.

When using 2.6.0 org.eclipse.persistence.jpa.rs.resources.MetadataResource is in the eclipselink.jar

FlasH from Ru
  • 1,165
  • 2
  • 13
  • 19
  • Thank u for your help! - This and updating the org.eclipse.persistence.* modules of my glassfish4 solved the problem. – jakblu May 07 '15 at 15:23