JBOSS+Websphere MQ JNDI获取连接队列报NoSuchMethod错误,急~~~~~~~~

人生无界 稿件软件工程师  2013-06-08 04:53:29
采用的是jca集成,发送消息的代码如下
Properties props = new Properties();
props.setProperty("java.naming.factory.initial","org.jnp.interfaces.NamingContextFactory");
props.setProperty("java.naming.provider.url", "127.0.0.1" + ":"+1999);
props.setProperty("java.naming.factory.url.pkgs","org.jboss.naming:org.jnp.interfaces");
try {
jndiContext = new InitialContext(props);
} catch (NamingException e) {
e.printStackTrace();
}
Session session=null;
MessageProducer producer=null;
try {
ConnectionFactory cf = (javax.jms.ConnectionFactory) jndiContext.lookup(xmlQMJndiName);
Connection conn = cf.createConnection();
session = conn.createSession(false,Session.AUTO_ACKNOWLEDGE);
Destination destination = (Destination) jndiContext.lookup(xmlQJndiName);
producer = session.createProducer(destination);
ObjectMessage obMessage = session.createObjectMessage((ConfirmMessage)message);
producer.send(obMessage);
} catch (Exception e) {
e.printStackTrace();
}finally{

if(producer!=null){
try {
producer.close();
} catch (JMSException e) {
e.printStackTrace();
}
}
if(session!=null){
try {
session.close();
} catch (JMSException e) {
e.printStackTrace();
}
}

}
配置文件:

<?xml version="1.0" encoding="UTF-8"?>


<server>

<tx-connection-factory>

<!-- Bind this ConnectionFactory with the JNDI name IVTCF -->
<jndi-name>DDDQM</jndi-name>
<use-java-context>false</use-java-context>


<!-- Indicate that the connection factory supports XA transactions -->
<xa-transaction />

<!-- rar-name is the actual RAR file name, in this case wmq.jmsra.rar -->
<rar-name>wmq.jmsra.rar</rar-name>

<!-- connection-definition is the ConnectionFactory interface
defined in the ra.xml -->
<connection-definition>javax.jms.ConnectionFactory</connection-definition>

<!--
Configuration for the ConnectionFactory. This defines the channel, hostname, port,
queueManager, and transportType properties for a client (TCP/IP) connection to WMQ
-->
<config-property name="channel" type="java.lang.String">
SC_DDD
</config-property>
<config-property name="hostName" type="java.lang.String">
127.0.0.1
</config-property>
<config-property name="port" type="java.lang.String">
1414
</config-property>
<track-connection-by-tx/>
<application-managed-security/>
<config-property name="queueManager" type="java.lang.String">
QM_DDD
</config-property>
<max-pool-size>20000</max-pool-size>
<config-property name="transportType" type="java.lang.String">
CLIENT
</config-property>

<security-domain-and-application>JmsXARealm</security-domain-and-application>
</tx-connection-factory>



<!-- admin object definition -->
<mbean code="org.jboss.resource.deployment.AdminObject"
name="jboss.jca:service=WASDestination,name=DDDQ">


<!-- Bind this AdminObject with the JNDI name IVTQueue -->
<attribute name="JNDIName">
DDDQ
</attribute>

<!-- this MBean depends on the WebSphere MQ resource adapter -->
<depends optional-attribute-name="RARName">
jboss.jca:service=RARDeployment,name='wmq.jmsra.rar'
</depends>

<!-- this admin object is a javax.jms.Queue -->
<attribute name="Type">javax.jms.Queue</attribute>

<!--
Configuration for Queue TEST.QUEUE on queue manager ExampleQM. All messages sent
to this queue will have their expiry time overridden so that messages never expire
-->
<attribute name="Properties">
baseQueueManagerName=QM_DDD
baseQueueName=LL_DATA

</attribute>
</mbean>


<tx-connection-factory>

<!-- Bind this ConnectionFactory with the JNDI name IVTCF -->
<jndi-name>DDD2CCCQM</jndi-name>
<use-java-context>false</use-java-context>


<!-- Indicate that the connection factory supports XA transactions -->
<xa-transaction />

<!-- rar-name is the actual RAR file name, in this case wmq.jmsra.rar -->
<rar-name>wmq.jmsra.rar</rar-name>

<!-- connection-definition is the ConnectionFactory interface
defined in the ra.xml -->
<connection-definition>javax.jms.ConnectionFactory</connection-definition>

<!--
Configuration for the ConnectionFactory. This defines the channel, hostname, port,
queueManager, and transportType properties for a client (TCP/IP) connection to WMQ
-->
<config-property name="channel" type="java.lang.String">
SC_DDD
</config-property>
<config-property name="hostName" type="java.lang.String">
127.0.0.1
</config-property>
<config-property name="port" type="java.lang.String">
1415
</config-property>
<track-connection-by-tx/>
<application-managed-security/>
<config-property name="queueManager" type="java.lang.String">
QM_DDD2CCC
</config-property>
<max-pool-size>20000</max-pool-size>
<config-property name="transportType" type="java.lang.String">
CLIENT
</config-property>

<security-domain-and-application>JmsXARealm</security-domain-and-application>
</tx-connection-factory>

<!-- admin object definition -->
<mbean code="org.jboss.resource.deployment.AdminObject"
name="jboss.jca:service=WASDestination,name=DDD2CCCXMLQ">
<attribute name="JNDIName">
DDD2CCCXMLQ
</attribute>

<!-- this MBean depends on the WebSphere MQ resource adapter -->
<depends optional-attribute-name="RARName">
jboss.jca:service=RARDeployment,name='wmq.jmsra.rar'
</depends>

<!-- this admin object is a javax.jms.Queue -->
<attribute name="Type">javax.jms.Queue</attribute>

<!--
Configuration for Queue TEST.QUEUE on queue manager ExampleQM. All messages sent
to this queue will have their expiry time overridden so that messages never expire
-->
<attribute name="Properties">
baseQueueManagerName=QM_DDD2CCC
baseQueueName=RQ_AAA_XML

</attribute>
</mbean>

<mbean code="org.jboss.resource.deployment.AdminObject"
name="jboss.jca:service=WASDestination,name=DDD2CCCQ">
<attribute name="JNDIName">
DDD2CCCQ
</attribute>

<!-- this MBean depends on the WebSphere MQ resource adapter -->
<depends optional-attribute-name="RARName">
jboss.jca:service=RARDeployment,name='wmq.jmsra.rar'
</depends>

<!-- this admin object is a javax.jms.Queue -->
<attribute name="Type">javax.jms.Queue</attribute>

<!--
Configuration for Queue TEST.QUEUE on queue manager ExampleQM. All messages sent
to this queue will have their expiry time overridden so that messages never expire
-->
<attribute name="Properties">
baseQueueManagerName=QM_DDD2CCC
baseQueueName=RR_DATA

</attribute>
</mbean>

<mbean code="org.jboss.resource.deployment.AdminObject"
name="jboss.jca:service=WASDestination,name=DDD2CCCFKQ">
<attribute name="JNDIName">
DDD2CCCFKQ
</attribute>

<!-- this MBean depends on the WebSphere MQ resource adapter -->
<depends optional-attribute-name="RARName">
jboss.jca:service=RARDeployment,name='wmq.jmsra.rar'
</depends>

<!-- this admin object is a javax.jms.Queue -->
<attribute name="Type">javax.jms.Queue</attribute>

<!--
Configuration for Queue TEST.QUEUE on queue manager ExampleQM. All messages sent
to this queue will have their expiry time overridden so that messages never expire
-->
<attribute name="Properties">
baseQueueManagerName=QM_DDD2CCC
baseQueueName=RQ_FK

</attribute>
</mbean>
<!-- config for callback add by xxu 2010-06-02-->
</server>

异常栈:
Caused by: com.ibm.msg.client.jms.DetailedJMSException: JMSFMQ6312: Java(tm) MQI 中发生异常。 Java(tm) MQI 已抛出描述该问题的异常。 请参阅链接的异常以获取进一步的信息。
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
at java.lang.reflect.Constructor.newInstance(Constructor.java:494)
at com.ibm.msg.client.commonservices.j2se.NLSServices.createException(NLSServices.java:313)
at com.ibm.msg.client.commonservices.nls.NLSServices.createException(NLSServices.java:390)
at com.ibm.msg.client.wmq.factories.WMQXAConnectionFactory.createV7ProviderConnection(WMQXAConnectionFactory.java:175)
at com.ibm.msg.client.wmq.factories.WMQConnectionFactory.createProviderConnection(WMQConnectionFactory.java:6204)
at com.ibm.msg.client.wmq.factories.WMQXAConnectionFactory.createProviderXAConnection(WMQXAConnectionFactory.java:102)
at com.ibm.msg.client.jms.admin.JmsConnectionFactoryImpl.createXAConnectionInternal(JmsConnectionFactoryImpl.java:371)
at com.ibm.mq.jms.MQXAConnectionFactory.createXAConnection(MQXAConnectionFactory.java:124)
at com.ibm.mq.connector.ConnectionBuilder.createConnection(ConnectionBuilder.java:166)
... 62 more
Caused by: com.ibm.mq.jmqi.JmqiException: CC=2;RC=2195;AMQ9546: 接收到错误返回码。 [1=java.lang.NoSuchMethodException[com.ibm.mq.jmqi.remote.internal.RemoteFAP.<init>(com.ibm.mq.jmqi.JmqiEnvironment, int)],3=Class.getConstructor0]
at com.ibm.mq.jmqi.JmqiEnvironment.getInstance(JmqiEnvironment.java:752)
at com.ibm.mq.jmqi.JmqiEnvironment.getMQI(JmqiEnvironment.java:605)
at com.ibm.msg.client.wmq.factories.WMQXAConnectionFactory.createV7ProviderConnection(WMQXAConnectionFactory.java:167)
... 67 more
Caused by: java.lang.NoSuchMethodException: com.ibm.mq.jmqi.remote.internal.RemoteFAP.<init>(com.ibm.mq.jmqi.JmqiEnvironment, int)
at java.lang.Class.getConstructor0(Class.java:2678)
at java.lang.Class.getConstructor(Class.java:1629)
at com.ibm.mq.jmqi.JmqiEnvironment.getInstance(JmqiEnvironment.java:665)
...全文
913 3 1 打赏 收藏 举报
写回复
3 条回复
切换为时间正序
当前发帖距今超过3年,不再开放新的回复
发表回复
人生无界 2014-04-19
..发现一个奇怪的现象... 当我的MDB 拷贝出 deploy目录的时候,...错误出现...MDB拷贝进去的时候..就没有错误了..
  • 打赏
  • 举报
回复
人生无界 2013-06-09
找到原因,...分享一下,希望给后来者以帮助。 这个问题,我只找到几个国外的哥们和我有一样的错误 造成这个问题的原因有2种 1.整合jboss的包 com.ibm.jmqi包的版本问题 2.项目中存在一个com.ibm.jmqi.jar(拷贝自MQ的安装目录下的java下的lib目录下面,这个包含所有的jmqi包名下的类) 然后在整合的jboss的时候,在jboss的deploy目录下的wmq.jmsra.rar文件中也有一个jmqi包,删掉即可。如果项目中需要捕获MQException,那么将wmq.jmsra.rar解压,复制com.ibm.jmqi.jar到web工程的lib目录下即可,wmq.jmsra.rar里面的com.ibm.jmqi.jar保留
  • 打赏
  • 举报
回复
人生无界 2013-06-08
可以确定的是,JMQI jar包是有这个构造函数的....求解
  • 打赏
  • 举报
回复
相关推荐
发帖
WebSphere
创建于2007-08-27

2608

社区成员

WebSphere 是 IBM 的软件平台。它包含了编写、运行和监视全天候的工业强度的随需应变 Web 应用程序和跨平台、跨产品解决方案所需要的整个中间件基础设施,如服务器、服务和工具。
申请成为版主
帖子事件
创建了帖子
2013-06-08 04:53
社区公告
暂无公告