1 Reply Latest reply on Dec 13, 2004 7:56 AM by Darran Lofthouse

    connect to a remote jboss

    jack zen Newbie

      Hello,

      I have problems when i try to access remote connection factory using a managed connection pool although i followed the FAQ posted by Adrian.

      Question:

      How do I access a remote jboss connection factory using a managed connection pool.

      Sympton:
      The message is always sent to the local testQueue. But it is expected that the message was sent to the remote testQueue.

      Testing Enviroment:
      (1)Two jboss-3.2.2 servers are runing. One is runing on workstation(is called remote server), the other is runing on notebook(my local server).
      (2)Both runing on redhat 9.0.
      (3)/etc/hosts file are set properly in both machine. The $hostname returns the name which maps to non-loop ip address.
      (4)In both jboss servers, testQueue is preconfigued (coming with the installation).
      (5)Testing program: I modified the EchoBean.java from src/main/org/jboss/chap7/ext1. In this testing case, there are six files:
      (a)EchoBean.java
      (b)Echo.java
      (c)EchoHome.java
      (d)ExClient.java
      (e)ejb-jar.xml
      (f)jboss.xml

      I ran the example client (ExClient) on my notebook against the Echo Bean(deployed in my notebook also) which accesses a remote jboss connection factory (workstation) using a managed connection pool. It is expected that the EchoBean will send the message from the client into remote queue.

      I followed the FAQ posted by adrain (in my notebook server):
      (1)deploy the provider for the remote machine (workstation).
      I did this by adding one definition into jms/jms-ds.xml file in local server (notebook) as following (NOTE:172.16.100.103 is remote server ip – workstation):



      RemoteJMSProvider
      jnp://172.16.100.103:1099

      org.jboss.jms.jndi.JBossMQProvider

      UIL2XAConnectionFactory
      UIL2XAConnectionFactory



      (2)deploy the managed connection factory using this provider:
      I did this by adding <tx-connection-factory> in jms-ds.xml file:
      <tx-connection-factory>

      <jndi-name>RemoteJmsXA</jndi-name>

      <xa-transaction/>

      <adapter-display-name>JMS Adapter</adapter-display-name>

      <config-property name="SessionDefaultType" type="java.lang.String">javax.jms.Topic</config-property>
      <config-property name="JmsProviderAdapterJNDI" type="java.lang.String">java:/RemoteJMSProvider</config-property>

      <security-domain-and-application>RemoteJmsXARealm</security-domain-and-application>

      </tx-connection-factory>

      (3)Finally, configued the user/password in conf/login-config.xml.
      <application-policy name = "RemoteJmsXARealm">

      <login-module code = "org.jboss.resource.security.ConfiguredIdentityLoginModule"
      flag = "required">
      <module-option name = "principal">guest</module-option>
      <module-option name = "userName">guest</module-option>
      <module-option name = "password">guest</module-option>
      <module-option name = "managedConnectionFactoryName">jboss.jca:service=TxCM,name=RemoteJmsXA</module-option>
      </login-module>

      </application-policy>


      The ejb-jar.xml file:


      <?xml version="1.0"?>
      <!DOCTYPE ejb-jar
      PUBLIC "-//Sun Microsystems, Inc.//DTD Enterprise JavaBeans 2.0//EN"
      "http://java.sun.com/dtd/ejb-jar_2_0.dtd"
      >

      <ejb-jar>
      <enterprise-beans>

      <ejb-name>EchoBean</ejb-name>
      org.jboss.chap7.ex1.EchoHome
      org.jboss.chap7.ex1.Echo
      <ejb-class>org.jboss.chap7.ex1.EchoBean</ejb-class>
      <session-type>Stateless</session-type>
      <transaction-type>Container</transaction-type>
      <resource-ref>
      <res-ref-name>jms/QueueConnectionFactory</res-ref-name>
      <res-type>javax.jms.QueueConnectionFactory</res-type>
      <res-auth>Container</res-auth>
      </resource-ref>
      <resource-ref>
      <res-ref-name>jms/Queue</res-ref-name>
      <res-type>javax.jms.Queue</res-type>
      <res-auth>Container</res-auth>
      </resource-ref>

      </enterprise-beans>
      </ejb-jar>

      jboss.xml file:

      <?xml version="1.0"?>

      <enterprise-beans>

      <ejb-name>EchoBean</ejb-name>
      <resource-ref>
      <res-ref-name>jms/Queue</res-ref-name>
      <resource-name>queue</resource-name>
      </resource-ref>
      <resource-ref>
      <res-ref-name>jms/QueueConnectionFactory</res-ref-name>
      <resource-name>queueconnectionfactory</resource-name>
      </resource-ref>

      </enterprise-beans>
      <resource-managers>
      <resource-manager>
      <res-name>queueconnectionfactory</res-name>
      <res-jndi-name>java:/RemoteJmsXA</res-jndi-name>
      </resource-manager>
      <resource-manager>
      <res-name>queue</res-name>
      <res-jndi-name>jnp://172.16.100.103:1099/queue/testQueue</res-jndi-name>
      </resource-manager>
      </resource-managers>




      Thanks very much!

      yang