3

我有一个调用 SOAP 服务的应用程序客户端。我已经使用 glassfish 发行版中的 wsimport 来生成 ws 类,并且在 Glassfish v2 中一切正常。当我从 v3 运行它(webstart)时,应用程序运行良好,但是当我发起 SOAP 调用时,我得到

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)

我什至在任何地方都找不到命名类,而且网上似乎几乎没有提到它。

编辑它在 jaxb-osgi.jar

这不应该由glassfish提供吗?当然,如果我将它包含在我的应用程序中,它会带来冲突的风险吗?

4

1 回答 1

3

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.

于 2010-03-05T23:10:00.877 回答