java.lang.ClassNotFoundException: There's no JAXB 2.2 API in the classpath

I have previously developed several web services in Netbeans 6.9 IDE with much ease and flexibility.
But today when i launched Netbeans 6.9 today, it downloaded some updates by itself and all my existing web services were showing build errors.
The following are couple of exceptions that i noted down:
java.lang.ClassNotFoundException: There's no JAXB 2.2 API in the classpath
C:\Projects\proj_name\nbproject\jaxws-build.xml:22: taskdef class com.sun.tools.ws.ant.WsImport cannot be found
taskdef A class needed by class com.sun.tools.ws.ant.WsImport cannot
be found: org/apache/tools/ant/taskdefs/MatchingTask

While i kept on fixing one after another exception, here is the permanent fix that resolved all the issues:
I had several Jars inside this directory: C:\Program Files\Java\jdk1.6.0_24\jre\lib\endorsed
like webservices-api.jar, jaxb-api.jar, jaxws-api.jar, jaxb-xjc.jar, jaxws-tools-2.0.jar, jaxws-tools-2.1.4.jar.
There was an existing issue that was raised here:
http://java.net/jira/browse/JAX_WS-200

The permanent fix is to remove all the jars and just keep the following :
1. jaxws-api.jar
2. jaxb-api.jar

Reason:
The problem is that by putting all the jars in endorsed directory, when
jaxws-tools.jar is loaded Wsimport ant task looks from boot classloader for the
ant class and does not find it.

Comments

Popular posts from this blog

Load data from CSV into HIVE table using HUE browser

Setting property 'keystoreFile' did not find a matching property. No Certificate file specified or invalid file format

Gitlab change project visibility from private to internal