views:

689

answers:

1

I have an application client which calls a SOAP service. I've used wsimport from the glassfish distribution to generate the ws classes, and everything works fine in Glassfish v2. When I run it (webstart) from v3, the app runs fine, but when I initiate a SOAP call, I get

Exception in thread "Thread-146" java.lang.NoClassDefFoundError: com/sun/istack/logging/Logger
    at java.lang.ClassLoader.defineClass1(Native Method)
    at java.lang.ClassLoader.defineClass(ClassLoader.java:621)
    at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:124)
    at java.net.URLClassLoader.defineClass(URLClassLoader.java:260)
    at java.net.URLClassLoader.access$000(URLClassLoader.java:56)
    at java.net.URLClassLoader$1.run(URLClassLoader.java:195)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
    at com.sun.jnlp.JNLPClassLoader.findClass(JNLPClassLoader.java:257)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:252)
    at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320)
    at com.sun.xml.ws.policy.jaxws.WsitPolicyResolver.<clinit>(WsitPolicyResolver.java:62)
    at com.sun.xml.ws.policy.jaxws.WsitPolicyResolverFactory.doCreate(WsitPolicyResolverFactory.java:48)
    at com.sun.xml.ws.api.policy.PolicyResolverFactory.create(PolicyResolverFactory.java:58)
    at com.sun.xml.ws.wsdl.parser.RuntimeWSDLParser.parse(RuntimeWSDLParser.java:131)
    at com.sun.xml.ws.client.WSServiceDelegate.parseWSDL(WSServiceDelegate.java:267)
    at com.sun.xml.ws.client.WSServiceDelegate.<init>(WSServiceDelegate.java:230)
    at com.sun.xml.ws.client.WSServiceDelegate.<init>(WSServiceDelegate.java:178)
    at com.sun.xml.ws.spi.ProviderImpl.createServiceDelegate(ProviderImpl.java:106)
    at javax.xml.ws.Service.<init>(Service.java:56)
    at (class generated from wsdl)
    at (SOAP call)

I can't even find the named class anywhere, and there seems to be almost no reference to it on the net.

EDIT It's in jaxb-osgi.jar

Isn't this supposed to be provided by glassfish? Surely if I include it with my app it poses introduces a risk of conflict?

+1  A: 

The description of your problem and the steps to reproduce are not clear at all but GlassFish v3 bundles Metro 2.0 and Metro 2.0 contains JAX-WS 2.2, which clashes with the JAX-WS 2.1 that comes with Java SE 6:

For a detailed analysis when exactly this is happening, see this Wiki page. The reason for these failures is that Metro 2.0 contains JAX-WS 2.2, which clashes with JAX-WS 2.1 1 that is built into Java SE 6. You will only see these failures if you did not install Metro 2.0 with our installation scripts metro-on-glassfish.xml/metro-on-tomcat.xml. That is the case if you e.g. installed Metro 2.0 for GlassFish V3 via the update center or if you use a version of GlassFish V3 built into NetBeans.

The simplest solution is to download the Metro 2.0 nightly build and run the installation script. The script copies the file webservices-api.jar, which contains the JAX-WS 2.2 API, into <java-home>/lib/endorsed. Alternatively, you can of course manually copy webservices-api.jar into a suitable endorsed directory.

And because com/sun/istack/logging/Logger is a dependency of JAX-WS 2.2, you are very likely in the situation described in the mentioned Wiki page:

Metro 2.0 bundles JAX-WS 2.2. Java SE 6 contains JAX-WS 2.1 (SE 6 upgrade 3 and older version contain JAX-WS 2.0). That means Java will by default pick up the JAX-WS 2.1 APIs and implementation and code that exploits JAX-WS 2.2 features will not work.

Pascal Thivent
That sounds like it might be related, but it sounds like glassfish v3 is broken in this case. I used the wsimport from glassfish v3 and deployed to that same server. I then ran the app client through webstart (Java 6) and "boom". That means this app client cannot be run by any standard j2se installation - which kinda misses the point of webstart. It may lead me to a solution however.
Draemon
@Draemon The problem is not GlassFish v3, the problem is Java 6 and JAX-WS 2.2. So, because you're using JWS, I'd suggest to use the `wsimport` bundled with Java 6 for the client side in your case.
Pascal Thivent

related questions