4 Replies Latest reply on Jun 11, 2008 8:05 AM by maxandersen

    a problem when call web service using web service client

    grid.qian

      Hi guys,

      Now I focus on extending wtp web service framework to support JBoss WS. To do this task, we must firstly create a dynamic web project and then generate web service or web service client codes. So far I can create web service and web service client. For user's convenience I generate a client sample to call web service.

      Because I use the WTP dynamic project and jboss server, when the project is created, all the jars that are from jboss server lib folder and client folder are added to project classpath. When I run the web service client sample to call web service, a issue occurs.

      And after I google this issue, I found a same issue. I know the issue will be fixed by removing jaxws-rt.jar and jaxws-tools.jar from classpath. But this looks like jaxws in JBoss is "incomplete" or something, and I want to know why this issue occurs?

      the link:
      http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4063438#4063438

      the client sample codes:
      System.out.println("***********************");
      System.out.println("Create Web Service Client...");
      HelloWorldService service1 = new HelloWorldService();
      System.out.println("Create Web Service...");
      HelloWorld port1 = service1.getHelloWorldPort();
      System.out.println("Create Web Service Operation...");
      System.out.println("Server said: " + port1.sayHello());
      System.out.println("***********************");

      the issue:
      Exception in thread "main" javax.xml.ws.WebServiceException: Unable to load Provider: Failed to load javax.xml.ws.spi.Provider: com.sun.xml.ws.spi.ProviderImpl
      at javax.xml.ws.spi.Provider.provider(Provider.java:98)
      at javax.xml.ws.Service.(Service.java:83)
      at org.example.www.helloworld.HelloWorldService.(HelloWorldService.java:40)
      at org.example.www.helloworld.clientsample.ClientSample.main(ClientSample.java:10)
      Caused by: java.lang.IllegalStateException: Failed to load javax.xml.ws.spi.Provider: com.sun.xml.ws.spi.ProviderImpl
      at javax.xml.ws.spi.ProviderLoader.loadProvider(ProviderLoader.java:96)
      at javax.xml.ws.spi.Provider.provider(Provider.java:90)
      ... 3 more
      Caused by: 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:494)
      at java.lang.Class.newInstance0(Class.java:350)
      at java.lang.Class.newInstance(Class.java:303)
      at javax.xml.ws.spi.ProviderLoader.loadProvider(ProviderLoader.java:91)
      ... 4 more
      Caused by: javax.xml.ws.WebServiceException: Error creating JAXBContext for W3CEndpointReference.
      at com.sun.xml.ws.spi.ProviderImpl.getEPRJaxbContext(ProviderImpl.java:188)
      at com.sun.xml.ws.spi.ProviderImpl.(ProviderImpl.java:65)
      ... 11 more
      Caused by: com.sun.xml.bind.v2.runtime.IllegalAnnotationsException: 2 counts of IllegalAnnotationExceptions
      Two classes have the same XML type name "address". Use @XmlType.name and @XmlType.namespace to assign different names to them.
      this problem is related to the following location:
      at com.sun.xml.ws.developer.MemberSubmissionEndpointReference$Address
      at public com.sun.xml.ws.developer.MemberSubmissionEndpointReference$Address com.sun.xml.ws.developer.MemberSubmissionEndpointReference.addr
      at com.sun.xml.ws.developer.MemberSubmissionEndpointReference
      this problem is related to the following location:
      at javax.xml.ws.wsaddressing.W3CEndpointReference$Address
      at private javax.xml.ws.wsaddressing.W3CEndpointReference$Address javax.xml.ws.wsaddressing.W3CEndpointReference.address
      at javax.xml.ws.wsaddressing.W3CEndpointReference
      Two classes have the same XML type name "elements". Use @XmlType.name and @XmlType.namespace to assign different names to them.
      this problem is related to the following location:
      at com.sun.xml.ws.developer.MemberSubmissionEndpointReference$Elements
      at public com.sun.xml.ws.developer.MemberSubmissionEndpointReference$Elements com.sun.xml.ws.developer.MemberSubmissionEndpointReference.referenceProperties
      at com.sun.xml.ws.developer.MemberSubmissionEndpointReference
      this problem is related to the following location:
      at javax.xml.ws.wsaddressing.W3CEndpointReference$Elements
      at private javax.xml.ws.wsaddressing.W3CEndpointReference$Elements javax.xml.ws.wsaddressing.W3CEndpointReference.referenceParameters
      at javax.xml.ws.wsaddressing.W3CEndpointReference

      at com.sun.xml.bind.v2.runtime.IllegalAnnotationsException$Builder.check(IllegalAnnotationsException.java:102)
      at com.sun.xml.bind.v2.runtime.JAXBContextImpl.getTypeInfoSet(JAXBContextImpl.java:438)
      at com.sun.xml.bind.v2.runtime.JAXBContextImpl.(JAXBContextImpl.java:286)
      at com.sun.xml.bind.v2.ContextFactory.createContext(ContextFactory.java:139)
      at com.sun.xml.bind.v2.ContextFactory.createContext(ContextFactory.java:117)
      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 javax.xml.bind.ContextFinder.newInstance(ContextFinder.java:211)
      at javax.xml.bind.ContextFinder.find(ContextFinder.java:372)
      at javax.xml.bind.JAXBContext.newInstance(JAXBContext.java:574)
      at javax.xml.bind.JAXBContext.newInstance(JAXBContext.java:522)
      at com.sun.xml.ws.spi.ProviderImpl.getEPRJaxbContext(ProviderImpl.java:186)
      ... 12 more

      I'm looking foreward for your replies. Thanks in advance
      Grid