NoSuchMethodError:com/sun/istack/logging/Logger.getLogger

发布于 2024-09-02 04:36:57 字数 2021 浏览 5 评论 0原文

我开发了一个 Web 服务并将其部署到 websphere 7.0,并使用 JAX-WS API 开发了一个动态调度客户端,该客户端也运行在同一应用程序服务器上。 我在以下行中收到错误:

Dispatch<SOAPMessage> dispatch = service.createDispatch(portName, SOAPMessage.class, Service.Mode.MESSAGE);
Error:
Caused by: java.lang.NoSuchMethodError: com/sun/istack/logging/Logger.getLogger(Ljava/lang/Class;)Lcom/sun/istack/logging/Logger;
at com.sun.xml.ws.api.config.management.policy.ManagementAssertion.<clinit>(ManagementAssertion.java:87)
at java.lang.J9VMInternals.initializeImpl(Native Method)
at java.lang.J9VMInternals.initialize(J9VMInternals.java:200)
at java.lang.J9VMInternals.initialize(J9VMInternals.java:167)
at com.sun.xml.ws.server.MonitorBase.createManagedObjectManager(MonitorBase.java:177)
at com.sun.xml.ws.client.Stub.<init>(Stub.java:196)
at com.sun.xml.ws.client.Stub.<init>(Stub.java:174)
at com.sun.xml.ws.client.dispatch.DispatchImpl.<init>(DispatchImpl.java:129)
at com.sun.xml.ws.client.dispatch.SOAPMessageDispatch.<init>(SOAPMessageDispatch.java:77)
at com.sun.xml.ws.api.pipe.Stubs.createSAAJDispatch(Stubs.java:143)
at com.sun.xml.ws.api.pipe.Stubs.createDispatch(Stubs.java:264)
at com.sun.xml.ws.client.WSServiceDelegate.createDispatch(WSServiceDelegate.java:390)
at com.sun.xml.ws.client.WSServiceDelegate.createDispatch(WSServiceDelegate.java:401)
at com.sun.xml.ws.client.WSServiceDelegate.createDispatch(WSServiceDelegate.java:383)
at javax.xml.ws.Service.createDispatch(Service.java:336) 

我包含以下依赖项。

    <dependency>
        <groupId>javax.xml.ws</groupId>
        <artifactId>jaxws-api</artifactId>
        <version>2.1</version>
    </dependency>

我还尝试添加策略依赖项(版本 - 2.2 和 2.2.1)

<dependency>
        <groupId>com.sun.xml.ws</groupId>
        <artifactId>policy</artifactId>
        <version>2.2.1</version>
</dependency>

关于我需要添加哪些依赖项有什么想法吗?

I developed a webservice and deployed it to websphere 7.0 and developed a dynamic dispatch client using JAX-WS APIs which also runs on same application server.
I get error at the following line:

Dispatch<SOAPMessage> dispatch = service.createDispatch(portName, SOAPMessage.class, Service.Mode.MESSAGE);
Error:
Caused by: java.lang.NoSuchMethodError: com/sun/istack/logging/Logger.getLogger(Ljava/lang/Class;)Lcom/sun/istack/logging/Logger;
at com.sun.xml.ws.api.config.management.policy.ManagementAssertion.<clinit>(ManagementAssertion.java:87)
at java.lang.J9VMInternals.initializeImpl(Native Method)
at java.lang.J9VMInternals.initialize(J9VMInternals.java:200)
at java.lang.J9VMInternals.initialize(J9VMInternals.java:167)
at com.sun.xml.ws.server.MonitorBase.createManagedObjectManager(MonitorBase.java:177)
at com.sun.xml.ws.client.Stub.<init>(Stub.java:196)
at com.sun.xml.ws.client.Stub.<init>(Stub.java:174)
at com.sun.xml.ws.client.dispatch.DispatchImpl.<init>(DispatchImpl.java:129)
at com.sun.xml.ws.client.dispatch.SOAPMessageDispatch.<init>(SOAPMessageDispatch.java:77)
at com.sun.xml.ws.api.pipe.Stubs.createSAAJDispatch(Stubs.java:143)
at com.sun.xml.ws.api.pipe.Stubs.createDispatch(Stubs.java:264)
at com.sun.xml.ws.client.WSServiceDelegate.createDispatch(WSServiceDelegate.java:390)
at com.sun.xml.ws.client.WSServiceDelegate.createDispatch(WSServiceDelegate.java:401)
at com.sun.xml.ws.client.WSServiceDelegate.createDispatch(WSServiceDelegate.java:383)
at javax.xml.ws.Service.createDispatch(Service.java:336) 

I included the following dependency.

    <dependency>
        <groupId>javax.xml.ws</groupId>
        <artifactId>jaxws-api</artifactId>
        <version>2.1</version>
    </dependency>

I also tried adding policy dependency (versions - 2.2 and 2.2.1)

<dependency>
        <groupId>com.sun.xml.ws</groupId>
        <artifactId>policy</artifactId>
        <version>2.2.1</version>
</dependency>

Any ideas on what more dependencies I need to add?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

时光匆匆的小流年 2024-09-09 04:36:57

jaxb-impl jar (2.2) 包含与 istack-commons-runtime jar 相同的日志记录类。

添加以下排除项以更正版本不匹配:

<dependency>
    <groupId>com.sun.xml.ws</groupId>
    <artifactId>jaxws-rt</artifactId>
    <version>2.2</version>
    <exclusions>
        <exclusion>
            <artifactId>istack-commons-runtime</artifactId>
            <groupId>com.sun.istack</groupId>
        </exclusion>
    </exclusions>
</dependency>

The jaxb-impl jar (2.2) contains the same logging classes as the istack-commons-runtime jar.

Add the following exclusions in order to correct the version mismatch:

<dependency>
    <groupId>com.sun.xml.ws</groupId>
    <artifactId>jaxws-rt</artifactId>
    <version>2.2</version>
    <exclusions>
        <exclusion>
            <artifactId>istack-commons-runtime</artifactId>
            <groupId>com.sun.istack</groupId>
        </exclusion>
    </exclusions>
</dependency>
山人契 2024-09-09 04:36:57

我相信 JAX-WS 2.1 已经内置于 Java 6 中,因此您不需要将其与您的应用程序捆绑在一起(假设您使用的是 Java 6)。如果您尝试,您可能会遇到像这样的类加载错误。

尝试从应用程序中删除所有 jax-ws JAR,包括 jaxws-api

I believe that JAX-WS 2.1 is already built into Java 6, so you shouldn't need to bundle it with your application (assuming you're using Java 6, that is). If you try, you're likely to get classloading errors like this one.

Try removing all of the jax-ws JARs from the app, including jaxws-api.

隱形的亼 2024-09-09 04:36:57

问题在于,类路径中可能多次出现此类 - Logger (com.sun.istack.logging.Logger)。

编译代码时,它可以访问此 Logger 类,该类与运行时找到的不同。

两种可能性:

  1. 在运行时只有一份 Logger 副本,并且它与编译期间使用的内容不匹配。

    在运行

  2. 此 Logger 有多个副本,类加载器首先找到不正确的副本,因此报告此错误。

    此 Logger 有多个副本

检查包含此文件的 JAR。

它通常位于 jaxb-osgi.jar 中。

华泰
曼鲁

The problem is the fact that there are likely multiple occurrences of this class - Logger (com.sun.istack.logging.Logger) in the class path.

When the code is compiled it had access to this Logger class which is different from what is found by the run time.

Two possibilities:

  1. There in only one copy of Logger in run time and it does not match what was used during compilation.

  2. There are multiple copies of this Logger and the class loader finds the incorrect copy first hence reports this error.

Check the JARs that contains this file.

It is typically found in jaxb-osgi.jar.

HTH
Manglu

南风几经秋 2024-09-09 04:36:57

我遇到了同样的问题,问题与 jaxb 版本兼容性有关。 Apache Camel 的camel-core 依赖项正在导入 jaxb-core 和 jaxb-impl。将它们从 jaxws-rt 的依赖关系中删除解决了问题。

<dependency>
    <groupId>org.apache.camel</groupId>
    <artifactId>camel-core</artifactId>
    <version>${org.apache.camel.version}</version>
    <exclusions>
        <exclusion>
             <groupId>com.sun.xml.bind</groupId>
             <artifactId>jaxb-core</artifactId>
         </exclusion>
         <exclusion>
             <groupId>com.sun.xml.bind</groupId>
             <artifactId>jaxb-impl</artifactId>
         </exclusion>
    </exclusions>
</dependency>

I had the same issue and the problem was related with jaxb version compatibility. Apache Camel camel-core dependency was importing jaxb-core and jaxb-impl. Removing them from the dependency from jaxws-rt solved the problem.

<dependency>
    <groupId>org.apache.camel</groupId>
    <artifactId>camel-core</artifactId>
    <version>${org.apache.camel.version}</version>
    <exclusions>
        <exclusion>
             <groupId>com.sun.xml.bind</groupId>
             <artifactId>jaxb-core</artifactId>
         </exclusion>
         <exclusion>
             <groupId>com.sun.xml.bind</groupId>
             <artifactId>jaxb-impl</artifactId>
         </exclusion>
    </exclusions>
</dependency>
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文