如何在jboss stanalone.xml中为JBoss和MySQL连接

时间:2018-05-31 07:44:43

标签: java security jboss ibm-mq

我尝试从Jboss连接IBM MQ。 所以我在standalone.xml中配置了RA。 我给出了所有配置属性,如下所示。 但是我得到了以下例外。

please check if the supplied username and password are correct on the QueueManager to which you are connecting.
    Caused by: com.ibm.mq.MQException: JMSCMQ0001: IBM MQ call failed with compcode '2' ('MQCC_FAILED') reason '2035' ('MQRC_NOT_AUTHORIZED').\",

配置如下:

 <resource-adapters>
                <resource-adapter id="wmq.jmsra.rar">
                    <archive>
                        wmq.jmsra.rar
                    </archive>
                    <connection-definitions>
                        <connection-definition class-name="com.ibm.mq.connector.outbound.ManagedConnectionFactoryImpl" jndi-name="java:/MQConnectionFactory" use-java-context="true" pool-name="MQConnectionFactory">
                            <config-property name="hostName">
                                localhost
                            </config-property>
                            <config-property name="password">
                               sdadsadsadasd
                            </config-property>
                            <config-property name="queueManager">
                                TEST
                            </config-property>
                            <config-property name="port">
                                1415
                            </config-property>
                            <config-property name="channel">
                                TEST.CHANNEL
                            </config-property>
                            <config-property name="transportType">
                                CLIENT
                            </config-property>
                            <config-property name="username">
                                testusermq
                            </config-property>
                        </connection-definition>
                    </connection-definitions>

用户组也从Windows端映射到MQ。我使用的是Jboss 7和IBM MQ 9

1 个答案:

答案 0 :(得分:0)

我们需要在侦听器端配置。即MDB方面我们还需要配置所有用户名,频道等。然后我就可以连接了。不足以提供资源级别

<message-driven>
<ejb-name>TESTMDB</ejb-name>
            <activation-config>
                <activation-config-property>
                    <activation-config-property-name>destination</activation-config-property-name>
                    <activation-config-property-value>java:/queue/TESTQUEUE</activation-config-property-value>
                </activation-config-property>
                <activation-config-property>
                    <activation-config-property-name>destinationType</activation-config-property-name>
                    <activation-config-property-value>javax.jms.Queue</activation-config-property-value>
                </activation-config-property>
                <activation-config-property>
                    <activation-config-property-name>hostName</activation-config-property-name>
                    <activation-config-property-value>${MQ.HOST}</activation-config-property-value>
                </activation-config-property>
                <activation-config-property>
                    <activation-config-property-name>port</activation-config-property-name>
                    <activation-config-property-value>${MQ.PORT}</activation-config-property-value>
                </activation-config-property>
                <activation-config-property>
                    <activation-config-property-name>channel</activation-config-property-name>
                    <activation-config-property-value>${MQ.CHANNEL}</activation-config-property-value>
                </activation-config-property>
                <activation-config-property>
                    <activation-config-property-name>queueManager</activation-config-property-name>
                    <activation-config-property-value>${MQ.QMGR}</activation-config-property-value>
                </activation-config-property>
                <activation-config-property>
                    <activation-config-property-name>transportType</activation-config-property-name>
                    <activation-config-property-value>${MQ.TRANSPORT.TYPE}</activation-config-property-value>
                </activation-config-property>
                <activation-config-property>
                    <activation-config-property-name>useJNDI</activation-config-property-name>
                    <activation-config-property-value>${USE.JNDI}</activation-config-property-value>
                </activation-config-property>
                <activation-config-property>
                    <activation-config-property-name>maxPoolDepth</activation-config-property-name>
                    <activation-config-property-value>${OFS.MAX.POOL.DEPTH}</activation-config-property-value>
                </activation-config-property>
                <activation-config-property>
                    <activation-config-property-name>username</activation-config-property-name>
                    <activation-config-property-value>${MQ.USERNAME}</activation-config-property-value>
                </activation-config-property>
                <activation-config-property>
                    <activation-config-property-name>password</activation-config-property-name>
                    <activation-config-property-value>${MQ.PASSWORD}</activation-config-property-value>
                </activation-config-property>
            </activation-config>
            <resource-ref>
                <res-ref-name>jms/TestJQueueConnectionFactory</res-ref-name>
                <res-type>javax.jms.ConnectionFactory</res-type>
                <jndi-name>java:/MQConnectionFactory</jndi-name>
            </resource-ref>
            <message-destination-ref>
                <message-destination-ref-name>jms/ReplyQueue</message-destination-ref-name>
                <jndi-name>java:/queue/testReplyQueue</jndi-name>
            </message-destination-ref>
        </message-driven>