I am using Eclipse Luna (version 4.4.2) and Glassfish 4 to build a REST web application using JAX-RS.
The following code snippet, which is just a simple REST api entry that worked fine before, started a very strange error:
@POST public Response addToWatchlist(WatchlistEntry watchlistentry) { return Response.ok(watchlist_service.addToWatchlist(watchlistentry).toString()).build(); }
The error is below:
Warning: StandardWrapperValve[Jersey Web Application]: Servlet.service() for servlet Jersey Web Application threw exception java.lang.ClassNotFoundException: javax.xml.parsers.ParserConfigurationException not found by org.eclipse.persistence.moxy
All I could find out about this is the web page: https://java.net/jira/browse/JERSEY-2888
One comment says this has been fixed in EclipseLink 2.6.1 and Jersey 2.19.
I'm new to using MAVEN and eclipse - assuming the above is correct, how do I get a Maven project in Eclipse to upgrade a version in Jersey? Also how to update the version of EclipseLink? Version 2.6.0 seems to be available on their site: http://www.eclipse.org/eclipselink/#download
I assume that all this can be done through eclipse itself?
All help appreciated!
EDIT 1: It seems that eclipselink 2.6.1 was released on October 15, 2015, as you can see here: http://www.eclipse.org/eclipselink/releases/
However, as you can see here, it does not seem to have been included in eclipse for โhelp โ update softwareโ: http://download.eclipse.org/rt/eclipselink/updates/
This is very annoying.
I am building my REST site and no PUT or POST will work due to this error.
Does anyone know how to work 2.6.1? I am using the Maven jersey-quickstart-webapp project.
This mistake is a royal pain in the face.
EDIT 2: I have a hack working today. When I programmatically check which version of eclipselink is used at runtime, as shown below, it tells me that it is version 2.6.1, although the error remains:
Class<?> myClass = Class.forName("org.eclipse.persistence.Version"); Method myMethod = myClass.getMethod("getVersion"); String version = myMethod.invoke(null).toString(); System.out.println("version = " + version);
In a related question ( How to find which version of EclipseLink my Eclipse project uses? ) I found out how to find the actual jar files that the glass chip uses to eclipse. They are located in the glassfish / modules directory. Inside the org.eclipse.persistence.core.jar file there will be readme.html, which indicates the version of eclipselink that the vitreous fish uses. For me it was 2.6.
I manually updated the org.eclipse.persistence.core.jar file and the org.eclipse.persistence.moxy.jar file with the latest versions from maven. Although this is pretty hacky as I donโt know what else has been done by doing this, it is dealing with this problem. If I figure out the right way to do this, I will write the answer below, for everyone and everyone.