Category

Jersey 1.0 and jetty:run

If you are using maven and jetty you are probably simply invoking jetty:run with your Jersey web service.

Jersey is the JAX-RS (JSR 311) Reference Implementation for building RESTful Web services

The problem is you get this exception:

But you are sure you do have your resources. Here is an example:

In pre 1.0 releases you used the annotations @ProduceMime(“text/plain”), @UriTemplate(“/rocky/”) and @HttpMethod(“GET”). These are the replacements for 1.0.

You think that Rest is so hip and happenin’ that other people have had the same problem so you google the exception.

You then find this blog post. It was helpful but that was a preview release.

Here is a web.xml that will now work:

See the Glassfish Wiki for details.

Here are the javadocs for the JSR. Since I’m posting links, if you are new to JSON here are some docs.

If you created your maven app with the Jersey teams maven archetype then this wouldn’t have been a problem. You’d just have to delete stuff from the pom and insert the jetty stuff.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.