I am in the process of learning CXF with the help of this Apache CXF Web Service Development book but, alas, one of the book\'s sample projects won\'t even compile!
Endorsing the 2.2 version of the jaxws-api jar should work. You could also pass the "-fe jaxws21" flag to the CXF wsdl2java command to make it generate 2.1 compatible code instead.
From your description this sounds similar to the problem described in this post.
To get around this issue, You can simply copy jaxb-api.jar
, jaxws-api.jar
to JDK's JRE's
/lib/endorsed
Note that "endorsing" means placing the relevant JAR files (jaxb-api.jar, jaxws-api.jar in this case) in %JAVA_HOME%\jre\lib\endorsed
(note the jre
in the path). Do not create the endorsed directory directly under the JDK's lib directory.
or... if you prefer not to touch your JDK install, use these env vars is using wsimport and wsgen (where JAXWS_HOME points to JAX-WS 2.1 installation):
WSIMPORT_OPTS=-Djava.endorsed.dirs=%JAXWS_HOME%/lib
WSGEN_OPTS=-Djava.endorsed.dirs=%JAXWS_HOME%/lib
or... If you use ant tasks, you can pass -Djava.endorsed.dirs=%JAXWS_HOME%/lib
as jvmarg while calling wsimport and wsgen ant tasks (for this to work, you need to set fork="true" attribute of wsimport and wsgen ant tasks).
Credit goes to Rama Pulavarthi.
Adding webservices-api-2.2.jar alone in %JAVA_HOME%\jre\lib\endorsed has resolved issue for me.