1 Reply Latest reply on Aug 9, 2014 7:37 AM by Jay SenSharma

    java.lang.ClassNotFoundException: com.sun.net.httpserver.HttpHandler

    Aaron Stromas Newbie

      Greetings!

       

      I have an application using Retlet EE 2.2 which runs fine in Tomcat 7 but fails in JBOSS 6.2 (see stac trace below). I have very little familiarity with JBOSS but I underatned from the trace is not finding the HTTP stack classes. Please, help. TIA.

       

      09:45:13,041 ERROR [org.apache.catalina.core.ContainerBase.[jboss.web].[default-host].[/rest].[greeting]] (http-/127.0.0.1:8080-1) JBWEB000235: Allocate exception for servlet greeting: java.lang.ClassNotFoundException: com.sun.net.httpserver.HttpHandler from [Module "deployment.rest.war:main" from Service Module Loader]

          at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:197) [jboss-modules.jar:1.3.0.Final-redhat-2]

          at org.jboss.modules.ConcurrentClassLoader.performLoadClassUnchecked(ConcurrentClassLoader.java:443) [jboss-modules.jar:1.3.0.Final-redhat-2]

          at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:431) [jboss-modules.jar:1.3.0.Final-redhat-2]

          at org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:373) [jboss-modules.jar:1.3.0.Final-redhat-2]

          at org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:118) [jboss-modules.jar:1.3.0.Final-redhat-2]

          at org.restlet.engine.Engine.registerDefaultConnectors(Engine.java:734) [org.restlet.jar:]

          at org.restlet.engine.Engine.discoverConnectors(Engine.java:553) [org.restlet.jar:]

          at org.restlet.engine.Engine.<init>(Engine.java:386) [org.restlet.jar:]

          at org.restlet.engine.Engine.register(Engine.java:308) [org.restlet.jar:]

          at org.restlet.engine.Engine.register(Engine.java:297) [org.restlet.jar:]

          at org.restlet.engine.Engine.getInstance(Engine.java:206) [org.restlet.jar:]

          at org.restlet.engine.Engine.getLogger(Engine.java:262) [org.restlet.jar:]

          at org.restlet.Context.<init>(Context.java:167) [org.restlet.jar:]

          at org.restlet.Context.<init>(Context.java:139) [org.restlet.jar:]

          at org.restlet.ext.servlet.ServerServlet.createComponent(ServerServlet.java:429) [org.restlet.ext.servlet.jar:]

          at org.restlet.ext.servlet.ServerServlet.getComponent(ServerServlet.java:843) [org.restlet.ext.servlet.jar:]

          at org.restlet.ext.servlet.ServerServlet.init(ServerServlet.java:961) [org.restlet.ext.servlet.jar:]

          at javax.servlet.GenericServlet.init(GenericServlet.java:242) [jboss-servlet-api_3.0_spec-1.0.2.Final-redhat-1.jar:1.0.2.Final-redhat-1]

          at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1194) [jbossweb-7.2.2.Final-redhat-1.jar:7.2.2.Final-redhat-1]

          at org.apache.catalina.core.StandardWrapper.allocate(StandardWrapper.java:950) [jbossweb-7.2.2.Final-redhat-1.jar:7.2.2.Final-redhat-1]

          at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:151) [jbossweb-7.2.2.Final-redhat-1.jar:7.2.2.Final-redhat-1]

          at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:149) [jbossweb-7.2.2.Final-redhat-1.jar:7.2.2.Final-redhat-1]

          at org.jboss.as.web.security.SecurityContextAssociationValve.invoke(SecurityContextAssociationValve.java:169) [jboss-as-web-7.3.0.Final-redhat-14.jar:7.3.0.Final-redhat-14]

          at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:145) [jbossweb-7.2.2.Final-redhat-1.jar:7.2.2.Final-redhat-1]

          at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:97) [jbossweb-7.2.2.Final-redhat-1.jar:7.2.2.Final-redhat-1]

          at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:102) [jbossweb-7.2.2.Final-redhat-1.jar:7.2.2.Final-redhat-1]

      at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:336) [jbossweb-7.2.2.Final-redhat-1.jar:7.2.2.Final-redhat-1]

          at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:856) [jbossweb-7.2.2.Final-redhat-1.jar:7.2.2.Final-redhat-1]

          at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:653) [jbossweb-7.2.2.Final-redhat-1.jar:7.2.2.Final-redhat-1]

          at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:920) [jbossweb-7.2.2.Final-redhat-1.jar:7.2.2.Final-redhat-1]

          at java.lang.Thread.run(Thread.java:744) [rt.jar:1.7.0_51]

        • 1. Re: java.lang.ClassNotFoundException: com.sun.net.httpserver.HttpHandler
          Jay SenSharma Master

          Hi,

           

          The class which is not found in the classpath is "com.sun.net.httpserver.HttpHandler". This class can be found in the following JAR:

           

            $JAVA_HOME/jre/lib/rt.jar
          

           

          All the private classes present inside the "rt.jar" (or other JVM related jars) are not available by default to the application deployed on the JBoss. So you can try adding the following kind of jboss-deployment-structure.xml inside your application "rest.war/WEB-INF/jboss-deployment-structure.xml" as following:

           

           

          <jboss-deployment-structure xmlns="urn:jboss:deployment-structure:1.1">
                <deployment>
                  <dependencies>
                      <system>
                          <paths>
                              <path name="com/sun/net/httpserver"/>
                          </paths>
                      </system>
                  </dependencies>
                </deployment>
          </jboss-deployment-structure>