3 Replies Latest reply on Aug 7, 2013 9:04 AM by Tomaz Cerar

    java.lang.ClassCastException: [class] cannot be cast to javax.servlet.Servlet

    johnsonlui Newbie

      Hello,

       

      i just deploy an app and when i access the link: http://<host>:<port>/soap/servlet/rpcrouter, i met the error below:

       

      23:15:24,059 ERROR [org.apache.catalina.core.ContainerBase.[jboss.web].[default-host].[/ccs].[rpcrouter]] (http-/10.222.90.45:8480-1) JBWEB000235: Allocate exception for servlet rpcrouter: java.lang.ClassCastException: org.apache.soap.server.http.RPCRouterServlet cannot be cast to javax.servlet.Servlet

              at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1154) [jbossweb-7.2.0.Final.jar:7.2.0.Final]

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

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

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

              at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:481) [jbossweb-7.2.0.Final.jar:7.2.0.Final]

              at org.jboss.as.web.security.SecurityContextAssociationValve.invoke(SecurityContextAssociationValve.java:169) [jboss-as-web-7.2.0.Alpha1-redhat-4.jar:7.2.0.Alpha1-redhat-4]

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

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

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

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

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

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

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

              at java.lang.Thread.run(Thread.java:619) [rt.jar:1.6.0_06]

       

      and here is my web.xml (i just include some which may related to this issue)

       

        <servlet>

          <servlet-name>rpcrouter</servlet-name>

          <display-name>Apache-SOAP RPC Router</display-name>

          <description>no description</description>

          <servlet-class>org.apache.soap.server.http.RPCRouterServlet</servlet-class>

          <init-param>

            <param-name>faultListener</param-name>

            <param-value>org.apache.soap.server.DOMFaultListener</param-value>

          </init-param>

        </servlet>

        

        <servlet-mapping>

          <servlet-name>rpcrouter</servlet-name>

          <url-pattern>/soap/servlet/rpcrouter</url-pattern>

        </servlet-mapping>

       

       

      i have done some research from the internet and i see using standalone-preview.xml can solve the problem but i dont want to use that profile and just want to use standalone.xml, is there any method to change in standalone.xml?

        • 1. Re: java.lang.ClassCastException: [class] cannot be cast to javax.servlet.Servlet
          johnsonlui Newbie

          Problem solved.

           

          Solution:

          Adding those within module.xml

              <dependencies>

                  <module name="javax.api"/>

                  <module name="javax.xml.bind.api"/>

                  <module name="org.jboss.ws.api"/>

                  <module name="org.jboss.ws.spi"/>

                  <module name="javaee.api"/>

              </dependencies>

          • 2. Re: java.lang.ClassCastException: [class] cannot be cast to javax.servlet.Servlet
            Sant D Newbie

            Hi,

             

            I am having same problem as above. Could someone help me about in which module.xml file i need to add these dependencies????

             

            10:44:29,586 ERROR [org.apache.catalina.core.ContainerBase.[jboss.web].[default-host].[/blog]] (ServerService Thread Pool -- 68) JBWEB000289: Servlet blogwebserviceport threw load() exception: java.lang.ClassCastException: au.edu.nsw.det.cclt.ccltblog.webservice.BlogWebserviceImpl cannot be cast to javax.servlet.Servlet

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

                      at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:1100) [jbossweb-7.2.0.Final-redhat-1.jar:7.2.0.Final-redhat-1]

                      at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:3591) [jbossweb-7.2.0.Final-redhat-1.jar:7.2.0.Final-redhat-1]

                      at org.apache.catalina.core.StandardContext.start(StandardContext.java:3798) [jbossweb-7.2.0.Final-redhat-1.jar:7.2.0.Final-redhat-1]

                      at org.jboss.as.web.deployment.WebDeploymentService.doStart(WebDeploymentService.java:156) [jboss-as-web-7.2.0.Final-redhat-8.jar:7.2.0.Final-redhat-8]

                      at org.jboss.as.web.deployment.WebDeploymentService.access$000(WebDeploymentService.java:60) [jboss-as-web-7.2.0.Final-redhat-8.jar:7.2.0.Final-redhat-8]

                      at org.jboss.as.web.deployment.WebDeploymentService$1.run(WebDeploymentService.java:93) [jboss-as-web-7.2.0.Final-redhat-8.jar:7.2.0.Final-redhat-8]

                      at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471) [rt.jar:1.7.0_21]

                      at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334) [rt.jar:1.7.0_21]

                      at java.util.concurrent.FutureTask.run(FutureTask.java:166) [rt.jar:1.7.0_21]

                      at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) [rt.jar:1.7.0_21]

                      at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) [rt.jar:1.7.0_21]

                      at java.lang.Thread.run(Thread.java:722) [rt.jar:1.7.0_21]

                      at org.jboss.threads.JBossThread.run(JBossThread.java:122)

             

            Thanks,

            • 3. Re: java.lang.ClassCastException: [class] cannot be cast to javax.servlet.Servlet
              Tomaz Cerar Master

              That is not same problem.

               

              i would say you have servlet classes deployed as part of your application.

               

              please create new thread, and post output

              jar tf <your.war>

              mostly show us what are the jars in your WEB-INF/lib