Unable to load Provider
burakbayramli Nov 20, 2007 7:17 AMI have problems running the sample Web Service shown in Quick Start document.
I am able to deploy the Web Service, no problem, I see it running at http://localhost:8080/jbossws/services. Then, I generate stubs using wsconsume. I place the generated code to a different package called org.bilgidata.kitapdemo.service.ws.
I am on JBoss 4.2.1.GA and jbossws-2.0.
I used the following code:
import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlType; import org.bilgidata.kitapdemo.pojo.Car; @XmlAccessorType(XmlAccessType.FIELD) @XmlType( name = "discountRequest", namespace="http://org.bilgidata.kitapdemo.service", propOrder = { "car" } ) public class DiscountRequest { public DiscountRequest() { } public DiscountRequest(Car car) { this.car = car; } protected Car car; public Car getCar() { return car; } public void setCar(Car value) { this.car = value; } }
@Stateless @WebService( name="ProfileMgmt", targetNamespace = "http://org.bilgidata.kitapdemo.service", serviceName = "ProfileMgmtService" ) @SOAPBinding(parameterStyle = SOAPBinding.ParameterStyle.BARE) public class ProfileMgmtBean { @WebMethod public String getCustomerDiscount(DiscountRequest request) { return "--"; } }
import org.bilgidata.kitapdemo.service.ws.*; public class Mainline { public static void main(String[] args) throws Exception { ProfileMgmtService profileMgmt = new ProfileMgmtService(); String s = profileMgmt.getCustomerDiscount(new DiscountRequest()); } }
The error I get is:
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.<init>(Service.java:83) at javax.xml.ws.Service.create(Service.java:721) at org.bilgidata.kitapdemo.service.Mainline.main(Mainline.java:28) 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.<clinit>(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.<init>(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
<definitions name='ProfileMgmtService' targetNamespace='http://org.bilgidata.kitapdemo.service' xmlns='http://schemas.xmlsoap.org/wsdl/' xmlns:soap='http://schemas.xmlsoap.org/wsdl/soap/' xmlns:tns='http://org.bilgidata.kitapdemo.service' xmlns:xsd='http://www.w3.org/2001/XMLSchema'> <types> <xs:schema targetNamespace='http://org.bilgidata.kitapdemo.service' version='1.0' xmlns:tns='http://org.bilgidata.kitapdemo.service' xmlns:xs='http://www.w3.org/2001/XMLSchema'> <xs:element name='getCustomerDiscount' nillable='true' type='tns:discountRequest'/> <xs:element name='getCustomerDiscountResponse' nillable='true' type='xs:string'/> <xs:complexType name='discountRequest'> <xs:sequence> <xs:element minOccurs='0' name='car' type='tns:car'/> </xs:sequence> </xs:complexType> <xs:complexType name='car'> <xs:sequence> <xs:element minOccurs='0' name='description' type='xs:string'/> <xs:element minOccurs='0' name='garage' type='tns:garage'/> <xs:element minOccurs='0' name='licensePlate' type='xs:string'/> </xs:sequence> </xs:complexType> <xs:complexType name='garage'> <xs:sequence> <xs:element maxOccurs='unbounded' minOccurs='0' name='cars' nillable='true' type='tns:car'/> <xs:element minOccurs='0' name='description' type='xs:string'/> <xs:element minOccurs='0' name='garageId' type='xs:int'/> </xs:sequence> </xs:complexType> </xs:schema> </types> <message name='ProfileMgmt_getCustomerDiscountResponse'> <part element='tns:getCustomerDiscountResponse' name='getCustomerDiscountResponse'></part> </message> <message name='ProfileMgmt_getCustomerDiscount'> <part element='tns:getCustomerDiscount' name='getCustomerDiscount'></part> </message> <portType name='ProfileMgmt'> <operation name='getCustomerDiscount' parameterOrder='getCustomerDiscount'> <input message='tns:ProfileMgmt_getCustomerDiscount'></input> <output message='tns:ProfileMgmt_getCustomerDiscountResponse'></output> </operation> </portType> <binding name='ProfileMgmtBinding' type='tns:ProfileMgmt'> <soap:binding style='document' transport='http://schemas.xmlsoap.org/soap/http'/> <operation name='getCustomerDiscount'> <soap:operation soapAction=''/> <input> <soap:body use='literal'/> </input> <output> <soap:body use='literal'/> </output> </operation> </binding> <service name='ProfileMgmtService'> <port binding='tns:ProfileMgmtBinding' name='ProfileMgmtPort'> <soap:address location='http://127.0.0.1:8080/gittigidiyor-gittigidiyor/ProfileMgmtBean'/> </port> </service> </definitions>
Any help would be greatly appreciated.
Thanks!