“java.lang.NoClassDefFoundError:IllegalName”使用 wsgen 生成 JAX-WS 工件时出错
我对 java 和 web 服务都比较陌生,所以它必须是显而易见的。最有可能是与类路径有关的东西。我的类文件位于相对于当前目录的目录“src/ibmwebservicetutorial/service/”下。知道我做错了什么吗?
wsgen -classpath . src/ibmwebservicetutorial/service/OrderProcessService -wsdl
Exception in thread "main" java.lang.NoClassDefFoundError: IllegalName: src/ibmwebservicetutorial/service/OrderProcessService
at java.lang.ClassLoader.preDefineClass(ClassLoader.java:477)
at java.lang.ClassLoader.defineClass(ClassLoader.java:615)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:124)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:260)
at java.net.URLClassLoader.access$000(URLClassLoader.java:56)
at java.net.URLClassLoader$1.run(URLClassLoader.java:195)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
at java.lang.ClassLoader.loadClass(ClassLoader.java:252)
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 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:105)
at com.sun.tools.internal.ws.WsGen.main(WsGen.java:41)
I am relatively new to both java and webservices so it has to be something obvious. Most probably something with classpath. My class files are under the directory 'src/ibmwebservicetutorial/service/' relative to current directory. Any idea what am I doing wrong?
wsgen -classpath . src/ibmwebservicetutorial/service/OrderProcessService -wsdl
Exception in thread "main" java.lang.NoClassDefFoundError: IllegalName: src/ibmwebservicetutorial/service/OrderProcessService
at java.lang.ClassLoader.preDefineClass(ClassLoader.java:477)
at java.lang.ClassLoader.defineClass(ClassLoader.java:615)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:124)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:260)
at java.net.URLClassLoader.access$000(URLClassLoader.java:56)
at java.net.URLClassLoader$1.run(URLClassLoader.java:195)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
at java.lang.ClassLoader.loadClass(ClassLoader.java:252)
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 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:105)
at com.sun.tools.internal.ws.WsGen.main(WsGen.java:41)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
该错误告诉您它需要一个合法的类名。您已经给了它一个源路径。您需要看起来像完全限定的类名的名称(例如,“xyzFoo”)。
查看文档,并尝试运行像这样:
我认为 wsgen 适用于 .class 文件,而不是 .java。确保在运行之前已经编译了源文件。
The error is telling you that it wants a legal class name. You've given it a source path. You need something that looks like a fully qualified class name (e.g., "x.y.z.Foo" ).
Check out the docs, and try running it like this:
I think wsgen works on .class files, not .java. Make sure you've compiled your source files before you run this.
转到终端中的目标/类并运行
Go to target/classes in terminal and run