views:

434

answers:

1

Hi, 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)
A: 

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.

duffymo
Yup I did compile the files and the class files are in the same directory as .java files.
NewbieToJava
Now I am sure that I am giving it the right path. Because if I give an invalid path I get the following Class not found: "service/OrderProcessService"Usage: WSGEN [options] <SEI>
NewbieToJava
Ooooppss! I missed the obvious. I was using / intead of . in the class file path.
NewbieToJava