Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

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

 
Harry Sunarsa
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 3913
9
Chrome Fedora Hibernate
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Harry Sunarsa
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 3913
9
Chrome Fedora Hibernate
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 3913
9
Chrome Fedora Hibernate
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 3913
9
Chrome Fedora Hibernate
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 3913
9
Chrome Fedora Hibernate
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Accessing REST services programmatically is explained under "Accessing Services Programmatically" here.
 
Harry Sunarsa
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic