I used the wsconsume ant task to build a client for a simple
web service designed to return the current time as a string.
I built the service as an EJB3 with an endpoint, and it
published fine on JBoss 4.2.2.
The client built by jbossws however throws a fit before
calling the service.
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.
Looking at the code, there is not XML 'type name' of
'address'. I think that the JBossWS stack is a little
unclear in describing the problem. I had this issue before,
unsolved, and I have all of the JBoss endorsed libraries
included in the classpath.
Can someone tell me what field needs to be annotated
please?
full error:
| run-ts-client:
| [echo] Running timeservice client: C:Documents and
Settingstx714cMy DocumentsworkspaceEJB3
| fungenTimeServiceClient.jar
| [java] Exception in thread "main"
javax.xml.ws.WebServiceException: Unable to load Provider:
Fa
| iled to load javax.xml.ws.spi.Provider:
com.sun.xml.ws.spi.ProviderImpl
| [java] at
javax.xml.ws.spi.Provider.provider(Provider.java:90)
| [java] at
javax.xml.ws.Service.<init>(Service.java:81)
| [java] at
com.boeing.nmt.client.timeservice.TimeService.<init>(T
imeService.java:42)
| [java] at
com.boeing.nmt.client.timeservice.TimeServiceClient.main(Tim
eServiceClient.java:1
| 1)
| [java] Caused by: java.lang.IllegalStateException:
Failed to load javax.xml.ws.spi.Provider: co
| m.sun.xml.ws.spi.ProviderImpl
| [java] at
javax.xml.ws.spi.ProviderLoader.loadProvider(ProviderLoader.
java:96)
| [java] at
javax.xml.ws.spi.Provider.provider(Provider.java:82)
| [java] ... 3 more
| [java] Caused by:
java.lang.ExceptionInInitializerError
| [java] at
sun.reflect.NativeConstructorAccessorImpl.newInstance0(Nativ
e Method)
| [java] at
sun.reflect.NativeConstructorAccessorImpl.newInstance(Native
ConstructorAccessorIm
| pl.java:39)
| [java] at
sun.reflect.DelegatingConstructorAccessorImpl.newInstance(De
legatingConstructorAc
| cessorImpl.java:27)
| [java] at
java.lang.reflect.Constructor.newInstance(Constructor.java:4
94)
| [java] at
java.lang.Class.newInstance0(Class.java:350)
| [java] at
java.lang.Class.newInstance(Class.java:303)
| [java] at
javax.xml.ws.spi.ProviderLoader.loadProvider(ProviderLoader.
java:91)
| [java] ... 4 more
| [java] Caused by: javax.xml.ws.WebServiceException:
Error creating JAXBContext for W3CEndpointR
| eference.
| [java] at
com.sun.xml.ws.spi.ProviderImpl.getEPRJaxbContext(ProviderIm
pl.java:188)
| [java] at
com.sun.xml.ws.spi.ProviderImpl.<clinit>(ProviderImpl.
java:65)
| [java] ... 11 more
| [java] Caused by:
com.sun.xml.bind.v2.runtime.IllegalAnnotationsException: 2
counts of IllegalA
| nnotationExceptions
| [java] Two classes have the same XML type name
"address". Use XmlType.name and XmlType.namesp
| ace to assign different names to them.
| [java] this problem is related to the following
location:
| [java] at
com.sun.xml.ws.developer.MemberSubmissionEndpointReference$A
ddress
| [java] at public
com.sun.xml.ws.developer.MemberSubmissionEndpointReference$A
ddress
|
com.sun.xml.ws.developer.MemberSubmissionEndpointReference.a
ddr
| [java] at
com.sun.xml.ws.developer.MemberSubmissionEndpointReference
| [java] this problem is related to the following
location:
| [java] at
javax.xml.ws.wsaddressing.W3CEndpointReference$Address
| [java] at private
javax.xml.ws.wsaddressing.W3CEndpointReference$Address
javax.xml.
| ws.wsaddressing.W3CEndpointReference.address
| [java] at
javax.xml.ws.wsaddressing.W3CEndpointReference
| [java] Two classes have the same XML type name
"elements". Use XmlType.name and XmlType.names
| pace to assign different names to them.
| [java] this problem is related to the following
location:
| [java] at
com.sun.xml.ws.developer.MemberSubmissionEndpointReference$E
lements
| [java] at public
com.sun.xml.ws.developer.MemberSubmissionEndpointReference$E
lement
| s
com.sun.xml.ws.developer.MemberSubmissionEndpointReference.r
eferenceProperties
| [java] at
com.sun.xml.ws.developer.MemberSubmissionEndpointReference
| [java] this problem is related to the following
location:
| [java] at
javax.xml.ws.wsaddressing.W3CEndpointReference$Elements
| [java] at private
javax.xml.ws.wsaddressing.W3CEndpointReference$Elements
javax.xml
|
.ws.wsaddressing.W3CEndpointReference.referenceParameters
| [java] at
javax.xml.ws.wsaddressing.W3CEndpointReference
| [java]
| [java] at
com.sun.xml.bind.v2.runtime.IllegalAnnotationsException$Buil
der.check(IllegalAnno
| tationsException.java:102)
| [java] at
com.sun.xml.bind.v2.runtime.JAXBContextImpl.getTypeInfoSet(J
AXBContextImpl.java:4
| 38)
| [java] at
com.sun.xml.bind.v2.runtime.JAXBContextImpl.<init>(JAX
BContextImpl.java:286)
| [java] at
com.sun.xml.bind.v2.ContextFactory.createContext(ContextFact
ory.java:139)
| [java] at
com.sun.xml.bind.v2.ContextFactory.createContext(ContextFact
ory.java:117)
| [java] at
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
| [java] at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAcce
ssorImpl.java:39)
| [java] at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMe
thodAccessorImpl.java
| :25)
| [java] at
java.lang.reflect.Method.invoke(Method.java:585)
| [java] at
javax.xml.bind.ContextFinder.newInstance(ContextFinder.java:
211)
| [java] at
javax.xml.bind.ContextFinder.find(ContextFinder.java:372)
| [java] at
javax.xml.bind.JAXBContext.newInstance(JAXBContext.java:574)
| [java] at
javax.xml.bind.JAXBContext.newInstance(JAXBContext.java:522)
| [java] at
com.sun.xml.ws.spi.ProviderImpl.getEPRJaxbContext(ProviderIm
pl.java:186)
| [java] ... 12 more
| [java] Java Result: 1
|
service class
|
| package com.boeing.nmt.client.timeservice;
|
| import java.net.MalformedURLException;
| import java.net.URL;
| import javax.xml.namespace.QName;
| import javax.xml.ws.Service;
| import javax.xml.ws.WebEndpoint;
| import javax.xml.ws.WebServiceClient;
|
|
| /**
| * This class was generated by the JAX-WS RI.
| * JAX-WS RI 2.1.1-b03-
| * Generated source version: 2.0
| *
| */
| WebServiceClient(name = "TimeService",
| targetNamespace = "http
://www.boeing.com/nmt/ejb3/TimeService",
| wsdlLocation = "http://1
27.0.0.1:8080/TimeService?wsdl")
| public class TimeService
| extends Service
| {
|
| private final static URL TIMESERVICE_WSDL_LOCATION;
|
| static {
| URL url = null;
| try {
| url = new URL("http://1
27.0.0.1:8080/TimeService?wsdl");
| } catch (MalformedURLException e) {
| e.printStackTrace();
| }
| TIMESERVICE_WSDL_LOCATION = url;
| }
|
| public TimeService(URL wsdlLocation, QName
serviceName) {
| super(wsdlLocation, serviceName);
| }
|
| public TimeService() {
| super(TIMESERVICE_WSDL_LOCATION, new
QName("http
://www.boeing.com/nmt/ejb3/TimeService",
"TimeService"));
| }
|
| /**
| *
| * return
| * returns TimeServiceEndpoint
| */
| WebEndpoint(name =
"TimeAgentPortBindingNamePort")
| public TimeServiceEndpoint
getTimeAgentPortBindingNamePort() {
| return (TimeServiceEndpoint)super.getPort(new
QName("http
://www.boeing.com/nmt/ejb3/TimeService",
"TimeAgentPortBindingNamePort"),
TimeServiceEndpoint.class);
| }
|
| }
|
endpoint
|
| package com.boeing.nmt.client.timeservice;
|
| import javax.jws.WebMethod;
| import javax.jws.WebResult;
| import javax.jws.WebService;
| import javax.jws.soap.SOAPBinding;
|
|
| /**
| * This class was generated by the JAX-WS RI.
| * JAX-WS RI 2.1.1-b03-
| * Generated source version: 2.0
| *
| */
| WebService()//name = "TimeServiceEndpoint",
targetNamespace = "http://foo")
| SOAPBinding(style = SOAPBinding.Style.RPC)
| public interface TimeServiceEndpoint {
|
|
| /**
| *
| * return
| * returns java.lang.String
| */
| WebMethod
| WebResult(partName = "return")
| public String getTime();
|
| }
|
wsdl:
<definitions name='TimeService' targetNamespace='http://www
.boeing.com/nmt/ejb3/TimeService' xmlns='http://schemas.xmlso
ap.org/wsdl/' xmlns:ns1='http://foo' xmlns:soap='http://schemas.
xmlsoap.org/wsdl/soap/' xmlns:tns='http://www
.boeing.com/nmt/ejb3/TimeService' xmlns sd='<
a
href="http://www.w3.org/2001/XMLSchema">http://www.w3.org/20
01/XMLSchema'>
| <import location='http://127.0.0.1:8080/
TimeService?wsdl&resource=TimeServiceEndpoint_PortType16
997.wsdl' namespace='http://foo'></import>
| <service name='TimeService'>
| <port binding='ns1:TimeServiceEndpointBinding'
name='TimeAgentPortBindingNamePort'>
| <soap:address location='http://127.0.0.1:80
80/TimeService'/>
| </port>
| </service>
| </definitions>
imported wsdl:
<definitions name='TimeService' targetNamespace='http://foo' xmlns='http://schemas.xmlso
ap.org/wsdl/' xmlns:ns1='http://foo' xmlns:soap='http://schemas.
xmlsoap.org/wsdl/soap/' xmlns:tns='http://www
.boeing.com/nmt/ejb3/TimeService' xmlns sd='<
a
href="http://www.w3.org/2001/XMLSchema">http://www.w3.org/20
01/XMLSchema'>
| <types></types>
| <message
name='TimeServiceEndpoint_getTime'></message>
| <message
name='TimeServiceEndpoint_getTimeResponse'>
| <part name='return'
type='xsd:string'></part>
| </message>
| <portType name='TimeServiceEndpoint'>
| <operation name='getTime'>
| <input
message='ns1:TimeServiceEndpoint_getTime'></input>
|
| <output
message='ns1:TimeServiceEndpoint_getTimeResponse'></ou
tput>
| </operation>
| </portType>
| <binding name='TimeServiceEndpointBinding'
type='ns1:TimeServiceEndpoint'>
| <soap:binding style='rpc' transport='http://schemas.x
mlsoap.org/soap/http'/>
| <operation name='getTime'>
| <soap:operation soapAction=''/>
| <input>
| <soap:body namespace='http://www
.boeing.com/nmt/ejb3/TimeService' use='literal'/>
|
| </input>
| <output>
| <soap:body namespace='http://www
.boeing.com/nmt/ejb3/TimeService' use='literal'/>
| </output>
| </operation>
| </binding>
| </definitions>
View the original post : http://www.jboss.com/index.html?
module=bb&op=viewtopic&p=4150797#4150797
Reply to the post : http://www.jboss.com/index.
html?module=bb&op=posting&mode=reply&p=4150797
a>
_______________________________________________
jbossws-users mailing list
jbossws-users lists.jboss.org
https://lists.jboss.org/mailman/listinfo/jbossws-users
|