5 Replies Latest reply on May 27, 2010 10:15 AM by blieb73

    JBOss5.1.0-GA WS endpoint generated with wsconsume does not deploy

    skymic

      Hi,

       

      I am using JBoss5.1.0-GA with Sun's JDK1.6.0_17.

       

      I generated java classes from a WSDL using wsconsume. All worked fine.

      For the WSEndpoint I implemented the generated interface. Then I deployed the generated classes as a war to JBoss.

       

      JBoss then marked my servlet as unavailable and threw the error:

       

      10:35:19,327 INFO  [[/WS_Server]] Marking servlet WSServlet as unavailable
      10:35:19,327 ERROR [[/WS_Server]] Servlet /WS_Server threw load() exception
      java.lang.ClassCastException: ch.skyguide.aim.interfaces.ws.server.SDOCustomerInterfacesImpl cannot be cast to javax.servlet.Servlet

      I am sure this is because I provided the following web.xml in the war file:

       

      <?xml version="1.0" encoding="UTF-8"?>
      <web-app version="2.4"
               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" >

          <servlet>
              <description>WS endpoint</description>
              <display-name>WSServlet</display-name>
              <servlet-name>WSServlet</servlet-name>
              <servlet-class>ch.skyguide.aim.interfaces.ws.server.SDOCustomerInterfacesImpl</servlet-class>
              <load-on-startup>1</load-on-startup>
          </servlet>
          <servlet-mapping>
              <servlet-name>WSServlet</servlet-name>
              <url-pattern>/services/SDOCustomerInterfacesImpl</url-pattern>
          </servlet-mapping>

      ...

       

      Well, the class given in the tags <servlet-class>ch.skyguide.aim.interfaces.ws.server.SDOCustomerInterfacesImpl</servlet-class>
      is my Implementation of the generated WS-endpoint and does definitely not implement javax.servlet.Servlet.

      I read in the JBoss documents that the web.xml has to be filled in like that. But maybe its wrong.

       

      How do you deploy a wsconsume generated endpoint to JBoss5.1.0-GA? How should the web.xml look like?

       

      Does anyone have an idea?

        • 1. Re: JBOss5.1.0-GA WS endpoint generated with wsconsume does not deploy

          Is you class annotated with @WebService? That is what deployment scanner is looking for. Your service definitively does not have to be a Servlet subclass. I wonder if you need web.xml at all, in theory the annotation is all you need, everything else can be generated and defaulted reasonably for you.

           

          Here is my working example. POJO service class, JBoss 5.1.0.GA, Maven project, WAR archive.

          web.xml

          <?xml version="1.0" encoding="UTF-8"?>
          <web-app version="2.5" ....>
              <servlet>
                  <servlet-name>MyWebService</servlet-name>
                  <servlet-class>esp.home.wsarena.service.FooService</servlet-class>
              </servlet>
              <servlet-mapping>
                  <servlet-name>MyWebService</servlet-name>
                  <url-pattern>/FooService</url-pattern>
              </servlet-mapping>
          </web-app>
          

           

          jboss-web.xml  (not essential just to have a nice context root):

          <?xml version="1.0" encoding="UTF-8"?>
          <jboss-web>
              <!-- Exist here for sole reason of defining context root. There is no way how to do it in web.xml. This this JBoss specific way.
               Glassfish has a similar configuration file where you can do the same.
               Alternatives: 
               - make EAR file and specify context root for the web module in standard application.xml file.
               - make it EJB JAR file. But WebService must be also an EJB3 then. Then there is no context root (?)
               see: http://docs.jboss.org/jbossas/guides/webguide/r2/en/html/ch06.html
               -->
              <context-root>wsarena3</context-root>
          </jboss-web>

           

          FooService.java

          /**
           * Web service implementation
           */
          @WebService
          public class FooService {
              public static final Logger log = Logger.getLogger(FooService.class.getName());
              
              @WebMethod
              public void fooMethod1(String command) {
                  log.info("fooMethod2: " + command);
              }
              
              @WebMethod
              public String fooMethod2(String command) {
                  log.info("fooMethod2: " + command);
                  return "OK";
              }
          }

           

          When deployed (redeployed) it gives me these lines in the JBoss log file:

          12:00:34,549 INFO  [TomcatDeployment] undeploy, ctxPath=/wsarena3
          12:00:34,554 INFO  [DefaultEndpointRegistry] remove: jboss.ws:context=wsarena3,endpoint=MyWebService
          12:00:34,682 INFO  [DefaultEndpointRegistry] register: jboss.ws:context=wsarena3,endpoint=MyWebService
          12:00:34,714 INFO  [TomcatDeployment] deploy, ctxPath=/wsarena3
          12:00:34,894 INFO  [WSDLFilePublisher] WSDL published to: file:/opt/jboss-5.1.0.GA/server/espinosa/data/wsdl/webarena3.war/FooServiceService1855936477358841984.wsdl
          
          • 2. Re: JBOss5.1.0-GA WS endpoint generated with wsconsume does not deploy
            skymic

            Hi,

             

            yes, my generated interface is annotated with @WebService:

             

            @WebService(name = "SDOCustomerInterfaces", targetNamespace = "http://server.ws.aim.interfaces.skyguide.ch")
            @XmlSeeAlso({
                ObjectFactory.class
            })
            public interface SDOCustomerInterfaces {

             

            ...

             

            The class which implements the generated WebService is also annotated with @WebService:

             

            @WebService (serviceName="SDO_WS",
                         portName="SDOCustomerInterfaces",
                         wsdlLocation = "WEB-INF/wsdl/SDOCustomerInterfaces.wsdl",
                         targetNamespace = "http://server.ws.aim.interfaces.skyguide.ch",
                         endpointInterface="ch.skyguide.aim.interfaces.ws.server.SDOCustomerInterfaces")
            @SOAPBinding(style = SOAPBinding.Style.DOCUMENT)
            public class SDOCustomerInterfacesImpl implements SDOCustomerInterfaces {

            And my web.xml references the class SDOCustomerInterfacesImpl in the tags <servlet-class>:

             

            <?xml version="1.0" encoding="UTF-8"?>
            <web-app version="2.4"
                     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" >

                <servlet>
                    <description>WS endpoint</description>
                    <display-name>WSServlet</display-name>
                    <servlet-name>WSServlet</servlet-name>
                    <servlet-class>ch.skyguide.aim.interfaces.ws.server.SDOCustomerInterfacesImpl</servlet-class>
                    <load-on-startup>1</load-on-startup>
                </servlet>
                <servlet-mapping>
                    <servlet-name>WSServlet</servlet-name>
                    <url-pattern>/services/SDOCustomerInterfacesImpl</url-pattern>
                </servlet-mapping>

             

             

            I have no jboss-web.xml since my WS_Server.war is deployed inside an ear. In the ear I jave the application.xml which defines the context:

             

                <module id="WS_Server">
                    <web>
                        <web-uri>WS_Server.war</web-uri>
                        <context-root>WS_Server</context-root>
                    </web>
                </module>

            And in deployment I get the log entry from JBoss5.1.0_GA:

             

            13:28:23,430 INFO  [TomcatDeployment] deploy, ctxPath=/WS_Server
            13:28:29,508 INFO  [[/WS_Server]] Marking servlet WSServlet as unavailable
            13:28:29,508 ERROR [[/WS_Server]] Servlet /WS_Server threw load() exception
            java.lang.ClassCastException: ch.skyguide.aim.interfaces.ws.server.SDOCustomerInterfacesImpl cannot be cast to javax.servlet.Servlet
            at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1006)
            at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:950)
            at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:4122)
            at org.apache.catalina.core.StandardContext.start(StandardContext.java:4421)
            at org.jboss.web.tomcat.service.deployers.TomcatDeployment.performDeployInternal(TomcatDeployment.java:310)
            at org.jboss.web.tomcat.service.deployers.TomcatDeployment.performDeploy(TomcatDeployment.java:142)
            at org.jboss.web.deployers.AbstractWarDeployment.start(AbstractWarDeployment.java:461)
            at org.jboss.web.deployers.WebModule.startModule(WebModule.java:118)
            at org.jboss.web.deployers.WebModule.start(WebModule.java:97)
            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:597)
            at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:157)
            at org.jboss.mx.server.Invocation.dispatch(Invocation.java:96)
            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:668)
            at org.jboss.system.microcontainer.ServiceProxy.invoke(ServiceProxy.java:206)
            at $Proxy38.start(Unknown Source)
            at org.jboss.system.microcontainer.StartStopLifecycleAction.installAction(StartStopLifecycleAction.java:42)
            at org.jboss.system.microcontainer.StartStopLifecycleAction.installAction(StartStopLifecycleAction.java:37)
            at org.jboss.dependency.plugins.action.SimpleControllerContextAction.simpleInstallAction(SimpleControllerContextAction.java:62)
            at org.jboss.dependency.plugins.action.AccessControllerContextAction.install(AccessControllerContextAction.java:71)
            at org.jboss.dependency.plugins.AbstractControllerContextActions.install(AbstractControllerContextActions.java:51)
            at org.jboss.dependency.plugins.AbstractControllerContext.install(AbstractControllerContext.java:348)
            at org.jboss.system.microcontainer.ServiceControllerContext.install(ServiceControllerContext.java:286)
            at org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:1631)
            at org.jboss.dependency.plugins.AbstractController.incrementState(AbstractController.java:934)
            at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:1082)
            at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:984)
            at org.jboss.dependency.plugins.AbstractController.change(AbstractController.java:822)
            at org.jboss.dependency.plugins.AbstractController.change(AbstractController.java:553)
            at org.jboss.system.ServiceController.doChange(ServiceController.java:688)
            at org.jboss.system.ServiceController.start(ServiceController.java:460)
            at org.jboss.system.deployers.ServiceDeployer.start(ServiceDeployer.java:163)
            at org.jboss.system.deployers.ServiceDeployer.deploy(ServiceDeployer.java:99)
            at org.jboss.system.deployers.ServiceDeployer.deploy(ServiceDeployer.java:46)
            at org.jboss.deployers.spi.deployer.helpers.AbstractSimpleRealDeployer.internalDeploy(AbstractSimpleRealDeployer.java:62)
            at org.jboss.deployers.spi.deployer.helpers.AbstractRealDeployer.deploy(AbstractRealDeployer.java:50)
            at org.jboss.deployers.plugins.deployers.DeployerWrapper.deploy(DeployerWrapper.java:171)
            at org.jboss.deployers.plugins.deployers.DeployersImpl.doDeploy(DeployersImpl.java:1439)
            at org.jboss.deployers.plugins.deployers.DeployersImpl.doInstallParentFirst(DeployersImpl.java:1157)
            at org.jboss.deployers.plugins.deployers.DeployersImpl.doInstallParentFirst(DeployersImpl.java:1178)
            at org.jboss.deployers.plugins.deployers.DeployersImpl.doInstallParentFirst(DeployersImpl.java:1210)
            at org.jboss.deployers.plugins.deployers.DeployersImpl.install(DeployersImpl.java:1098)
            at org.jboss.dependency.plugins.AbstractControllerContext.install(AbstractControllerContext.java:348)
            at org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:1631)
            at org.jboss.dependency.plugins.AbstractController.incrementState(AbstractController.java:934)
            at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:1082)
            at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:984)
            at org.jboss.dependency.plugins.AbstractController.change(AbstractController.java:822)
            at org.jboss.dependency.plugins.AbstractController.change(AbstractController.java:553)
            at org.jboss.deployers.plugins.deployers.DeployersImpl.process(DeployersImpl.java:781)
            at org.jboss.deployers.plugins.main.MainDeployerImpl.process(MainDeployerImpl.java:702)
            at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:830)
            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:597)
            at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:157)
            at org.jboss.mx.server.Invocation.dispatch(Invocation.java:96)
            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:668)
            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:597)
            at org.jboss.jmx.connector.invoker.InvokerAdaptorService.invoke(InvokerAdaptorService.java:263)
            at sun.reflect.GeneratedMethodAccessor271.invoke(Unknown Source)
            at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
            at java.lang.reflect.Method.invoke(Method.java:597)
            at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:157)
            at org.jboss.mx.server.Invocation.dispatch(Invocation.java:96)
            at org.jboss.mx.interceptor.AbstractInterceptor.invoke(AbstractInterceptor.java:138)
            at org.jboss.mx.server.Invocation.invoke(Invocation.java:90)
            at org.jboss.mx.interceptor.ModelMBeanOperationInterceptor.invoke(ModelMBeanOperationInterceptor.java:140)
            at org.jboss.jmx.connector.invoker.SerializableInterceptor.invoke(SerializableInterceptor.java:74)
            at org.jboss.mx.server.Invocation.invoke(Invocation.java:90)
            at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
            at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:668)
            at org.jboss.invocation.jrmp.server.JRMPProxyFactory.invoke(JRMPProxyFactory.java:180)
            at sun.reflect.GeneratedMethodAccessor270.invoke(Unknown Source)
            at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
            at java.lang.reflect.Method.invoke(Method.java:597)
            at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:157)
            at org.jboss.mx.server.Invocation.dispatch(Invocation.java:96)
            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:668)
            at org.jboss.invocation.jrmp.server.JRMPInvoker$MBeanServerAction.invoke(JRMPInvoker.java:855)
            at org.jboss.invocation.jrmp.server.JRMPInvoker.invoke(JRMPInvoker.java:422)
            at sun.reflect.GeneratedMethodAccessor269.invoke(Unknown Source)
            at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
            at java.lang.reflect.Method.invoke(Method.java:597)
            at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:305)
            at sun.rmi.transport.Transport$1.run(Transport.java:159)
            at java.security.AccessController.doPrivileged(Native Method)
            at sun.rmi.transport.Transport.serviceCall(Transport.java:155)
            at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:535)
            at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(TCPTransport.java:790)
            at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:649)
            at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
            at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
            at java.lang.Thread.run(Thread.java:619)

             

            Any help?

            • 3. Re: JBOss5.1.0-GA WS endpoint generated with wsconsume does not deploy

              Hmm, seems to be OK.

              Could you, just for the test sake, use only impelentation class and give up the intervace? So far that I sole use it. Only simple POJOs.

              Just a brief observation, the interface (SDOCustomerInterfaces) is annotated with @WebService but the implementation (SDOCustomerInterfacesImpl) is mentioned in web.xml. Is it really how it was supposed to be?

              • 4. Re: JBOss5.1.0-GA WS endpoint generated with wsconsume does not deploy
                skymic

                It is correct that the web.xml always lists an Implementation of an interface and not the interface itself. JBoss tries to create an instance of the class

                mentioed in web.xml and this will not work with an interface. I have tried it and get a exception.

                 

                But I have found the solution. I still had a few older libraries for Sun's JWSDP included in my project. I removed those and then my WS endpoint was deployed OK.

                • 5. Re: JBOss5.1.0-GA WS endpoint generated with wsconsume does not deploy
                  blieb73

                  I was curious as to specifically what jars you ended up removing.  I'm having the same issue and cant seem to isolate the specific jars to remove.