简体   繁体   中英

Wsimport on OSX -> NoClassDefFoundError: com/sun/xml/internal/ws/util/localization/LocalizableMessageFactory

On OSX with Java 8, if I call the command

wsimport

I get the following error

Exception in thread "main" java.lang.NoClassDefFoundError: com/sun/xml/internal/ws/util/localization/LocalizableMessageFactory
    at com.sun.tools.internal.ws.resources.WscompileMessages.<clinit>(WscompileMessages.java:40)
    at com.sun.tools.internal.ws.wscompile.WsimportOptions.validate(WsimportOptions.java:263)
    at com.sun.tools.internal.ws.wscompile.WsimportTool.run(WsimportTool.java:159)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:483)
    at com.sun.tools.internal.ws.Invoker.invoke(Invoker.java:120)
    at com.sun.tools.internal.ws.WsImport.main(WsImport.java:42)
Caused by: java.lang.ClassNotFoundException: com.sun.xml.internal.ws.util.localization.LocalizableMessageFactory
    at java.net.URLClassLoader$1.run(URLClassLoader.java:372)
    at java.net.URLClassLoader$1.run(URLClassLoader.java:361)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:360)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
    ... 9 more

If I try the command to check the version:

wsimport -version

it throws no error and shows me the version:

JAX-WS RI 2.2.4-b01

Is this any known error or is there any fix/workaround?

I had a similar problem with Java 8. when i ran wsimport I first got an error, that a mainclass was missing. I then tried cleaning up my path / classpath as @Angelo Fuchs mentioned. wsimport then came up with the same NoClassDefFoundError @Jan had.

In the end I reinstalled a fully new SDK including the jdk and the jre, making sure both were installed in different locations because I was affraid the installers would overwrite files in the installation directory of the jdk, because the jdk installer already created a directory named "jre"

After the reinstall all was fine

我切换回Java版本6,然后工作正常。

I had a similar problem.

For me it was that the java command was started with Java 8, but the classpath contained Java 7 jars.

After I made sure to fix the JAVA Environment variables etc. to all point to the same Java, it worked fine.

关闭eclipse并删除放置在项目目录中的“目标”文件夹,然后打开在maven clean中运行的eclipse

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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