14 Replies Latest reply on Dec 15, 2006 12:48 PM by becalvert

    JSR-181 Endpoint ClassCastException

    Joe Hudson Newbie

      Hello, I'm new to JSR-181 and was creating a simple test but I am getting a ClassCastException. Can anybody help me? Thanks


      <!DOCTYPE web-app
      PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
      "http://java.sun.com/dtd/web-app_2_3.dtd">
      <web-app>

      <servlet-name>Test</servlet-name>
      <servlet-class>com.test.TestEndpoint</servlet-class>


      <servlet-mapping>
      <servlet-name>Test</servlet-name>
      <url-pattern>/*</url-pattern>
      </servlet-mapping>
      </web-app>


      package com.test;

      import javax.jws.WebMethod;
      import javax.jws.WebService;
      import javax.jws.soap.SOAPBinding;

      @WebService(name = "TestEndpoint")
      @SOAPBinding(style = SOAPBinding.Style.RPC)
      public class TestEndpoint {

      @WebMethod
      public String test (String param) {
      System.out.println("Param: " + param);
      return param;
      }
      }



      javax.servlet.ServletException: Class com.test.TestEndpoint is not a Servlet
      org.jboss.web.tomcat.security.CustomPrincipalValve.invoke(CustomPrincipalValve.java:54)
      org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:174)
      org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:74)
      org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
      org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
      org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869)
      org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:664)
      org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
      org.apache.tomcat.util.net.MasterSlaveWorkerThread.run(MasterSlaveWorkerThread.java:112)
      java.lang.Thread.run(Thread.java:595)

      root cause

      java.lang.ClassCastException: com.test.TestEndpoint
      org.jboss.web.tomcat.security.CustomPrincipalValve.invoke(CustomPrincipalValve.java:54)
      org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:174)
      org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:74)
      org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
      org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
      org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869)
      org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:664)
      org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
      org.apache.tomcat.util.net.MasterSlaveWorkerThread.run(MasterSlaveWorkerThread.java:112)
      java.lang.Thread.run(Thread.java:595)

        • 1. Re: JSR-181 Endpoint ClassCastException
          Thomas Diesler Master

          This is because the deployer does not see the @WebService annotation. Does it have to do with the DOCTYPE?

          Please start with a working sample from the sample download.

          • 2. Re: JSR-181 Endpoint ClassCastException
            Joe Hudson Newbie

            Thank you very much for the response. I just duplicated the sample from: http://wiki.jboss.org/wiki/Wiki.jsp?page=JBWS181HelloWorld
            and am running into the same problem. Are there different samples that you are talking about? If so, would you mind giving me a link to them? Thank you very much.

            Joe


            javax.servlet.ServletException: Class org.jboss.samples.HelloWorldWS is not a Servlet
            org.jboss.web.tomcat.security.CustomPrincipalValve.invoke(CustomPrincipalValve.java:54)
            org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:174)
            org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:74)
            org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
            org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
            org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869)
            org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:664)
            org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
            org.apache.tomcat.util.net.MasterSlaveWorkerThread.run(MasterSlaveWorkerThread.java:112)
            java.lang.Thread.run(Thread.java:595)

            • 4. Re: JSR-181 Endpoint ClassCastException
              Joe Hudson Newbie

              Thank you very much Thomas... sorry I didn't know about that.

              Joe

              • 5. Re: JSR-181 Endpoint ClassCastException
                Joe Hudson Newbie

                Thanks again for your help. I've downloaded the samples (and performed the required steps in the Install.txt document) and receive an error when browsing to http://localhost:8080/jbossws/services
                I can see http://localhost:8080/jbossws just fine though. Any help would be greatly appreciated. Thank you very much.

                17:06:47,775 INFO [Server] Release ID: JBoss [Zion] 4.0.4.CR2 (build: CVSTag=JBoss_4_0_4_CR2 date=200603311500)

                The error is below:
                17:10:50,665 ERROR [[/jbossws]] StandardWrapper.Throwable
                java.lang.NullPointerException
                at org.jboss.ws.server.ServiceEndpointManagerFactory.getServiceEndpointManager(ServiceEndpointManagerFactory.java:51)
                at org.jboss.ws.integration.jboss.JBossContextServlet.initServiceEndpointManager(JBossContextServlet.java:44)
                at org.jboss.ws.common.CommonContextServlet.init(CommonContextServlet.java:54)
                at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1105)
                at org.apache.catalina.core.StandardWrapper.allocate(StandardWrapper.java:757)
                at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:130)
                at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
                at org.jboss.web.tomcat.security.CustomPrincipalValve.invoke(CustomPrincipalValve.java:54)
                at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:174)
                at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:74)
                at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
                at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
                at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
                at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
                at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869)
                at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:664)
                at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
                at org.apache.tomcat.util.net.MasterSlaveWorkerThread.run(MasterSlaveWorkerThread.java:112)
                at java.lang.Thread.run(Thread.java:595)
                17:10:50,665 ERROR [[ContextServlet]] Allocate exception for servlet ContextServlet
                java.lang.NullPointerException
                at org.jboss.ws.server.ServiceEndpointManagerFactory.getServiceEndpointManager(ServiceEndpointManagerFactory.java:51)
                at org.jboss.ws.integration.jboss.JBossContextServlet.initServiceEndpointManager(JBossContextServlet.java:44)
                at org.jboss.ws.common.CommonContextServlet.init(CommonContextServlet.java:54)
                at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1105)
                at org.apache.catalina.core.StandardWrapper.allocate(StandardWrapper.java:757)
                at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:130)
                at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
                at org.jboss.web.tomcat.security.CustomPrincipalValve.invoke(CustomPrincipalValve.java:54)
                at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:174)
                at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:74)
                at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
                at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
                at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
                at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
                at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869)
                at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:664)
                at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
                at org.apache.tomcat.util.net.MasterSlaveWorkerThread.run(MasterSlaveWorkerThread.java:112)
                at java.lang.Thread.run(Thread.java:595)

                • 6. Re: JSR-181 Endpoint ClassCastException
                  Joe Hudson Newbie

                  So, I just downloaded a new clean Jboss server (4.0.5) and started over. I replaced the following files:
                  - jbossws14-client.jar
                  - jbossws14.sar

                  I am still hitting the exact same error (shown above) when I try to view a wsdl file. Please, does anybody know what I am doing wrong? Thank you very much in advance for any help that can be offered.

                  Joe

                  • 7. Re: JSR-181 Endpoint ClassCastException
                    Joe Hudson Newbie

                    Sorry I keep posting but I'm truly trying to figure this out... I've made progress but can't get past the following error (on startup). I don't know what to do... I've been through the docs and I feel like I have done everything right... please help. Thanks.

                    Joe


                    ** Java Class
                    package com.test;

                    import javax.jws.WebMethod;
                    import javax.jws.WebService;
                    import javax.jws.soap.SOAPBinding;

                    @WebService(
                    name = "EndpointInterface",
                    targetNamespace = "http://org.jboss.ws/samples/jsr181pojo",
                    serviceName = "TestService")
                    @SOAPBinding(style = SOAPBinding.Style.RPC)
                    public class JSEBean01
                    {
                    @WebMethod
                    public String echo(String input)
                    {
                    return input;
                    }
                    }


                    ** web.xml
                    <web-app xmlns="http://java.sun.com/xml/ns/j2ee"
                    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                    xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
                    http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"
                    version="2.4">

                    <servlet-name>TestService</servlet-name>
                    <servlet-class>com.test.JSEBean01</servlet-class>

                    <servlet-mapping>
                    <servlet-name>TestService</servlet-name>
                    <url-pattern>/*</url-pattern>
                    </servlet-mapping>
                    </web-app>



                    java.lang.NullPointerException
                    at org.jboss.ws.integration.jboss.DeployerInterceptor.getServiceEndpointDeployer(DeployerInterceptor.java:142)
                    at org.jboss.ws.integration.jboss.DeployerInterceptor.create(DeployerInterceptor.java:80)
                    at org.jboss.ws.integration.jboss.DeployerInterceptorJSE.create(DeployerInterceptorJSE.java:83)
                    at org.jboss.deployment.SubDeployerInterceptorSupport$XMBeanInterceptor.create(SubDeployerInterceptorSupport.java:180)
                    at org.jboss.deployment.SubDeployerInterceptor.invoke(SubDeployerInterceptor.java:91)
                    at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
                    at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
                    at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
                    at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:210)
                    at $Proxy36.create(Unknown Source)
                    at org.jboss.deployment.MainDeployer.create(MainDeployer.java:969)
                    at org.jboss.deployment.MainDeployer.create(MainDeployer.java:959)
                    at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:818)
                    at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:782)
                    at sun.reflect.GeneratedMethodAccessor57.invoke(Unknown Source)
                    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
                    at java.lang.reflect.Method.invoke(Method.java:585)
                    at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
                    at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
                    at org.jboss.mx.interceptor.AbstractInterceptor.invoke(AbstractInterceptor.java:133)
                    at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
                    at org.jboss.mx.interceptor.ModelMBeanOperationInterceptor.invoke(ModelMBeanOperationInterceptor.java:142)
                    at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
                    at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
                    at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
                    at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:210)
                    at $Proxy8.deploy(Unknown Source)
                    at org.jboss.deployment.scanner.URLDeploymentScanner.deploy(URLDeploymentScanner.java:421)
                    at org.jboss.deployment.scanner.URLDeploymentScanner.scan(URLDeploymentScanner.java:634)
                    at org.jboss.deployment.scanner.AbstractDeploymentScanner$ScannerThread.doScan(AbstractDeploymentScanner.java:263)
                    at org.jboss.deployment.scanner.AbstractDeploymentScanner.startService(AbstractDeploymentScanner.java:336)
                    at org.jboss.system.ServiceMBeanSupport.jbossInternalStart(ServiceMBeanSupport.java:289)
                    at org.jboss.system.ServiceMBeanSupport.jbossInternalLifecycle(ServiceMBeanSupport.java:245)
                    at sun.reflect.GeneratedMethodAccessor8.invoke(Unknown Source)
                    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
                    at java.lang.reflect.Method.invoke(Method.java:585)
                    at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
                    at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
                    at org.jboss.mx.server.Invocation.invoke(Invocation.java:86)
                    at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
                    at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
                    at org.jboss.system.ServiceController$ServiceProxy.invoke(ServiceController.java:978)
                    at $Proxy0.start(Unknown Source)
                    at org.jboss.system.ServiceController.start(ServiceController.java:417)
                    at sun.reflect.GeneratedMethodAccessor9.invoke(Unknown Source)
                    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
                    at java.lang.reflect.Method.invoke(Method.java:585)
                    at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
                    at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
                    at org.jboss.mx.server.Invocation.invoke(Invocation.java:86)
                    at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
                    at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
                    at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:210)
                    at $Proxy4.start(Unknown Source)
                    at org.jboss.deployment.SARDeployer.start(SARDeployer.java:302)
                    at org.jboss.deployment.MainDeployer.start(MainDeployer.java:1025)
                    at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:819)
                    at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:782)
                    at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:766)
                    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:585)
                    at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
                    at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
                    at org.jboss.mx.interceptor.AbstractInterceptor.invoke(AbstractInterceptor.java:133)
                    at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
                    at org.jboss.mx.interceptor.ModelMBeanOperationInterceptor.invoke(ModelMBeanOperationInterceptor.java:142)
                    at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
                    at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
                    at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
                    at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:210)
                    at $Proxy5.deploy(Unknown Source)
                    at org.jboss.system.server.ServerImpl.doStart(ServerImpl.java:482)
                    at org.jboss.system.server.ServerImpl.start(ServerImpl.java:362)
                    at org.jboss.Main.boot(Main.java:200)
                    at org.jboss.Main$1.run(Main.java:490)
                    at java.lang.Thread.run(Thread.java:595)
                    00:01:12,822 DEBUG [NestedThrowable] org.jboss.util.NestedThrowable.parentTraceEnabled=true

                    • 9. Re: JSR-181 Endpoint ClassCastException
                      Thomas Diesler Master

                      Why are you using JBoss [Zion] 4.0.4.CR2
                      Try 4.0.4.GA or 4.0.5.GA

                      • 10. Re: JSR-181 Endpoint ClassCastException
                        Joe Hudson Newbie

                        Thanks again Thomas for your help. I have finally got it working but I am wondering about the generated parameter names.

                        A snipped from the generated WSDL is:





                        Notice the int_1 and int_2 parameter names. The Java parameter names weren't used. Is there any way I tell the service to use the Java method parameter names as WSDL part names? Thanks

                        Joe

                        • 11. Re: JSR-181 Endpoint ClassCastException
                          Thomas Diesler Master

                          Before @WebParam in JAXWS there is not, because you cannot get at this information through the java reflection API

                          • 12. Re: JSR-181 Endpoint ClassCastException
                            Joe Hudson Newbie

                            ok, thank you very much Thomas. I appreciate your help.

                            Joe

                            • 13. Re: JSR-181 Endpoint ClassCastException
                              Joe Hudson Newbie

                              Ok, I promise this is my last question :)

                              I saw a reference somewhere that jbossws rewrites the web.xml (which I see happening) if you are using an exploded structure but, if I restart the app server and keep the rewritten web.xml file, the endpoint can not be located. So, every time I start the server have to keep replacing the web.xml file with the web.xml.org file. Am I missing something? Is there an easier way to do this? Thank you very much.

                              Joe

                              • 14. Re: JSR-181 Endpoint ClassCastException
                                Newbie

                                jhudson, how did you get the NullPointerException to go away?

                                I have the same problem with requesting the WSDL for a simple service too.

                                Thanks in advance!

                                ---

                                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 SearchService threw exception
                                org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:175)
                                org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:74)
                                org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
                                org.jboss.web.tomcat.tc5.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:156)
                                org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
                                org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869)
                                org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:664)
                                org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
                                org.apache.tomcat.util.net.MasterSlaveWorkerThread.run(MasterSlaveWorkerThread.java:112)
                                java.lang.Thread.run(Thread.java:595)

                                root cause

                                java.lang.NullPointerException
                                org.jboss.ws.server.ServiceEndpointManagerFactory.getServiceEndpointManager(ServiceEndpointManagerFactory.java:51)
                                org.jboss.ws.server.StandardEndpointServlet.initServiceEndpointManager(StandardEndpointServlet.java:136)
                                org.jboss.ws.server.StandardEndpointServlet.init(StandardEndpointServlet.java:61)
                                org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:175)
                                org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:74)
                                org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
                                org.jboss.web.tomcat.tc5.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:156)
                                org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
                                org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869)
                                org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:664)
                                org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
                                org.apache.tomcat.util.net.MasterSlaveWorkerThread.run(MasterSlaveWorkerThread.java:112)
                                java.lang.Thread.run(Thread.java:595)