How to add JSR-311 dependency for Jersey Jax-RS maven project -
the next questions discusses theory of dependencies between bailiwick of jersey , jax-rs specification:
jax-rs in relation bailiwick of jersey , jsrsi assuming add together dependency:
<!-- javax.ws.rs.core e.g. request --> <dependency> <groupid>javax.ws.rs</groupid> <artifactid>jsr311-api</artifactid> <version>1.0</version> </dependency>
to api defining maven project , utilize jersey/grizzly implementation.
<jersey.version>1.15</jersey.version> <grizzly.version>2.2.20</grizzly.version>
contrary assumption got next error message:
15.02.2013 08:41:25 org.glassfish.grizzly.http.server.httpserverfilter handleread warnung: unexpected error java.lang.incompatibleclasschangeerror: class javax.ws.rs.core.response$status not implement requested interface javax.ws.rs.core.response$statustype @ com.sun.jersey.spi.container.containerresponse.getstatus(containerresponse.java:571)
what right jax-rs api dependency should used bailiwick of jersey 1.15?
i'd in way implementation replaced other jax-rs compliant library.
the problem jsr 311 api dependency version 1.0, whereas bailiwick of jersey 1.15 jsr 311 version 1.1 implementation. compare http://jsr311.java.net/nonav/releases/1.0/javax/ws/rs/core/response.status.html , http://jsr311.java.net/nonav/releases/1.1/javax/ws/rs/core/response.status.html, , see latter implements responsetype
interface, former not.
you should able have jsr 311 version 1.1.1 api class files on build-time classpath declaring this:
<dependency> <groupid>javax.ws.rs</groupid> <artifactid>jsr311-api</artifactid> <version>1.1.1</version> <scope>provided</scope> </dependency>
in fact, jersey-core pom.xml
- above first dependency in http://repo1.maven.org/maven2/com/sun/jersey/jersey-core/1.15/jersey-core-1.15.pom.
in container glassfish, you'd done, since container responsible providing api classes @ runtime (which why scope in jersey's own maven pom provided
, not compile
). however, grizzly web container, you'll need ensure api classes available @ runtime (by using <dependency>
declaration above, changing <scope>
provided
compile
this).
maven jersey jax-rs
No comments:
Post a Comment