File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Web Services and the fly likes Exception in thread Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Web Services
Bookmark "Exception in thread "main" java.lang.NoClassDefFoundError: com/sun/jersey/api/cl ient/config/ClientC" Watch "Exception in thread "main" java.lang.NoClassDefFoundError: com/sun/jersey/api/cl ient/config/ClientC" New topic
Author

Exception in thread "main" java.lang.NoClassDefFoundError: com/sun/jersey/api/cl ient/config/ClientC

Harry Sunarsa
Greenhorn

Joined: Feb 15, 2012
Posts: 9
Hi guys,

I have problem in generating wsdl file using wsgen (JAX web service)

Exception in thread "main" java.lang.NoClassDefFoundError: com/sun/jersey/api/cl
ient/config/ClientConfig
at java.lang.Class.getDeclaredMethods0(Native Method)
at java.lang.Class.privateGetDeclaredMethods(Class.java:2442)
at java.lang.Class.privateGetPublicMethods(Class.java:2562)
at java.lang.Class.getMethods(Class.java:1427)
at com.sun.xml.ws.model.RuntimeModeler.processClass(RuntimeModeler.java:
358)
at com.sun.xml.ws.model.RuntimeModeler.buildRuntimeModel(RuntimeModeler.
java:246)
at com.sun.tools.ws.wscompile.WsgenTool.buildModel(WsgenTool.java:247)
at com.sun.tools.ws.wscompile.WsgenTool.run(WsgenTool.java:126)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
sorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:601)
at com.sun.tools.ws.Invoker.invoke(Invoker.java:135)
at com.sun.tools.ws.WsGen.main(WsGen.java:57)
Caused by: java.lang.ClassNotFoundException: com.sun.jersey.api.client.config.Cl
ientConfig
at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
at java.lang.ClassLoader.loadClass(ClassLoader.java:423)
at java.lang.ClassLoader.loadClass(ClassLoader.java:356)
... 14 more

currently am creating a webservice (JAX), that can invoke a restfull webservice (JERSEY)
here's my code:
C:\Users\HSunarsa\Documents\Kuliah\Thesis\ProgramSource\TwitterJAX>wsgen -classpath build/classes/ -wsdl -r WebContent/WEB-INF/wsdl -s src -d build/classes/ twitterJAX.Package.ClassServices


I have tried that code as a common client to invoke the restfull service and it works fine.
I put all the jersey jars file on the web-inf lib, but still when i try to use wsgen tool, always return error

Please help...
Thanks in advance
Vijitha Kumara
Bartender

Joined: Mar 24, 2008
Posts: 3829

here's my code:
C:\Users\HSunarsa\Documents\Kuliah\Thesis\ProgramSource\TwitterJAX>wsgen -classpath build/classes/ -wsdl -r WebContent/WEB-INF/wsdl -s src -d build/classes/ twitterJAX.Package.ClassServices

Add the path to the Jersey jars to the -classpath switch here.


SCJP 5 | SCWCD 5
[How to ask questions] [Twitter]
Harry Sunarsa
Greenhorn

Joined: Feb 15, 2012
Posts: 9
I did that to...
i just realized that when i execute wsgen (from JSXws 2.2.5 ), it generate jsr109 webservice porject on eclipse project tree,,, what does it mean?
because in the jersey it use jsr311-api

is there any particular configuration on the classpath or path? please give me more detail advice

thanks a bunch
Vijitha Kumara
Bartender

Joined: Mar 24, 2008
Posts: 3829

Have a look at this for generating artifacts for JAX-WS.
is there any particular configuration on the classpath or path?

Those are set for the required run time/compile time jars etc... and to find executable files easily respectively.
Harry Sunarsa
Greenhorn

Joined: Feb 15, 2012
Posts: 9
The problem is appears only when I import the jersey library into my code



if i put it in the normal class (just a common client for restfull service) it works fine.
is it because the jsr used in jsxws is jsr109? and how to switch it into jsr311 (the one that used in jersey)
Vijitha Kumara
Bartender

Joined: Mar 24, 2008
Posts: 3829

The problem is appears only when I import the jersey library into my code

That means you don't have those in the runtime?
if i put it in the normal class (just a common client for restfull service) it works fine

What do you mean?

And just to be clear, are you trying a RESTful service or a JAX-WS here?
Harry Sunarsa
Greenhorn

Joined: Feb 15, 2012
Posts: 9
so, the scenario is like this

client --> webservices (Jaxws) --> restful (jersey)

i want to invoke the restful services by a webservice, because I'm creating a system workflow..about web-of-things

regards,
Vijitha Kumara
Bartender

Joined: Mar 24, 2008
Posts: 3829

So you have a REST API/implementation already defined?
if i put it in the normal class (just a common client for restfull service) it works fine

What do you mean by this?
Harry Sunarsa
Greenhorn

Joined: Feb 15, 2012
Posts: 9
yes, ihad already the restful servics, using jersey

if i put it in the normal class (just a common client for restfull service) it works fine
means that, i just make a class to consume the service, just a client
Vijitha Kumara
Bartender

Joined: Mar 24, 2008
Posts: 3829

Accessing REST services programmatically is explained under "Accessing Services Programmatically" here.
Harry Sunarsa
Greenhorn

Joined: Feb 15, 2012
Posts: 9
ah come on, i ve told you many times,i will make a web service to invoke the restlet, in my previous reply i gave the architecture
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Exception in thread "main" java.lang.NoClassDefFoundError: com/sun/jersey/api/cl ient/config/ClientC