Hello,
I'm fairly new to CXF and I'm trying to setup a simple REST service running
on tomcat. I've gone through the documentation and built a simple service
that mirrors the howto (http://cwiki.apache.org/CXF20DOC/jax-rs-jsr-311.html).
I'm able to deploy my web app fine under tomcat (6.0.14) with spring. So
everything seems fine. I try to hit the service through the browser and all
I get is a NoClassDefFoundError, without even an indication as to what class
it can't find. I'm using maven 2.0 to build my project, so I'm assuming
it's handling all the right dependencies for me.
I checked the source code very briefly, but couldn't find anything that
stood out. Has anyone run into this issue before? I've included everything
I could below. Any help would be greatly appreciated:
Exception:
java.lang.NoClassDefFoundError
org.apache.cxf.jaxrs.interceptor.JAXRSInInterceptor.handleMessage(JAXRSInInterceptor.java:86)
org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:221)
org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:78)
org.apache.cxf.transport.servlet.ServletDestination.invoke(ServletDestination.java:92)
org.apache.cxf.transport.servlet.ServletController.invokeDestination(ServletController.java:214)
org.apache.cxf.transport.servlet.ServletController.invoke(ServletController.java:113)
org.apache.cxf.transport.servlet.AbstractCXFServlet.invoke(AbstractCXFServlet.java:170)
org.apache.cxf.transport.servlet.AbstractCXFServlet.doGet(AbstractCXFServlet.java:152)
javax.servlet.http.HttpServlet.service(HttpServlet.java:690)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
Service Class:
import java.util.logging.Logger;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
@Path("/fooService/")
public class FooService {
private static final Logger LOG =
Logger.getLogger(FooService.class.getName());
/**
* Class Constructor
*/
public FooService() {
LOG.info("HERE");
}
@GET
@Path("/foo/{id}/")
public String getFoo(@PathParam("id") String fooName) {
LOG.info("HERE1");
return fooName;
}
}
Spring configuration:
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:jaxrs="http://cxf.apache.org/jaxrs"
xsi:schemaLocation=
"http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
http://cxf.apache.org/jaxrs http://cxf.apache.org/schemas/jaxrs.xsd">
<import resource="classpath:META-INF/cxf/cxf.xml" />
<import resource="classpath:META-INF/cxf/cxf-extension-jaxrs-binding.xml"
/>
<import resource="classpath:META-INF/cxf/cxf-servlet.xml" />
<jaxrs:server id="fooService" address="/">
<jaxrs:serviceBeans>
<bean class="com.foo.bar.FooService"/>
</jaxrs:serviceBeans>
</jaxrs:server>
</beans>
URL I'm Hitting:
http://localhost:8080/myApp/fooService/foo/1/
Thank you very much,
John