JBossWs 3.0.1 client IllegalAnnotationsException
gryffin May 14, 2008 11:44 AMI 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 Settings\tx714c\My Documents\workspace\EJB3 fun\gen\TimeServiceClient.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>(TimeService.java:42) [java] at com.boeing.nmt.client.timeservice.TimeServiceClient.main(TimeServiceClient.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(Native Method) [java] at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorIm pl.java:39) [java] at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAc cessorImpl.java:27) [java] at java.lang.reflect.Constructor.newInstance(Constructor.java:494) [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(ProviderImpl.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$Address [java] at public com.sun.xml.ws.developer.MemberSubmissionEndpointReference$Address com.sun.xml.ws.developer.MemberSubmissionEndpointReference.addr [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$Elements [java] at public com.sun.xml.ws.developer.MemberSubmissionEndpointReference$Element s com.sun.xml.ws.developer.MemberSubmissionEndpointReference.referenceProperties [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$Builder.check(IllegalAnno tationsException.java:102) [java] at com.sun.xml.bind.v2.runtime.JAXBContextImpl.getTypeInfoSet(JAXBContextImpl.java:4 38) [java] at com.sun.xml.bind.v2.runtime.JAXBContextImpl.<init>(JAXBContextImpl.java:286) [java] at com.sun.xml.bind.v2.ContextFactory.createContext(ContextFactory.java:139) [java] at com.sun.xml.bind.v2.ContextFactory.createContext(ContextFactory.java:117) [java] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [java] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) [java] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.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(ProviderImpl.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://127.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://127.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.xmlsoap.org/wsdl/' xmlns:ns1='http://foo' xmlns:soap='http://schemas.xmlsoap.org/wsdl/soap/' xmlns:tns='http://www.boeing.com/nmt/ejb3/TimeService' xmlns:xsd='http://www.w3.org/2001/XMLSchema'> <import location='http://127.0.0.1:8080/TimeService?wsdl&resource=TimeServiceEndpoint_PortType16997.wsdl' namespace='http://foo'></import> <service name='TimeService'> <port binding='ns1:TimeServiceEndpointBinding' name='TimeAgentPortBindingNamePort'> <soap:address location='http://127.0.0.1:8080/TimeService'/> </port> </service> </definitions>
imported wsdl:
<definitions name='TimeService' targetNamespace='http://foo' xmlns='http://schemas.xmlsoap.org/wsdl/' xmlns:ns1='http://foo' xmlns:soap='http://schemas.xmlsoap.org/wsdl/soap/' xmlns:tns='http://www.boeing.com/nmt/ejb3/TimeService' xmlns:xsd='http://www.w3.org/2001/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'></output> </operation> </portType> <binding name='TimeServiceEndpointBinding' type='ns1:TimeServiceEndpoint'> <soap:binding style='rpc' transport='http://schemas.xmlsoap.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>