users@jersey.java.net

Re: [Jersey] Whence jersey-spring-1.0.1.jar?

From: Craig McClanahan <Craig.McClanahan_at_Sun.COM>
Date: Sun, 14 Dec 2008 16:09:48 -0800

Farrukh Najmi wrote:
>
> OK I found that the jersey-spring module has moved under contrib:
>
> http://download.java.net/maven/2/com/sun/jersey/contribs/jersey-spring/1.0.1/
>
>
> So my latest jersey deps are:
>
> <dependency>
> <groupId>com.sun.jersey</groupId>
> <artifactId>jersey-server</artifactId>
> <version>1.0.1</version>
> </dependency>
> <dependency>
> <groupId>com.sun.jersey.contribs</groupId>
> <artifactId>jersey-spring</artifactId>
> <version>1.0.1</version>
> </dependency>
>
> With that change I am now getting the following error:
>
> com.sun.jersey.api.container.ContainerException: The ResourceConfig
> instance does not contain any root resource classes.
> at
> com.sun.jersey.server.impl.application.WebApplicationImpl.processRootResources(WebApplicationImpl.java:613)
>
> at
> com.sun.jersey.server.impl.application.WebApplicationImpl.initiate(WebApplicationImpl.java:492)
>
> at
> com.sun.jersey.spi.spring.container.servlet.SpringServlet.initiate(SpringServlet.java:80)
>
> at
> com.sun.jersey.spi.container.servlet.ServletContainer.load(ServletContainer.java:540)
>
> at
> com.sun.jersey.spi.container.servlet.ServletContainer.init(ServletContainer.java:207)
>
> at
> org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1161)
>
> at
> org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:981)
> at
> org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:4058)
>
> at
> org.apache.catalina.core.StandardContext.start(StandardContext.java:4364)
> at
> org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:791)
>
> at
> org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:771)
> at
> org.apache.catalina.core.StandardHost.addChild(StandardHost.java:525)
> at
> org.apache.catalina.startup.HostConfig.deployDescriptor(HostConfig.java:626)
>
> at
> org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:511)
> at
> org.apache.catalina.startup.HostConfig.check(HostConfig.java:1229)
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>
> at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>
> at java.lang.reflect.Method.invoke(Method.java:597)
> at
> org.apache.tomcat.util.modeler.BaseModelMBean.invoke(BaseModelMBean.java:297)
>
> at
> com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.invoke(DefaultMBeanServerInterceptor.java:836)
>
> at
> com.sun.jmx.mbeanserver.JmxMBeanServer.invoke(JmxMBeanServer.java:761)
> at
> org.apache.catalina.manager.ManagerServlet.check(ManagerServlet.java:1465)
>
> at
> org.apache.catalina.manager.ManagerServlet.deploy(ManagerServlet.java:821)
>
> at
> org.apache.catalina.manager.ManagerServlet.doGet(ManagerServlet.java:349)
> at javax.servlet.http.HttpServlet.service(HttpServlet.java:690)
> at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
> at
> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
>
> at
> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
>
> at
> org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:196)
>
> at
> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
>
> at
> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
>
> at
> org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
>
> at
> org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
>
> at
> org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:525)
>
> at
> org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
>
> at
> org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
>
> at
> org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
>
> at
> org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:286)
>
> at
> org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
>
> at
> org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
>
> at
> org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
> at java.lang.Thread.run(Thread.java:619)
>
> Searching archives I see:
>
> <http://www.nabble.com/HELP---ResourceConfig-does-not-contain-any-root-resource-classes-td16856708.html>
>
>
> But I cannot fathom what I am doing that I should fix. Please help.
> Thanks.
>
Are you using NetBeans 6.1's support for Jersey? And if so, are you
using the built in support from 6.1 for building REST-based webapps? If
so, you are possibly running into one of a couple of different problems
alluded to in the message thread.

* Check your web.xml to see if NB added a <servlet> entry for class
  "com.sun.ws.rest.impl.container.servlet.ServletAdaptor", and a
  corresponding <servlet-mapping> for pattern "/resources/*". If they
  are there, try removing them and running your app again.

* Check the library dependencies of your project (right click on
  "Libraries" in the project window), and see if there are two sets
  of Jersey libraries there ... the 0.8 ones built into NB 6.1, and the
  1.0 or later ones that you added. If they are, remove the 0.8 ones.

Beware that, if either of these things is happening to you, it will
probably keep happening. What I ended up doing was rebuilding my webapp
projects *without* using any of the RESTful Web Services support in NB,
and just added the right jersey jar files as library dependencies
manually. That way, NB won't interfere with my configuration by trying
to be "helpful" like this.

Craig