I've setup what I think to be a pretty plain Jersey configuration, as
much as it can be for not using maven and Glassfish, anyway. And I've
tested this with both Jersey 1.0.1 and the latest SVN, same exception.
1) web.xml:
<servlet>
<servlet-name>RestfulManagement</servlet-name>
<servlet-class>com.sun.jersey.spi.container.servlet.ServletContainer</servlet-class>
<init-param>
<param-name>javax.ws.rs.Application</param-name>
<param-value>com.vocollecthealthcare.wc.rest.ManagementApplication</param-value>
</init-param>
</servlet>
<servlet-mapping>
<servlet-name>RestfulManagement</servlet-name>
<url-pattern>/VoiceConsole/r/*</url-pattern>
</servlet-mapping>
2) ManagementApplication:
public class ManagementApplication extends Application {
public Set<Class<?>> getClasses() {
return new HashSet<Class<?>>( Arrays.asList( DeviceResource.class ) );
}
}
3) DeviceResource:
@Path( "/device/{serialNumber}" )
@Consumes( "application/json" )
public class DeviceResource {
@GET
public String getDevice( @PathParam( "serialNumber" ) String
serialNumber ) {
return "{ serialNumber : '" + serialNumber + "' }";
}
}
4) This compiles and starts up fine, but on doing a GET I get the exception:
$ GET
http://localhost:8080/VoiceConsole/r/device/248421104
java.lang.AbstractMethodError:
javax.ws.rs.core.UriBuilder.replacePath(Ljava/lang/String;)Ljavax/ws/rs/core/UriBuilder;
at com.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:302)
at com.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:239)
at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:502)
at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1124)
...
Googling around found nothing useful, just one error from last year
where someone had some older Jersey/JSR-311 JARs in his classpath.
Mine are freshly minted.
The only thing I can think of is an older version of ASM that's in my
project. But AFAICT that was only needed if you're using the
configuration that scans for resources given a package specification.
Thanks much for any pointers.
Chris