JAXWS Client ServiceConfigurationError on weblogic

5.5k views Asked by At

I have created a client to connect to external webservice. This was done by using wsimport to generate the artifacts and then copied the java classes in my existing web application. I have tomcat on my workstation and this projects deploys and functions perfectly in this environment. But as soon as I deploy the same to weblogic servers I get the below error. Can you please help me understand the problem and its potential solution.

java.util.ServiceConfigurationError: javax.xml.ws.spi.Provider: Provider weblogic.wsee.jaxws.spi.WLSProvider could not be instantiated: java.lang.ClassCastException 
at java.util.ServiceLoader.fail(ServiceLoader.java:207) 
at java.util.ServiceLoader.access$100(ServiceLoader.java:164) 
at java.util.ServiceLoader$LazyIterator.next(ServiceLoader.java:353) 
at java.util.ServiceLoader$1.next(ServiceLoader.java:421) 
at javax.xml.ws.spi.Provider.getProviderUsingServiceLoader(Provider.java:180) 
at javax.xml.ws.spi.Provider.provider(Provider.java:140) 
at javax.xml.ws.Service.<init>(Service.java:92) 

Thanks in advance!

2

There are 2 answers

0
A. Schoinas On

In my case importing jaxb - api did the trick

    <dependency>
        <groupId>javax.xml.bind</groupId>
        <artifactId>jaxb-api</artifactId>
        <version>...</version>
    </dependency>
0
David García On

I changed the version of jaxws-api.jar library and it worked. I was using 2.2.5 and I changed it to 2.1-1 version and it worked for me.

Also, in the META-INF/weblogic-application.xml of your EAR, put

<?xml version="1.0" encoding="UTF-8"?> <weblogic-application xmlns="http://www.bea.com/ns/weblogic/90">
<application-param>
    <param-name>webapp.encoding.default</param-name>
    <param-value>UTF-8</param-value>
</application-param>
<prefer-application-packages>
    <package-name>org.springframework.*</package-name>
    <package-name>javax.jws.*</package-name>
    <package-name>javax.wsdl.*</package-name>
    <package-name>com.ctc.wstx.*</package-name>
    <package-name>javax.xml.ws.*</package-name>
    <package-name>com.sun.xml.messaging.saaj.*</package-name>
</prefer-application-packages>