简体   繁体   English

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

[英]“java.lang.NoClassDefFoundError: IllegalName” error when generating JAX-WS artifacts using wsgen

I am relatively new to both java and webservices so it has to be something obvious. 我对java和webservices都比较陌生,所以它必须很明显。 Most probably something with classpath. 最有可能带有类路径。 My class files are under the directory 'src/ibmwebservicetutorial/service/' relative to current directory. 我的班级文件位于相对于当前目录的目录src / ibmwebservicetutorial / service /下。 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)

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 (eg, "xyzFoo" ). 您需要看起来像完全合格的类名(例如“ xyzFoo”)。

Check out the docs , and try running it like this: 签出文档 ,然后尝试像这样运行它:

wsgen -wsdl -classpath . wsgen -wsdl -classpath。 service.OrderProcessService service.OrderProcessService

I think wsgen works on .class files, not .java. 我认为wsgen适用于.class文件,而不适用于.java。 Make sure you've compiled your source files before you run this. 在运行此文件之前,请确保已编译源文件。

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

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM