Skip to main content

ServletContainer ClassNotFoundException

Please note these java.net forums are being decommissioned and use the new and improved forums at https://community.oracle.com/community/java.
1 reply [Last post]
ssankara73
Offline
Joined: 2014-02-25

I have been getting a ClassNotFoundException with org.glassfish.jersey.servlet.ServletContainer but it peculiarly started last night when I tried to start/re-start my Tomcat server (v7) with Eclipse Juno. Not sure what is going on. Any help will be much appreciated.

Here is the stacktrace:
Feb 25, 2014 11:11:19 AM org.apache.catalina.core.ApplicationContext log
INFO: Marking servlet com.att.ucomm.admin.UCommAdminFunctions as unavailable
Feb 25, 2014 11:11:19 AM org.apache.catalina.core.StandardContext loadOnStartup
SEVERE: Servlet /UCommAdminFunctions threw load() exception
java.lang.ClassNotFoundException: org.glassfish.jersey.servlet.ServletContainer
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1671)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1516)
at org.apache.catalina.core.DefaultInstanceManager.loadClass(DefaultInstanceManager.java:415)
at org.apache.catalina.core.DefaultInstanceManager.loadClassMaybePrivileged(DefaultInstanceManager.java:397)
at org.apache.catalina.core.DefaultInstanceManager.newInstance(DefaultInstanceManager.java:118)
at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1048)
at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:996)
at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:4762)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5045)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:140)
at org.apache.catalina.core.StandardContext.reload(StandardContext.java:3670)
at org.apache.catalina.loader.WebappLoader.backgroundProcess(WebappLoader.java:424)
at org.apache.catalina.core.ContainerBase.backgroundProcess(ContainerBase.java:1207)
at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1393)
at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1403)
at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1403)
at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.run(ContainerBase.java:1382)
at java.lang.Thread.run(Unknown Source)

Feb 25, 2014 11:11:19 AM org.apache.catalina.core.StandardContext reload
INFO: Reloading Context with name [/UCommAdminFunctions] is completed
Feb 25, 2014 11:13:33 AM org.apache.catalina.core.StandardWrapperValve invoke
INFO: Servlet com.att.ucomm.admin.UCommAdminFunctions is currently unavailable

And here is the web.xml
xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">


com.att.ucomm.admin.UCommAdminFunctions
org.glassfish.jersey.servlet.ServletContainer

com.att.ucomm.admin.UCommAdminFunctions my.package.MyApplication

jersey.config.server.provider.packages com.att.ucomm.admin

jersey.config.server.provider.classnames com.att.ucomm.admin.SecurityRequestFilter;org.glassfish.jersey.filter.LoggingFilter

jersey.config.server.tracing ALL

1


com.att.ucomm.admin.UCommAdminFunctions
/rest/*

I have jersey-client-1.17.jar, jersey-core-1.17.jar, jersey-bundle-1.17.1.jar, jersey-sever-1.17.jar, jesey-servlet-1.17.jar, jersey-json-1.17.jar in my WEB-INFO/lib folder.

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
ssankara73
Offline
Joined: 2014-02-25

Sorry I thought I updated to fix the issue wtih web.xml not showing up right. Trying again:

<?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.5"
        xmlns="http://java.sun.com/xml/ns/javaee"
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">

    <servlet>
        <servlet-name>com.att.ucomm.admin.UCommAdminFunctions</servlet-name>
        <servlet-class>org.glassfish.jersey.servlet.ServletContainer</servlet-class>

        <!-- Register JAX-RS Application, if needed. -->
        <init-param>
            <param-name>com.att.ucomm.admin.UCommAdminFunctions</param-name>
            <param-value>my.package.MyApplication</param-value>
        </init-param>

        <!-- Register resources and providers under my.package. -->
        <init-param>
            <param-name>jersey.config.server.provider.packages</param-name>
            <param-value>com.att.ucomm.admin</param-value>
        </init-param>

        <!-- Register my custom provider (not needed if it's in my.package) AND LoggingFilter. -->
        <init-param>
            <param-name>jersey.config.server.provider.classnames</param-name>
            <param-value>com.att.ucomm.admin.SecurityRequestFilter;org.glassfish.jersey.filter.LoggingFilter</param-value>
        </init-param>

        <!-- Enable Tracing support. -->
        <init-param>
            <param-name>jersey.config.server.tracing</param-name>
            <param-value>ALL</param-value>
        </init-param>

        <load-on-startup>1</load-on-startup>
    </servlet>

    <servlet-mapping>
        <servlet-name>com.att.ucomm.admin.UCommAdminFunctions</servlet-name>
        <url-pattern>/rest/*</url-pattern>
    </servlet-mapping>
  <welcome-file-list>
    <welcome-file>index.html</welcome-file>
    <welcome-file>index.htm</welcome-file>
    <welcome-file>index.jsp</welcome-file>
    <welcome-file>default.html</welcome-file>
    <welcome-file>default.htm</welcome-file>
    <welcome-file>default.jsp</welcome-file>
  </welcome-file-list>
</web-app>