我正在尝试使用Apache CXF的wsdl2java工具从wsdl生成Java代码。我在Windows上从here下载了二进制发行版,并在命令行的CXF目录中使用mvn
命令安装它。
使用默认绑定JAXB可以正常工作。当我使用参数-db xmlbeans
时,它也有效。但是,当我使用-db jibx
时,我得到以下异常:
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
有什么想法吗?
答案 0 :(得分:0)
确保您的类路径中有jibx-schema。检查您是否已下载此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>