Search code examples
wsdljax-wsapache-axis

Axis2 error when generating wsdl


I'm trying to develop a new webservice using JAX-WS and JAXB annotations. When I deploy the .jar in axis2 and open the browser to retrieve the generated .wsdl I get the following error:

[ERROR] Error occurred generating WSDL file for Web service implementation class {foo.bar.myServiceImpl}
java.lang.NoClassDefFoundError: com/sun/xml/ws/api/server/Container
        at java.lang.Class.getDeclaredMethods0(Native Method)
        at java.lang.Class.privateGetDeclaredMethods(Unknown Source)
        at java.lang.Class.getMethod0(Unknown Source)
        at java.lang.Class.getMethod(Unknown Source)
        at org.apache.axis2.jaxws.description.builder.JAXWSRIWSDLGenerator.generateWsdl(JAXWSRIWSDLGenerator.java:179)
        at org.apache.axis2.jaxws.description.builder.JAXWSRIWSDLGenerator.initialize(JAXWSRIWSDLGenerator.java:390)
        at org.apache.axis2.jaxws.description.builder.JAXWSRIWSDLGenerator.getWSDL(JAXWSRIWSDLGenerator.java:383)
        at org.apache.axis2.description.AxisService.printWSDL(AxisService.java:1394)
        at org.apache.axis2.transport.http.HTTPWorker.service(HTTPWorker.java:154)
        at org.apache.axis2.transport.http.server.AxisHttpService.doService(AxisHttpService.java:281)
        at org.apache.axis2.transport.http.server.AxisHttpService.handleRequest(AxisHttpService.java:187)
        at org.apache.axis2.transport.http.server.HttpServiceProcessor.run(HttpServiceProcessor.java:82)
        at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
        at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.ClassNotFoundException: com.sun.xml.ws.api.server.Container
        at java.net.URLClassLoader$1.run(Unknown Source)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.net.URLClassLoader.findClass(Unknown Source)
        at java.lang.ClassLoader.loadClass(Unknown Source)
        at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
        at java.lang.ClassLoader.loadClass(Unknown Source)
        ... 15 more

Digging in the source, i notice that the com.sun.xml.ws.api.server.Container is part of the jaxws-rt implementation, which is not part of the Axis2 distribution (could not find it in the /lib/ folder). Why is this? Am I missing a point here?


Solution

  • Ok, got it. I'll post the answer to avoid anybody else banging his (or her) head to the wall.

    I had an old JAVA_HOME environment variable set on my system. This pointed to the installer JRE, but it needs to point to the installed JDK. That's all.