5 Replies Latest reply on Jan 12, 2006 12:09 AM by Scott Stark

    On a multihomed server, how to bind jms service to hostname

    Sridhar Jallapuram Newbie

      I have jboss running on a multi-homed server. I have some user service mbeans which are registered with the JNDI. On client lookup the stubs returned contained hostname:port as an endpoint for these services.
      On the other hand the jms service which also gets registered with the JNDI, gets resolved to one of the interface IPAddress. This stub returns endpoint as IPAddress:port which is not reachable(in a different network) from this remote client. Is there a way to specify for jms service to be bound to a hostname instead of a jboss resolved interface IPAddress.
      I am able to specify jboss.bind.address as an optional parameter to the org.jboss.Main class, and the JMS service gets bound to this specific address instead of the one JBoss resolved by itself. Is there a way instead to specify the JMS service such that the stub will have a hostname as endpoint(destination) instead of IPAddress.
      I used -Djava.rmi.server.hostname= and -Djboss.bind.address=x.x.x.x which gets supplied to the jms service xml configuration in uil2-service.xml.
      But when I supplied the hostname to bind.address it got resolved to hostname/x.x.x.x:port and the stub contained endpoint x.x.x.x whereas I want hostname as endpoint.

        • 2. Re: On a multihomed server, how to bind jms service to hostn
          Sridhar Jallapuram Newbie

          Further post...

          11:11:37,562 INFO [Server] Core system initialized
          11:11:39,265 INFO [Log4jService$URLWatchTimerTask] Configuring from URL: resource:log4j.xml
          log4j:ERROR File name should be xxx.xxx
          11:11:39,640 [jboss:service=Naming NamingService] main INFO [jboss.naming.NamingService] Started jndi bootstrap jnpPort=10099, rmiPort=0, backlog=50, bindAddress=null, Client SocketFactory=null, Serv
          er SocketFactory=org.jboss.net.sockets.DefaultSocketFactory@ad093076
          11:11:42,062 [jboss.jca:name='jboss-local-jdbc.rar',service=RARDeployment RARDeployment] main INFO [resource.deployment.RARDeployment] Required license terms exist view the META-INF/ra.xml: file:/C:/
          zx1000/runtime/server/server/default/deploy/jboss-local-jdbc.rar
          11:11:42,343 [attune:service=Bootstrap] main DEBUG [server.boot.Bootstrap] ^^^^^^^^^^^^^^ bootstartp create ^^^^^^^^^^^^
          11:11:43,250 [jboss.jca:name=DefaultDS,service=DataSourceBinding WrapperDataSourceService] main INFO [jdbc.remote.WrapperDataSourceService] Bound connection factory for resource adapter for Connectio
          nManager 'jboss.jca:name=DefaultDS,service=DataSourceBinding to JNDI name 'java:DefaultDS'
          11:11:43,687 [jboss.mq.destination:name=AttuneClientChannel,service=Topic AttuneClientChannel] main INFO [jmx.Topic.AttuneClientChannel] Bound to JNDI name: topic/AttuneClientChannel
          11:11:43,687 [attune:service=Bootstrap] main DEBUG [server.boot.Bootstrap] ^^^^^^^^^^^^^bootstartp start^^^^^^^^^^^
          11:11:43,703 [] Thread-6 INFO [server.boot.Bootstrap] Bootstrapping Attune MCS
          11:11:43,703 [] Thread-6 DEBUG [server.boot.Bootstrap] MCS: Mango Coco Strawberry :)
          11:11:43,703 [jboss.mq:service=InvocationLayer,type=UIL2 UILServerILService] main INFO [il.uil2.UILServerILService] JBossMQ UIL service available at : cert001/172.30.120.99:8093
          11:11:43,796 [] Thread-6 DEBUG [server.database.ObjCache] !!!!Value of zcache :Y:
          11:11:43,796 [] Thread-6 DEBUG [server.database.ObjCache] !!!!init db delegate
          11:11:43,953 [jboss.mq.destination:name=DLQ,service=Queue DLQ] main INFO [jmx.Queue.DLQ] Bound to JNDI name: queue/DLQ
          11:11:43,953 [] main INFO [system.server.Server] JBoss (MX MicroKernel) [4.0.2 (build: CVSTag=JBoss_4_0_2 date=200505022023)] Started in 7s:282ms

          My server application is invoked with the following arguments..
          "%JAVA_HOME%\bin\java" -server -Dsun.rmi.transport.tcp.readTimeout=120000 -Xdebug -Xrunjdwp:transport=dt_socket,address=8787,server=y,suspend=n -Dzcache="Y" %MEM_SET% -classpath "%JBOSS_CLASSPATH%";%LIBENDORSE_DIR%\xercesImpl.jar;%LIBENDORSE_DIR%\xml-apis.jar -Djava.security.manager -Djava.security.policy=../conf/cimom/cimom.policy -Dsys.root=%SystemRoot% org.jboss.Main -Dzzz.conf=%ZZZ_CONF% -Djava.rmi.server.hostname=%COMPUTERNAME% -Djboss.bind.address=%COMPUTERNAME%

          The UIL Service xml file picks up the computer name from the command line arguments -Djboss.bind.address=%COMPUTERNAME%

          <mbean code="org.jboss.mq.il.uil2.UILServerILService"
           name="jboss.mq:service=InvocationLayer,type=UIL2">
          
           <!-- The server chain -->
           <depends optional-attribute-name="Invoker">jboss.mq:service=Invoker</depends>
           <!-- JNDI binding -->
           <attribute name="ConnectionFactoryJNDIRef">ConnectionFactory</attribute>
           <!-- JNDI binding for XA -->
           <attribute name="XAConnectionFactoryJNDIRef">XAConnectionFactory</attribute>
           <!-- The bind address -->
           <attribute name="BindAddress">${jboss.bind.address}</attribute>


          Despite supplying the hostname from commandline, the UILService is getting bound to one of the interface IPAddresses, I found this out by looking at the SpyConnectionFactory stub at the remote client during debugging.
          Object tmp = jndiContext.lookup("ConnectionFactory");
           TopicConnectionFactory tcf = (TopicConnectionFactory) tmp;
           _conn = tcf.createTopicConnection();
           System.out.println("\nJMS topic connection created");

          It says the endpoint for the server is bound to an interface IPAddress. I would like to see it bound to hostname because there is quite a possibility that the client cannot reach the interface to which the UILService is bound or otherwise if application changes the IPAddress of the adapter(my application can change the adapter tcp/ip properties) to which the server is bound, then the UIL Service stub becomes stale because the old IPAdress is invalid for the case where the client could reach the network on which UIL Service is bound to an IPAddress.


          • 3. Re: On a multihomed server, how to bind jms service to hostn
            Sridhar Jallapuram Newbie

            Thanks for the reply, I formulated the previous message and sat on it and then posted. Then I noticed that you already posted a reply for the first message. I will test the ConnectAddress option and come back...

            • 4. Re: On a multihomed server, how to bind jms service to hostn
              Sridhar Jallapuram Newbie

              I used ClientAddress first and the resultant client proxy contained the endpoint with an IPAddress instead of the hostname. I tried to use ConnectAddress in 4.0.2 but got exceptions as it is not supported in 4.0.2. Is there a way I can stay in 4.0.2 version and be able to get proxy which contains hostname as endpoint.