在Websphere 8.5上使用JMS时出现NoSuchMethodError错误 [英] NoSuchMethodError error when using JMS on Websphere 8.5

查看:78
本文介绍了在Websphere 8.5上使用JMS时出现NoSuchMethodError错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个部署在Websphere 8.5上的Java应用程序.它收到一条消息,我正在尝试使用它,但这是我得到的错误,即使我在getBody()
行上有正确的JMS罐子也是如此代码段:

I have a Java application which is deployed on Websphere 8.5. It gets a message which I am trying to use it but this is the error I get even though I have the right JMS jars on line getBody()
Code Snippet:

if (arg0 instanceof BytesMessage)
{
    byte[] payload = arg0.getBody(byte[].class);
    myMessage = new String(payload);
}    

Jar文件:

<dependency>
   <groupId>javax.jms</groupId>
   <artifactId>javax.jms-api</artifactId>
   <version>2.0.1</version>
   <scope>compile</scope>
</dependency>
<dependency>
   <groupId>javax</groupId>
   <artifactId>javaee-api</artifactId>
   <version>6.0</version>
   <scope>provided</scope>
</dependency>

Websphere日志错误:

  Caused by: java.lang.NoSuchMethodError: javax/jms/Message.getBody(Ljava/lang/Class;)Ljava/lang/Object; (loaded from file:/opt/was_static/websphere_8.5.5.15.1/appserver/plugins/javax.j2ee.jms.jar by org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader@6d5d04f3) called from class com.mycompany.myapplication.sync.mdb.myapplicationSyncOutboundMDB (loaded from file:/opt/was_static/profiles/appsrv01/installedApps/eaodr01Cell01/myapplication-ear-mydomain.com-editionmyapplication-ear-0.9.6.ear/myapplication-ejb-0.9.6.jar by 
com.ibm.ws.classloader.CompoundClassLoader@19abf904[app:myapplication-ear-mydomain.com-editionmyapplication-ear-0.9.6]
   Local ClassPath: 
   Parent: com.ibm.ws.classloader.ExtJarClassLoader@890f8480[PF][server:0]
   Delegation Mode: PARENT_FIRST)  

Websphere CLassloading :

有什么想法为什么我的应用程序可以在代码中看到 javax.jms.Message 却可以正常编译,但是Websphere找不到它?

Any ideas why my application, which compiles fine as it sees javax.jms.Message in the code but the Websphere can't find this?

推荐答案

WebSphere Application Server 8.5.5支持Java EE 6,该Java EE 6包括JMS 1.1,而不是JMS 2.0,并且在Java的JMS 2.0中添加了getBody(Class)方法.EE 7及更高版本.

WebSphere Application Server 8.5.5 supports Java EE 6 which includes JMS 1.1, not JMS 2.0 and the getBody(Class) method was added in JMS 2.0 which is Java EE 7 and newer.

如果要使用JMS 2.0,则需要升级到WebSphere Application Server 9.0.

If you want to use JMS 2.0 then you need to upgrade to WebSphere Application Server 9.0.

这篇关于在Websphere 8.5上使用JMS时出现NoSuchMethodError错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆