8 Replies Latest reply on Oct 14, 2009 10:42 AM by Carlos Eduardo Dantas

    JBOSS-5.1.0.GA web service client doesn't work ( runtime mod

    Hardik Mehta Newbie

      I have a simple hello-world EJB3 successfully deployed as web service. I can check it with url: http://localhost:8080/jbossws/services


      Following is the client which works for Glassfish but doesn't work for JBOSS

      package com.hardik.mejb;
      
      import java.net.MalformedURLException;
      import java.net.URL;
      import javax.xml.namespace.QName;
      import javax.xml.ws.Service;
      
      public class JAXWSClient {
      
       private static String host = "localhost";
       private static String portType = "HelloBean";
       private static String serviceName = "Greeter";
       private static String serviceName_jboss = "hello-ws-hello-ws";
      
       // works for glassfish
       // private static String serviceEndpointAddress = "http://"+ host+ ":8080/" + serviceName;
      
       // should work for jboss
       private static String serviceEndpointAddress = "http://"+ host+ ":8080/" + serviceName_jboss;
      
       private static String namespace = "http://mejb.hardik.com/";
      
       public static void main(String[] args) {
      
       URL wsdlLocation = null;
       try {
       String urlstr = serviceEndpointAddress + "/" + portType + "?WSDL";
       System.out.println(urlstr);
       wsdlLocation = new URL(urlstr);
       } catch (MalformedURLException e) {
       // TODO Auto-generated catch block
       e.printStackTrace();
       }
      
       QName serviceNameQ = new QName(namespace,serviceName);
       // dynamic service usage
       Service service = Service.create(wsdlLocation, serviceNameQ);
       Hello firstGreeterPort = service.getPort(Hello.class);
      
       // Object beans[] = service.getPorts();
       System.out.println("1: "+ firstGreeterPort.hello());
       }
      }
      


      Here is how I execute the client and the error I get:

      wsrunclient.sh -cp "lib/*:dist/hello-client.jar:jboss-generated/*" com.hardik.mejb.JAXWSClient
      http://localhost:8080/hello-ws-hello-ws/HelloBean?WSDL
      Exception in thread "main" com.sun.xml.internal.ws.model.RuntimeModelerException: runtime modeler error: Wrapper class com.hardik.mejb.jaxws.Hello is not found. Have you run APT to generate them?
       at com.sun.xml.internal.ws.model.RuntimeModeler.getClass(RuntimeModeler.java:256)
       at com.sun.xml.internal.ws.model.RuntimeModeler.processDocWrappedMethod(RuntimeModeler.java:567)
       at com.sun.xml.internal.ws.model.RuntimeModeler.processMethod(RuntimeModeler.java:514)
       at com.sun.xml.internal.ws.model.RuntimeModeler.processClass(RuntimeModeler.java:341)
       at com.sun.xml.internal.ws.model.RuntimeModeler.buildRuntimeModel(RuntimeModeler.java:227)
       at com.sun.xml.internal.ws.client.WSServiceDelegate.addSEI(WSServiceDelegate.java:588)
       at com.sun.xml.internal.ws.client.WSServiceDelegate.getPort(WSServiceDelegate.java:291)
       at com.sun.xml.internal.ws.client.WSServiceDelegate.getPort(WSServiceDelegate.java:274)
       at com.sun.xml.internal.ws.client.WSServiceDelegate.getPort(WSServiceDelegate.java:302)
       at com.sun.xml.internal.ws.client.WSServiceDelegate.getPort(WSServiceDelegate.java:306)
       at javax.xml.ws.Service.getPort(Service.java:161)
       at com.hardik.mejb.JAXWSClient.main(Unknown Source)
      


      Do I need to generate something ? Am I missing some jar file(s) ?

        • 1. Re: JBOSS-5.1.0.GA web service client doesn't work ( runtime
          Chuck Johnson Newbie


          Not sure if this is the problem, but are you running JBoss native stack ver 3.1.2 GA?. That is the only native WS stack that is supported under 5.1.0 GA. See the following link: http://jbossws.jboss.org/mediawiki/index.php?title=Supported_Target_Containers

          CJ

          • 2. Re: JBOSS-5.1.0.GA web service client doesn't work ( runtime
            Hardik Mehta Newbie

            Hi,
            I think I am running the native stack 3.1.2 GA

            I see following in my server.log file...

            2009-06-25 11:22:19,559 INFO [org.jboss.web.WebService] (main) Using RMI server codebase: http://127.0.0.1:8083/
            2009-06-25 11:22:24,783 INFO [org.jboss.wsf.stack.jbws.NativeServerConfig] (main) JBoss Web Services - Stack Native Core
            2009-06-25 11:22:24,783 INFO [org.jboss.wsf.stack.jbws.NativeServerConfig] (main) 3.1.2.GA
            


            • 3. Re: JBOSS-5.1.0.GA web service client doesn't work ( runtime
              Richard Opalka Master

               

              "rangalo" wrote:

              wsrunclient.sh -cp "lib/*:dist/hello-client.jar:jboss-generated/*" com.hardik.mejb.JAXWSClient
              http://localhost:8080/hello-ws-hello-ws/HelloBean?WSDL
              

              lib/*: is invalid. This will be the reason of your problems.

              • 4. Re: JBOSS-5.1.0.GA web service client doesn't work ( runtime
                Hardik Mehta Newbie

                Thanks,

                Now I have at least some other error !

                If I use only lib I get this error, I think it is related to stax implementation.


                Am I missing some jar?

                [hardik@antariksh: HelloWsClient]$ wsrunclient.sh -cp "dist/hello-client.jar:jboss-generated:lib" com.hardik.mejb.JAXWSClient
                http://localhost:8080/Greeter/HelloBean?WSDL
                Exception in thread "main" java.lang.ExceptionInInitializerError
                 at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
                 at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
                 at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
                 at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
                 at java.lang.Class.newInstance0(Class.java:355)
                 at java.lang.Class.newInstance(Class.java:308)
                 at javax.xml.ws.spi.FactoryFinder.newInstance(FactoryFinder.java:31)
                 at javax.xml.ws.spi.FactoryFinder.find(FactoryFinder.java:128)
                 at javax.xml.ws.spi.Provider.provider(Provider.java:83)
                 at javax.xml.ws.Service.<init>(Service.java:56)
                 at com.hardik.mejb.Greeter.<init>(Greeter.java:45)
                 at com.hardik.mejb.JAXWSClient.main(Unknown Source)
                Caused by: javax.xml.ws.WebServiceException: Error creating JAXBContext for W3CEndpointReference.
                 at com.sun.xml.internal.ws.spi.ProviderImpl$2.run(ProviderImpl.java:201)
                 at com.sun.xml.internal.ws.spi.ProviderImpl$2.run(ProviderImpl.java:196)
                 at java.security.AccessController.doPrivileged(Native Method)
                 at com.sun.xml.internal.ws.spi.ProviderImpl.getEPRJaxbContext(ProviderImpl.java:196)
                 at com.sun.xml.internal.ws.spi.ProviderImpl.<clinit>(ProviderImpl.java:67)
                 ... 12 more
                Caused by: javax.xml.bind.JAXBException: Provider com.sun.xml.bind.v2.ContextFactory not found
                 - with linked exception:
                [java.security.PrivilegedActionException: java.lang.ClassNotFoundException: com.sun.xml.bind.v2.ContextFactory]
                 at javax.xml.bind.ContextFinder.loadClass(ContextFinder.java:192)
                 at javax.xml.bind.ContextFinder.newInstance(ContextFinder.java:205)
                 at javax.xml.bind.ContextFinder.find(ContextFinder.java:388)
                 at javax.xml.bind.JAXBContext.newInstance(JAXBContext.java:574)
                 at javax.xml.bind.JAXBContext.newInstance(JAXBContext.java:522)
                 at com.sun.xml.internal.ws.spi.ProviderImpl$2.run(ProviderImpl.java:199)
                 ... 16 more
                Caused by: java.security.PrivilegedActionException: java.lang.ClassNotFoundException: com.sun.xml.bind.v2.ContextFactory
                 at java.security.AccessController.doPrivileged(Native Method)
                 at javax.xml.bind.ContextFinder.loadClass(ContextFinder.java:175)
                 ... 21 more
                Caused by: java.lang.ClassNotFoundException: com.sun.xml.bind.v2.ContextFactory
                 at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
                 at java.security.AccessController.doPrivileged(Native Method)
                 at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
                 at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
                 at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
                 at java.lang.ClassLoader.loadClass(ClassLoader.java:252)
                 at javax.xml.bind.ContextFinder$1.run(ContextFinder.java:180)
                 at javax.xml.bind.ContextFinder$1.run(ContextFinder.java:176)
                 ... 23 more
                




                • 5. Re: JBOSS-5.1.0.GA web service client doesn't work ( runtime
                  Hardik Mehta Newbie

                  This was indeed a missing jars in classpath problem.

                  I had to add following to the classpath:

                  $ echo $CLASSPATH
                  jboss_libs/jboss-common-core.jar:jboss_libs/jbossall-client.jar:jboss_libs/jbossws-spi.jar:jboss_libs/jbossws-native-core.jar:jboss_libs/jbossws-native-client.jar::jboss_libs/jaxb-impl.jar:jboss_libs/jboss-xml-binding.jar:jboss_libs/stax-api.jar:jboss_libs/wstx.jar:jboss_libs/jboss-logging-jdk.jar:jboss_libs/jboss-logging-spi.jar:jboss_libs/jbossws-common.jar:jboss_libs/wsdl4j.jar:jboss_libs/mail.jar:jboss_libs/policy.jar:jboss_libs/commons-logging.jar:jboss_libs/javassist.jar:jboss_libs/jboss-remoting.jar
                  


                  All these libs were from jboss/client

                  But after the client started working, I had following exception in server.log.

                  3:29:21,925 ERROR [[HelloBean]] Servlet.service() for servlet HelloBean threw exception
                  java.lang.UnsupportedOperationException: setProperty must be overridden by all subclasses of SOAPMessage
                   at javax.xml.soap.SOAPMessage.setProperty(SOAPMessage.java:441)
                   at org.jboss.ws.core.soap.SOAPMessageImpl.<init>(SOAPMessageImpl.java:87)
                   at org.jboss.ws.core.soap.MessageFactoryImpl.createMessage(MessageFactoryImpl.java:169)
                   at org.jboss.ws.core.jaxws.SOAPFaultHelperJAXWS.createSOAPMessage(SOAPFaultHelperJAXWS.java:295)
                   at org.jboss.ws.core.jaxws.SOAPFaultHelperJAXWS.toSOAPMessage(SOAPFaultHelperJAXWS.java:256)
                   at org.jboss.ws.core.jaxws.SOAPFaultHelperJAXWS.exceptionToFaultMessage(SOAPFaultHelperJAXWS.java:187)
                   at org.jboss.ws.core.jaxws.binding.SOAP11BindingJAXWS.createFaultMessageFromException(SOAP11BindingJAXWS.java:102)
                   at org.jboss.ws.core.CommonSOAPBinding.bindFaultMessage(CommonSOAPBinding.java:671)
                   at org.jboss.wsf.stack.jbws.RequestHandlerImpl.processRequest(RequestHandlerImpl.java:496)
                   at org.jboss.wsf.stack.jbws.RequestHandlerImpl.handleRequest(RequestHandlerImpl.java:295)
                   at org.jboss.wsf.stack.jbws.RequestHandlerImpl.doPost(RequestHandlerImpl.java:205)
                   at org.jboss.wsf.stack.jbws.RequestHandlerImpl.handleHttpRequest(RequestHandlerImpl.java:131)
                   at org.jboss.wsf.common.servlet.AbstractEndpointServlet.service(AbstractEndpointServlet.java:85)
                   at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
                   at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
                   at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
                   at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
                   at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
                   at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
                   at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:235)
                   at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
                   at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:190)
                   at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:92)
                   at org.jboss.web.tomcat.security.SecurityContextEstablishmentValve.process(SecurityContextEstablishmentValve.java:126)
                   at org.jboss.web.tomcat.security.SecurityContextEstablishmentValve.invoke(SecurityContextEstablishmentValve.java:70)
                   at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
                   at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
                   at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:158)
                   at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
                   at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:330)
                   at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:829)
                   at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:598)
                   at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
                   at java.lang.Thread.run(Thread.java:619)
                  
                  



                  On client side it looks like following:
                  $ wsrunclient.sh -cp "dist/hello-client.jar:jboss-generated:lib:$CLASSPATH" com.hardik.mejb.JAXWSClient
                  http://localhost:8080/hello-ws-hello-ws/HelloBean?WSDL
                  [Fatal Error] :-1:-1: Premature end of file.
                  2: null
                  


                  I installed JBOSS from jboss-5.1.0.GA-jdk6.zip file.

                  thanks & regards.

                  • 8. Re: JBOSS-5.1.0.GA web service client doesn't work ( runtime
                    Carlos Eduardo Dantas Newbie

                    this link

                    https://jira.jboss.org/jira/browse/JBWS-2649


                    says


                    "The problem is simply that you can't mix the jbossws saaj implementation and the Sun's one. Please follow the installation instructions for using JDK6 (putting jbossws libraries in endorsed lib dir) and this exception should not happen."

                    but in JBoss 5.1.0 GA for JDK 6 has already native-saaj links on endorsed lib dir