JBoss 6.x throwing java.lang.ClassNotFoundException: com.sun.xml.internal.ws.spi.ProviderImpl

1k views Asked by At

In our application we make WSDL service call(let us say "SomeService"). We use JBoss 6.x and JDK1.8 in our environment(test). Our application also has dependency with CXF for some other services. "SomeService" should be called through standard JAXWS instead of "CXF". By default,c all is being routed through CXF and that's resulting into policy issues. Hence, I followed the solution mentioned below:

JAX-WS = When Apache CXF is installed it "steals" default JDK JAX-WS implementation, how to solve? .

I made the following change in my code:

if (previousDelegate.getClass().getName().contains("cxf")) {
         ServiceDelegate serviceDelegate = ((Provider)    Class.forName("com.sun.xml.internal.ws.spi.ProviderImpl").newInstance())
          .createServiceDelegate(SomeService.WSDL_LOCATION,    SomeService.SERVICE_NAME, service.getClass());

         delegateField.set(service, serviceDelegate);
}

This change works fine for me in my local environment(I'm using Tomcat 8 +JDK 1.8). I went and deployed the code in test platform (it's JBoss 6.x + JDK 1.8). While testing the functionality, I'm getting the following error:

java.lang.ClassNotFoundException: com.sun.xml.internal.ws.spi.ProviderImpl from [Module "deployment.MyAPP.war:main" from Service Module Loader]

Not sure of the reason for this error. Anybody has clues about it? Do we need to make any additional changes in our JBoss server. Since "com.sun.xml.internal.ws.spi.ProviderImpl" is standard class and that's available in JDK1.8, I don't see any reason why am I getting the above error since our JBoss server is pointing to JDK1.8.

Your help is highly appreciated.

1

There are 1 answers

0
Anup Dey On
  • It looks like a classloading issue with your application, or the application server.

  • The ClassNotFoundException will occur the first time the class is referenced and the classloader tries to load it. The next time the class is referenced, the classloader has cached that is is not found and will throw a NoClassDefFoundError.

  • Confirm that the ClassNotFoundException is not being caused by the class not being packaged correctly or other classloader settings. Also, ensure the ClassNotFoundException is not occurring the first time the class is referenced.

  • Check to see if there are any symlinks in the JBoss path. That will tell us the classes you have deployed to your application, and allow us check if com.sun.xml.internal.ws.spi.ProviderImpl or a related class is deployed to it. That class is shipped with the application server in this directory, and I think this should be the only location it is loaded from.

    src/jboss-as/thirdparty/sun-jaxws/lib/jaxws-rt.jar

  • The only reference I can find to the message "classLoader is not connected to a domain (probably undeployed?) for class "

  • If you are using a custom JAX-WS implementation and don't want to use JBossWS CXF (the supported JAX-WS library that comes with EAP 6.x), you'll need to first remove JBossWS from your deployment

  • Once you've done that, you then need to expose the JDK classes that represent the JAX-WS and SAAJ implementation.

  • Make sure you add modules dependencies for sun.internal.saaj and sun.internal.ws to your deployment.

--

Anup