0

As the books says I am trying to run the command: wsgen -cp . ch01.team.Teams in the folder that contains the .class files but it throws the next error:

Exception in thread "main" java.lang.NoClassDefFoundError: bin/team/Teams (wrong name: team/Teams)
    at java.lang.ClassLoader.defineClass1(Native Method)
    at java.lang.ClassLoader.defineClass(ClassLoader.java:763)
    at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
    at java.net.URLClassLoader.defineClass(URLClassLoader.java:467)
    at java.net.URLClassLoader.access$100(URLClassLoader.java:73)
    at java.net.URLClassLoader$1.run(URLClassLoader.java:368)
    at java.net.URLClassLoader$1.run(URLClassLoader.java:362)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:361)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
    at com.sun.tools.internal.ws.wscompile.WsgenOptions.getClass(WsgenOptions.java:290)
    at com.sun.tools.internal.ws.wscompile.WsgenOptions.validateEndpointClass(WsgenOptions.java:229)
    at com.sun.tools.internal.ws.wscompile.WsgenOptions.validate(WsgenOptions.java:220)
    at com.sun.tools.internal.ws.wscompile.WsgenTool.run(WsgenTool.java:116)
    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:498)
    at com.sun.tools.internal.ws.Invoker.invoke(Invoker.java:159)
    at com.sun.tools.internal.ws.WsGen.main(WsGen.java:42)

BTW I already read the question in: wsgen raising NoClassDefFoundError exceptions and their answer but it doesn't work.

Can anyone help me please?

Note: I am using Eclipse Juno and I already ran the command at the src folder generating for my own the .class files and I already ran the command in the bin folder where Eclipse have the .class files of the compiled .java files.

1 Answers1

1

The problem was that you don't have to be inside the folder where the .class files are, for example if you have your .class files inside the /bin/team folder (this folder is into YourProject/ folder) then you have to run the command in the bin.

At first I was running wsgen -cp . Teams into the bin/team/ folder but then I ran wsgen -cp . team.Teams at the /bin level.

Hope it can help.