Skip to main content

Classloading issue with Metro client in WebLogic 12c

Please note these java.net forums are being decommissioned and use the new and improved forums at https://community.oracle.com/community/java.
1 reply [Last post]
basca_schiphol
Offline
Joined: 2010-04-29

I deployed my EAR with Metro in WebLogic 12c as described in the user
guide

http://metro.java.net/guide/ch02.html#weblogic-10

My web services work fine, but I can't make any calls to remote web
services with the Metro client. Do you have any suggestions how to make
the Metro client work with my setup? Thanks a lot for your help!!

Versions used
============
WebLogic Server 12.1.1.0
Java(TM) SE Runtime Environment (build 1.7.0_04-b20)

Setup
=====
Initialize a web service stub from a stateless session bean (SLSB):

MyService service = new MyService(new URL(serviceWsdlUri), new
QName("http://my.namespace.xyz", "MyService"));

The SLSB is packaged in an EJB JAR. My EAR is structured as follows:

APP-INF\classes
APP-INF\lib\commons-codec-1.4.jar
APP-INF\lib\commons-lang-2.5.jar
APP-INF\lib\stax-api-1.0.1.jar
APP-INF\lib\webservices-api-2.2.0-1.jar
APP-INF\lib\webservices-extra-2.2.0-1.jar
APP-INF\lib\webservices-extra-api-2.2.0-1.jar
APP-INF\lib\webservices-rt-2.2.0-1.jar
APP-INF\lib\webservices-tools-2.2.0-1.jar

META-INF\application.xml
META-INF\MANIFEST.MF
META-INF\weblogic-application.xml

activation-1.1.jar
beanutils-1.6.1-20070314.jar
javax.annotation-3.1.1-b06.jar
logging-api-1.0.4.jar
modeler-1.1.jar
my-ejb.jar
my-web.war
my-ws.war

Steps to reproduce
===============
1) When I started with the configuration from the user guide I got this
exception:

java.util.ServiceConfigurationError: javax.xml.ws.spi.Provider:
Provider weblogic.wsee.jaxws.spi.WLSProvider could not be instantiated:
java.lang.ExceptionInInitializerError

So the WLS javax.xml.ws.spi.Provider file was loaded instead of the one
bundled with Metro. To give the Metro SPI file preference I added the
following line to the

META-INF\weblogic-application.xml:

[...]

META-INF/services/javax.xml.ws.*

2) Now I got the following exception in ServiceLoader(362):

java.lang.NoClassDefFoundError: Could not initialize class
com.sun.xml.ws.spi.ProviderImpl

This exception is caused by the expression:
Class.forName(cn, true, loader)

where:
loader -> "weblogic.utils.classloaders.GenericClassLoader@148a0a2
finder: weblogic.utils.classloaders.CodeGenClassFinder@89feb9 [...]"
cn -> "com.sun.xml.ws.spi.ProviderImpl"

So the WLS classloader couldn't load ProviderImpl.

3) Classloader loader was originally instantiated in
ServiceLoader(491):

ClassLoader cl = Thread.currentThread().getContextClassLoader();

When I combined this statement with ServiceLoader(362) I got:

Class.forName("com.sun.xml.ws.spi.ProviderImpl", true,
Thread.currentThread().getContextClassLoader());

Putting this statement in my own class threw a:

java.lang.NoClassDefFoundError: Could not initialize class
com.sun.xml.ws.spi.ProviderImpl

which verified that the WLS classloader couldn't load ProviderImpl.

Issue
=====
I tried everything I could to load ProviderImpl. But it just didn

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
basca_schiphol
Offline
Joined: 2010-04-29

Nailed it:

My issue was caused by user guide chapter 2.9.1.1. known issue #3
during initialization of
com.sun.xml.ws.spi.ProviderImpl.getEPRJaxbContext() on line 274.

The exception thrown by Class.forName0() was not very helpful, so I had
to add some sysouts to find out what was happening.

Following the instructions from the chapter mentioned above fixed my
issue.