“java.lang.NoClassDefFoundError:IllegalName”使用 wsgen 生成 JAX-WS 工件时出错

发布于 2024-08-22 00:15:48 字数 1639 浏览 3 评论 0原文

我对 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

独留℉清风醉 2024-08-29 00:15:49

该错误告诉您它需要一个合法的类名。您已经给了它一个源路径。您需要看起来像完全限定的类名的名称(例如,“xyzFoo”)。

查看文档,并尝试运行像这样:

wsgen -wsdl -classpath 。
服务.OrderProcessService

我认为 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:

wsgen -wsdl -classpath .
service.OrderProcessService

I think wsgen works on .class files, not .java. Make sure you've compiled your source files before you run this.

梦断已成空 2024-08-29 00:15:49

转到终端中的目标/类并运行

wsgen -verbose -keep -cp . com.your.package.name.OrderProcessServiceImpl  

Go to target/classes in terminal and run

wsgen -verbose -keep -cp . com.your.package.name.OrderProcessServiceImpl  
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文