我只能发100分的帖子啊?如果大侠能解决问题,在追加100分!!!jms的createQueueSession的第一个参数设置成true的时候,来开启session事务,
但是getTransacted()返回的一直是false。
================ java ============================================
import javax.jms.Connection;
import javax.jms.Session;Connection connection = ((QueueConnectionFactory)this.getConnectionFactory()).createQueueConnection();
Session jmsSession = ((QueueConnection) connection).createQueueSession(true, 0);jmsSession.getTransacted(); ---------------------------------- false============= wmq.jmsra-ds.xml =====================================
<connection-factories> <!-- mbeans defining JCA administered objects -->
    <mbean code="org.jboss.resource.deployment.AdminObject" name="jca.wmq:name=ivtqueue">        <!-- Bind this AdminObject  with the JNDI name IVTQueue -->
        <attribute name="JNDIName">IVTQueue</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
           If you need to specify a specific queue manager add the following
               baseQueueManagerName=ExampleQM
        -->
        <attribute name="Properties">
                    baseQueueName=XXXX
                    baseQueueManagerName=QMXX
        </attribute>
</mbean> <!-- JCA Connection factory definitions -->
<tx-connection-factory>
<!-- Bind this ConnectionFactory with the JNDI name WSMQJmsXA -->
<jndi-name>WSMQJms</jndi-name> <!-- Indicate that the connection factory supports only local transactions -->
<local-transaction/>
<!-- 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.QueueConnectionFactory</connection-definition>

<!-- Tell JBoss not to prefix the jndi name of the CF with the java: context and thus allow it to be looked up externally-->
<!--<use-java-context>false</use-java-context>--> <!--
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">SYSTEM.AUTO.SVRCONN</config-property>
<config-property name="hostName" type="java.lang.String">192.168.0.110</config-property>
<config-property name="port" type="java.lang.String">1414</config-property>
<config-property name="queueManager" type="java.lang.String">QMXX</config-property>
<config-property name="transportType" type="java.lang.String">CLIENT</config-property>
<config-property name="CCSID" type="java.lang.String">1208</config-property>

<!-- define security domain -->
<security-domain-and-application>JmsXARealm</security-domain-and-application>
</tx-connection-factory>
</connection-factories>========================== applicationContext.xml ===================
<bean id="AAA" class="co.base.JMSQueueConnector">
<property name="config" ref="JMSDestProperty" />
<property name="jmsTemplate">
<bean name="jmsTemplate" class = "co.jms.ManualTransactionJmsTemplate">
<property name="connectionFactory" ref="connectQueueFactory" ></property>
</bean>
</property>
</bean>
<jee:jndi-lookup id="connectQueueFactory" jndi-name="java:/WSMQJms" resource-ref="false" />=======================================================================怎么样能让createQueueSession返回的session是事务的?
Thanks!!!

解决方案 »

  1.   

    ConnectionFactory connectionFactory = new ActiveMQConnectionFactory("tcp://localhost:61616");
    Connection connection = connectionFactory.createConnection();
    connection.start();
    Session session = connection.createSession(true, Session.AUTO_ACKNOWLEDGE);
    System.out.println("aaaaa:"+session.getTransacted());
      

  2.   

    楼主这帖似曾相识 。在哪有一模一样的。检查下connection是否得到正确的值。
      

  3.   

    有没有别的办法,ActiveMQ还要安装,客户肯定不同意。
    就用jms连接ibmmq,能不能设置?
    jboss中还要设置什么东西吗?????
      

  4.   

    对了,直接把连接池配到applicationContext.xml,session就可以有事务。
    bean id="connectQueueFactory" class="com.ibm.mq.jms.MQQueueConnectionFactory">
    <property name="channel" value="SYSTEM.AUTO.SVRCONN"></property>
    <property name="transportType" value="1"></property>
    <property name="queueManager" value="QMXXX"></property>
    <property name="hostName" value="192.168.0.XXX"></property>
    <property name="port" value="1414"></property>
    <property name="CCSID" value="1208"></property>
    </bean>