【问题标题】:"java.lang.NoClassDefFoundError: IllegalName" error when generating JAX-WS artifacts using wsgen使用 wsgen 生成 JAX-WS 工件时出现“java.lang.NoClassDefFoundError: IllegalName”错误
【发布时间】:2010-02-21 17:40:16
【问题描述】:

我对 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)

【问题讨论】:

    标签: java web-services wsgen


    【解决方案1】:

    错误告诉你它需要一个合法的类名。你给了它一个源路径。您需要看起来像完全限定类名的名称(例如 "x.y.z.Foo" )。

    查看docs,并尝试像这样运行它:

    wsgen -wsdl -classpath 。 service.OrderProcessService

    我认为 wsgen 适用于 .class 文件,而不是 .java。确保在运行之前编译了源文件。

    【讨论】:

    • 是的,我确实编译了文件,并且类文件与 .java 文件位于同一目录中。
    • 现在我确信我给了它正确的路径。因为如果我给出一个无效的路径,我会得到以下类未找到:“service/OrderProcessService”用法:WSGEN [options]
    • 哎呀!我错过了明显的。我正在使用 / 而不是 .在类文件路径中。
    【解决方案2】:

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

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

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-08-09
      • 2012-03-06
      • 2013-02-27
      • 2012-07-07
      • 1970-01-01
      相关资源
      最近更新 更多