Forums Register Login

Problem with JERSEY and JAX-RS

+Pie Number of slices to send: Send
I am new to RESTful Services.

I am trying to deploy a simplest REST service using jersey, and JAX-RS, but i am getting this error,

HTTP ERROR: 404

NOT_FOUND

RequestURI=/hosting/demo/example

Powered by Jetty://


Where i think i have done everything right, below is the code i am using for it.

POM.XML (only pasting the part related to jersey)



WEB.XML



[b]My Class having @GET[/b]



The url i hit is: http://localhost/hosting/demo/example

Please help, its very urgent, thanks in advance.
+Pie Number of slices to send: Send
Try mapping the servlet to "/demo/*" instead of "/demo".
+Pie Number of slices to send: Send
I have also tried /demo/* but this gives me an exception and i am unable to figure out the reason for that as well,

the stack trae is

HTTP ERROR: 500

org.objectweb.asm.ClassReader.accept(Lorg/objectweb/asm/ClassVisitor;I)V

RequestURI=/hosting/demo/example
Caused by:

java.lang.NoSuchMethodError: org.objectweb.asm.ClassReader.accept(Lorg/objectweb/asm/ClassVisitor;I)V
at com.sun.jersey.server.impl.container.config.AnnotatedClassScanner.analyzeClassFile(AnnotatedClassScanner.java:263)
at com.sun.jersey.server.impl.container.config.AnnotatedClassScanner.indexDir(AnnotatedClassScanner.java:212)
at com.sun.jersey.server.impl.container.config.AnnotatedClassScanner.index(AnnotatedClassScanner.java:185)
at com.sun.jersey.server.impl.container.config.AnnotatedClassScanner.scan(AnnotatedClassScanner.java:129)
at com.sun.jersey.api.core.PackagesResourceConfig.init(PackagesResourceConfig.java:114)
at com.sun.jersey.api.core.PackagesResourceConfig.(PackagesResourceConfig.java:78)
at com.sun.jersey.api.core.PackagesResourceConfig.(PackagesResourceConfig.java:89)
at com.sun.jersey.spi.container.servlet.ServletContainer.createResourceConfig(ServletContainer.java:403)
at com.sun.jersey.spi.container.servlet.ServletContainer.init(ServletContainer.java:204)
at org.mortbay.jetty.servlet.ServletHolder.initServlet(ServletHolder.java:400)
at org.mortbay.jetty.servlet.ServletHolder.getServlet(ServletHolder.java:346)
at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:422)
at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:356)
at org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:226)
at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:627)
at org.mortbay.jetty.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:149)
at org.mortbay.jetty.handler.HandlerCollection.handle(HandlerCollection.java:123)
at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:141)
at org.mortbay.jetty.Server.handle(Server.java:269)
at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:430)
at org.mortbay.jetty.HttpConnection$RequestHandler.headerComplete(HttpConnection.java:687)
at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:492)
at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:199)
at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:339)
at org.mortbay.jetty.nio.HttpChannelEndPoint.run(HttpChannelEndPoint.java:270)
at org.mortbay.thread.BoundedThreadPool$PoolThread.run(BoundedThreadPool.java:475)

Powered by Jetty://
+Pie Number of slices to send: Send
Sounds like the version of Jersey you're using and the version of ASM don't go together. Are you using ASM 3.1? Or maybe Jetty uses ASM internally, and there's a version mismatch?
+Pie Number of slices to send: Send
I am working in an existing established project, and it is using ASM 1.5.3,

now how can i force jetty/maven to use ASM 3.1, as if i just put ASM 3.1 in repository, then hibernate starts giving exceptions,

so can you please guide me that how can i force in POM.xml(or whatever), to use ASM 3.1 ?
+Pie Number of slices to send: Send
+Pie Number of slices to send: Send
Thanks for the help, but my problem still persists, after digging in to the issue more, i have found out that

hibernate and JAX-RS reference implementations cannot work together, as hibernate requires ASM 2.2.3 and JAX-RS requires 3.1, this is present on the URL: http://opensource.atlassian.com/projects/hibernate/browse/EJB-358

It seems that this problem is not fixed. Do you know any workaround for this ?
+Pie Number of slices to send: Send
So you've tried using the cglib-nodep library and it doesn't work?

The bug report you linked to mentions two more ways around this, in the first and the last post by Jürgen Zimmermann. Have you tried both, and found that neither works?
+Pie Number of slices to send: Send
Yeah i have tried these options,

1. i used cglib 2.2, but no help
2. i also used cglib-nodep, but no help
3. I also put javassist in dependencies but my project is using hibernate.cfg.xml file, and javassist can only be configured in hibernate.properties file, not in XML.

So no solutions seems to work for me
When all four tires fall off your canoe, how many tiny ads does it take to build a doghouse?
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com


reply
reply
This thread has been viewed 8370 times.
Similar Threads
Strange problem - works on maven glassfish but not on Tomcat
Funny exception with StringBuffer with jsf
Maven web project dependencies
JSF 2 - Problem with ManagedBean
How to change jetty binding port number in maven.
More...

All times above are in ranch (not your local) time.
The current ranch time is
Apr 16, 2024 05:19:28.