mavenwsdlcxfwsdl2javajibx

NoClassDefFoundError when using Apache CXF's wsdl2java -databinding jibx


I am trying to generate Java code from wsdl using Apache CXF's wsdl2java tool. I downloaded the binary distribution from here on windows and installed it using mvn command on CXF directory from command line.

It works fine with default binding JAXB. It also works when I use argument -db xmlbeans. However, when I use -db jibx, I get the following exception:

C:\Users\spagariya\apache-cxf-2.7.11>wsdl2java -db jibx mywsdl.wsdl

Exception in thread "main" java.lang.NoClassDefFoundError: org/jibx/schema/validation/ProblemHandler
        at java.lang.Class.getDeclaredConstructors0(Native Method)
        at java.lang.Class.privateGetDeclaredConstructors(Class.java:2493)
        at java.lang.Class.getConstructor0(Class.java:2803)
        at java.lang.Class.newInstance(Class.java:345)
        at org.apache.cxf.tools.wsdlto.core.PluginLoader.loadDataBindingProfile(PluginLoader.java:409)
        at org.apache.cxf.tools.wsdlto.core.PluginLoader.getDataBindingProfile(PluginLoader.java:422)
        at org.apache.cxf.tools.wsdlto.WSDLToJava.loadDataBinding(WSDLToJava.java:74)
        at org.apache.cxf.tools.wsdlto.WSDLToJava.run(WSDLToJava.java:104)
        at org.apache.cxf.tools.wsdlto.WSDLToJava.run(WSDLToJava.java:86)
        at org.apache.cxf.tools.wsdlto.WSDLToJava.main(WSDLToJava.java:184)
Caused by: java.lang.ClassNotFoundException: org.jibx.schema.validation.ProblemHandler
        at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
        at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:425)
        at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
        ... 10 more

Any ideas?


Solution

  • Make sure you have jibx-schema in your classpath. Check that you have downloaded this jar.

    <dependency>
        <groupId>org.jibx</groupId>
        <artifactId>jibx-schema</artifactId>
        <version>1.2.5</version>
    </dependency>
    <dependency>
        <groupId>org.jibx</groupId>
        <artifactId>jibx-bind</artifactId>
        <version>1.2.5</version>
    </dependency>