java.lang.AbstractMethodError: javax.ws.rs.core.UriBuilder.uri

Hi, There:

This should be an easy one to figure out. But it took me a couple of days. :-((  When I set up my restful service using JAX-RS on Weblogic 10. I used Jersey reference implementation and defined the web.xml as:

<servlet>

<display-name>My Jersey Application</display-name>
<servlet-name>MyJerseyApp</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>MyRestApplication</param-value>
</init-param>
<init-param>
<param-name>com.sun.jersey.config.property.packages</param-name>
<param-value>test.package</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>MyJerseyApp</servlet-name>
<url-pattern>/resources/*</url-pattern>
</servlet-mapping>

And my POM has

<dependency>
<groupId>org.glassfish.jersey.containers</groupId>
<!– if your container implements Servlet API older than 3.0, use “jersey-container-servlet-core” –>
<artifactId>jersey-container-servlet</artifactId>
<version>2.3</version>
</dependency>

BUT when I access the resources HelloWorld.java as restful impl class, I got this java.lang.AbstractMethodError: javax.ws.rs.core.UriBuilder.uri. It turned out I just need to include the dependency class for UriBuilderImpl. The easiest one is from CXF.

<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-bundle-jaxrs</artifactId>
<version>2.7.7</version>
</dependency>

Then the problem was gone!   I should have known that the java.lang.AbstractMethodError tells me it needed some actual Impl. class for the UriBuilder Abstract class. Duh!

Hope it helps anyone out there.

-TY