users@glassfish.java.net

Re: servlet start error

From: Pavel Bucek <pavel.bucek_at_oracle.com>
Date: Fri, 17 Feb 2012 09:13:23 +0100

Hello,

this is Jersey related, please use users_at_jersey.java.net.

and btw, looks like Jersey is unable to scan you package "com.wgf.ui",
you might want to try set resource class names explicitly, something like:

<init-param>
<param-name>com.sun.jersey.config.property.classnames</param-name>
<param-value>com.wgf.ui.MyResource;com.wgf.ui.AnotherResource</param-value>
</init-param>

Regards,
Pavel

On 2/17/12 4:42 AM, forums_at_java.net wrote:
> I use the the jersey developing a RESTful the service, the server is
> tomcat7.0.23, the server.xml configuration:
> <servlet>
> <servlet-name>Jersey REST Service</servlet-name>
> <servlet-class>com.sun.jersey.spi.container.servlet.ServletContainer</servlet-class>
>
> <init-param>
> <param-name>com.sun.jersey.config.property.packages</param-name>
> <param-value>com.wgf.ui</param-value>
> </init-param>
> <load-on-startup>1</load-on-startup>
> </servlet>
> <servlet-mapping>
> <servlet-name>Jersey REST Service</servlet-name>
> <url-pattern>/*</url-pattern>
> </servlet-mapping>
> Often start the server reported the following error:
> HTTP Status 500 -
> type Exception report
> message
> description The server encountered an internal error () that prevented it
> from fulfilling this request.
> exception
> javax.servlet.ServletException: Servlet.init() for servlet Jersey REST
> Service threw exception
> org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472)
>
> org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:98)
>
> org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:928)
> org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:407)
>
> org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:987)
>
> org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:539)
>
> org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:298)
>
> java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
>
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
>
> java.lang.Thread.run(Thread.java:680)
>
> root cause
> com.sun.jersey.api.container.ContainerException: The ResourceConfig
> instance
> does not contain any root resource classes.
> com.sun.jersey.server.impl.application.RootResourceUriRules.<init>(RootResourceUriRules.java:99)
>
> com.sun.jersey.server.impl.application.WebApplicationImpl._initiate(WebApplicationImpl.java:1298)
>
> com.sun.jersey.server.impl.application.WebApplicationImpl.access$700(WebApplicationImpl.java:169)
>
> com.sun.jersey.server.impl.application.WebApplicationImpl$13.f(WebApplicationImpl.java:775)
>
> com.sun.jersey.server.impl.application.WebApplicationImpl$13.f(WebApplicationImpl.java:771)
>
> com.sun.jersey.spi.inject.Errors.processWithErrors(Errors.java:193)
> com.sun.jersey.server.impl.application.WebApplicationImpl.initiate(WebApplicationImpl.java:771)
>
> com.sun.jersey.server.impl.application.WebApplicationImpl.initiate(WebApplicationImpl.java:766)
>
> com.sun.jersey.spi.container.servlet.ServletContainer.initiate(ServletContainer.java:488)
>
> com.sun.jersey.spi.container.servlet.ServletContainer$InternalWebComponent.initiate(ServletContainer.java:318)
>
> com.sun.jersey.spi.container.servlet.WebComponent.load(WebComponent.java:609)
>
> com.sun.jersey.spi.container.servlet.WebComponent.init(WebComponent.java:210)
>
> com.sun.jersey.spi.container.servlet.ServletContainer.init(ServletContainer.java:373)
>
> com.sun.jersey.spi.container.servlet.ServletContainer.init(ServletContainer.java:556)
>
> javax.servlet.GenericServlet.init(GenericServlet.java:160)
> org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472)
>
> org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:98)
>
> org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:928)
> org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:407)
>
> org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:987)
>
> org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:539)
>
> org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:298)
>
> java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
>
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
>
> java.lang.Thread.run(Thread.java:680)
>
> note The full stack trace of the root cause is available in the Apache
> Tomcat/7.0.23 logs.
>
>
> --
>
> [Message sent by forum member 'chris_jiang']
>
> View Post: http://forums.java.net/node/883596
>
>
>