这是我的资源适配器,但我必须在不使用此资源适配器的情况下设置初始上下文。找到我在下面设置的初始上下文:
<resource-adapter>
<archive>
wmq.jmsra.rar
</archive>
<transaction-support>NoTransaction</transaction-support>
<connection-definitions>
<connection-definition class-name="com.ibm.mq.connector.outbound.ManagedQueueConnectionFactoryImpl" jndi-name="java:jboss/CONFACTORY1" pool-name="CONFACTORY1">
<config-property name="port">
1234
</config-property>
<config-property name="hostName">
172.16.70.2
</config-property>
<config-property name="channel">
SYSTEM.DEF.SVRCONN
</config-property>
<config-property name="transportType">
CLIENT
</config-property>
<config-property name="queueManager">
QUEUEMGR
</config-property>
</connection-definition>
</connection-definitions>
<admin-objects>
<admin-object class-name="com.ibm.mq.connector.outbound.MQQueueProxy" jndi-name="java:jboss/JMSQUEUE" pool-name="MQ.QUEUE.NAME">
<config-property name="baseQueueName">
JMSQUEUE
</config-property>
<config-property name="baseQueueManagerName">
QUEUEMGR
</config-property>
</admin-object>
</admin-objects>
</resource-adapter>
final Properties env = new Properties();
env.put(Context.INITIAL_CONTEXT_FACTORY, "com.ibm.mq.connector.outbound.ManagedQueueConnectionFactoryImpl");
env.put(Context.PROVIDER_URL, "remote://172.16.70.2:1234");
// env.put(Context.SECURITY_PRINCIPAL, "admin");
// env.put(Context.SECURITY_CREDENTIALS, "sn@12345");
InitialContext context = new InitialContext(env);
答案 0 :(得分:0)
IBM MQ JCA不支持通过JNDI从远程客户端(另一个JVM)查找IBM MQ组件。只能从加载IBM MQ JCA的JVM访问IBM连接工厂和目标。