javax.ws.rs package

Go To StackoverFlow.com

9

I am learning restful webservices and all the tutorials use javax.ws.rs.* package. But with JDK 6 anf JDK 7, my eclipse doesn't seem to recognize javax.ws package. What am I missing here?

2012-04-04 03:19
by user238021
Do you have jsr311-api.jar in your classpath - tenorsax 2012-04-04 03:25
Adding jsr311-api.jar fixed the issue. But the java 6 API mentions these classes. Not sure why I need to add it separately - user238021 2012-04-04 06:03


2

javax.ws.rs is not a JDK package; it is a server-side API that forms part of the Java EE specification. You would need to include a Java EE runtime on your classpath or source an implementation from a 3rd party if you're going the self-assembly route (e.g. using Tomcat.)

2012-04-04 08:07
by McDowell
Why is jax-ws (Soap based) shipped with JDK but not jax-rs (Rest based) - Abidi 2014-02-18 16:14
@Abidi I guess it is because it is much easier to write a REST client than a SOAP client but I can't give a definitive answer - McDowell 2014-02-18 16:34
Interesting, jax-rs does come with Metro stack and Metro is shipped with JDK6. This means not full stack of Metro is shipped with JDK. Confused - Abidi 2014-02-18 16:43
@Abidi I do not think Metro is a JAX-RS implementation. I believe Jersey is the JAX-RS reference implementation - McDowell 2014-02-18 16:53


2

You're may be missing Jersey installation, or something in your environment configuration. Try also installing Eclipse WPT. You can follow this tutorial, it covers prerequisites and basic installation procedures as well.

2012-04-04 03:44
by tenorsax
I added jersey installation to classpath. But Jersey does not have javax.ws.rs package. shouldn't javax.ws.rs package be in Java 6 SDK? But it doesn't seem to be - user238021 2012-04-04 06:00
Ads