• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Junilu Lacar
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • Rob Spoor
  • Bear Bibeault
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Piet Souris
  • Carey Brown
  • Stephan van Hulst
Bartenders:
  • Frits Walraven
  • fred rosenberger
  • salvin francis

JMS - problem with client connecting to remote server

 
Ranch Hand
Posts: 39
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

The post seems to be big. But I am missing a very minute detail. Please help me find it.

I have the applicaion server(sun GlassFish Enterprise server 2.1) installed on one machine(I am calling it server).The server sends messages and other machines(called clients) should receive them. I created an instance of QueueConnectionFactory and physical destination queue in the admin console of the server. Then I tried (both MessageSender and MessageReceiver programs on same machine) on localhost.It worked well. I tried to access the server remotely from another machine i.e I want the server to send messages and the other machine to collect them. I wrote the following program on the client machine,

try {
Properties p=new Properties();
p.put(Context.INITIAL_CONTEXT_FACTORY,"com.sun.appserv.naming.S1ASCtxFactory");
p.put("com.sun.appserv.iiop.endpoints","serveroipaddress:3700");
p.put("java.naming.factory.url.pkgs","com.sun.enterprise.naming");
p.put("java.naming.factory.state","com.sun.corba.ee.impl.presentation.rmi.JNDIStateFactoryImpl");
System.setProperty("org.omg.CORBA.ORBInitialHost","serveripaddress");
System.setProperty("org.omg.CORBA.ORBInitialPort","3700");
p.put("java.naming.provider.url","iiop://serveripaddress:3700";);
jndiContext = new InitialContext(p);
topicConnectionFactory = (QueueConnectionFactory)jndiContext.lookup("QueueConnectionFactory");
topic = (Queue) jndiContext.lookup("queue1");
topicConnection =topicConnectionFactory.createQueueConnection();
topicSession =topicConnection.createQueueSession(false,Session.AUTO_ACKNOWLEDGE);
topicSubscriber =topicSession.createReceiver(topic);
topicListener = new MessageLis();
topicSubscriber.setMessageListener(topicListener);
topicConnection.start();
}catch(Exception e){
}

When I run the program, I get the following output:

Feb 6, 2009 1:17:38 PM com.sun.appserv.naming.RoundRobinPolicy setClusterInstanceInfo
INFO: endpoint.weight after checking isWeight = 10
Feb 6, 2009 1:17:38 PM com.sun.appserv.naming.RoundRobinPolicy setClusterInstanceInfo
INFO: sumOfAllWeights = 10
Feb 6, 2009 1:17:44 PM com.sun.appserv.naming.S1ASCtxFactory getCorbalocURL
INFO: iiopendpoints:list[i] ==> serveripaddress:3700
Feb 6, 2009 1:17:44 PM com.sun.appserv.naming.S1ASCtxFactory getCorbalocURL
INFO: corbaloc url ==> iiop:1.2@serveripaddress:3700
Feb 6, 2009 1:17:45 PM com.sun.messaging.jms.ra.ResourceAdapter start
INFO: MQJMSRA_RA1101: SJSMQ JMS Resource Adapter starting...
Feb 6, 2009 1:17:46 PM com.sun.messaging.jms.ra.ResourceAdapter start
INFO: MQJMSRA_RA1101: SJSMQ JMSRA Started:REMOTE
Feb 6, 2009 1:17:46 PM com.sun.messaging.jms.ra.ManagedConnectionFactory setAddressList
INFO: MQJMSRA_MF1101: setAddressList:NOT setting default value=localhost
Feb 6, 2009 1:17:46 PM com.sun.messaging.jms.ra.ManagedConnectionFactory setPassword
INFO: MQJMSRA_MF1101: setPassword:NOT setting default value
Feb 6, 2009 1:17:46 PM com.sun.messaging.jms.ra.ManagedConnectionFactory setUserName
INFO: MQJMSRA_MF1101: setUserName:NOT setting default value=guest
Feb 6, 2009 1:17:46 PM com.sun.messaging.jms.ra.ManagedConnection <init>
INFO: MQJMSRA_MC1101: constructor:Created mcId=1:xacId=1523376988712913664:Using xacf config={imqOverrideJMSPriority=false, imqConsumerFlowLimit=1000, imqOverrideJMSExpiration=false, imqAddressListIterations=3, imqLoadMaxToServerSession=true, imqConnectionType=TCP, imqPingInterval=30, imqSetJMSXUserID=false, imqConfiguredClientID=, imqSSLProviderClassname=com.sun.net.ssl.internal.ssl.Provider, imqJMSDeliveryMode=PERSISTENT, imqConnectionFlowLimit=1000, imqConnectionURL=http://localhost/imq/tunnel, imqBrokerServiceName=, imqJMSPriority=4, imqBrokerHostName=localhost, imqJMSExpiration=0, imqAckOnProduce=, imqEnableSharedClientID=false, imqAckTimeout=0, imqAckOnAcknowledge=, imqConsumerFlowThreshold=50, imqDefaultPassword=guest, imqQueueBrowserMaxMessagesPerRetrieve=1000, imqDefaultUsername=guest, imqReconnectEnabled=true, imqConnectionFlowCount=100, imqAddressListBehavior=RANDOM, imqReconnectAttempts=3, imqSetJMSXAppID=false, imqConnectionHandler=com.sun.messaging.jmq.jmsclient.protocol.tcp.TCPStreamHandler, imqSetJMSXRcvTimestamp=false, imqBrokerServicePort=0, imqDisableSetClientID=false, imqSetJMSXConsumerTXID=false, imqOverrideJMSDeliveryMode=false, imqBrokerHostPort=7676, imqQueueBrowserRetrieveTimeout=60000, imqSetJMSXProducerTXID=false, imqSSLIsHostTrusted=false, imqConnectionFlowLimitEnabled=false, imqReconnectInterval=5000, imqAddressList=mq://serveripaddress:7676/,mq://clientipaddress:7676/, imqOverrideJMSHeadersToTemporaryDestinations=false}
Feb 6, 2009 1:17:47 PM com.sun.messaging.jmq.jmsclient.ExceptionHandler throwConnectionException
WARNING: [C4003]: Error occurred on connection creation [clientipaddress:7676]. - cause: java.net.ConnectException: Connection refused: connect
Feb 6, 2009 1:17:54 PM com.sun.messaging.jmq.jmsclient.ExceptionHandler throwConnectionException

Why am I unable to connect to the server?
Should I put client information on the server(using admin console)? Should I install Application server on the client machine also?
Please help me.

Regards,
Chandana.
 
Ranch Hand
Posts: 2187
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
On the client machine, in order for the client application to connect to the queue's on the server, it must have the class libraries of the server, e.g. appserv-deployment-client.jar, etc.
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic