wsgen引发NoClassDefFoundError异常 [英] wsgen raising NoClassDefFoundError exceptions
本文介绍了wsgen引发NoClassDefFoundError异常的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在学习《 Java Web服务启动和运行》一书中的Java Web服务. 如前所述,我编译了类("Teams" Web服务所在的位置):
I'm learning Java web services form the "Java Web Services Up and Running" book. As stated, I compiled the classes (where stands the "Teams" web service) :
javac ch01/team/*.java
然后,要使用此命令生成工件(在"ch01/team目录"中完成):
Then, when it comes to generating artifacts with this command (done in the "ch01/team directory) :
wsgen -cp . ch01.team.Teams
我收到以下错误:
Exception in thread "main" java.lang.NoClassDefFoundError: Teams (wrong name: ch01/team/Teams)
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClassCond(ClassLoader.java:631)
at java.lang.ClassLoader.defineClass(ClassLoader.java:615)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:141)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:283)
at java.net.URLClassLoader.access$000(URLClassLoader.java:58)
at java.net.URLClassLoader$1.run(URLClassLoader.java:197)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
at com.sun.tools.internal.ws.wscompile.WsgenOptions.getClass(WsgenOptions.java:276)
at com.sun.tools.internal.ws.wscompile.WsgenOptions.validateEndpointClass(WsgenOptions.java:212)
at com.sun.tools.internal.ws.wscompile.WsgenOptions.validate(WsgenOptions.java:203)
at com.sun.tools.internal.ws.wscompile.WsgenTool.run(WsgenTool.java:111)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at com.sun.tools.internal.ws.Invoker.invoke(Invoker.java:111)
at com.sun.tools.internal.ws.WsGen.main(WsGen.java:41)
感谢您的帮助.
推荐答案
尝试在应用程序的根目录(而不是ch01/team目录)中执行wsgen
命令.我认为它应该可以工作,因为您在命令行中传递了软件包信息.
Try to execute the wsgen
command in the root directory of your application, not in the ch01/team directory. I think it should work, as you pass the package info in the command line.
这篇关于wsgen引发NoClassDefFoundError异常的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文