users@glassfish.java.net

JMS LOCAL REMOTE

From: Lucas Jordan <lucasjordan_at_gmail.com>
Date: Mon, 7 Jul 2008 17:59:07 -0400

I have written an app such that the client applications (FLEX) use JMS
to communicate with each other. That is to say, the client is both a
consumer and producer. The application works great when run from a
single instance of glassfish and I am now in the process of setting up
the application to use 2 or more instances of glassfish in a load
balanced way. Just for completeness, here is how the flex app
describes its connection to JMS:

<destination-type>topic</destination-type>
<message-type>javax.jms.ObjectMessage</message-type>
<connection-factory>eDesignTopicFactory</connection-factory>
<destination-jndi-name>eDesignTopic</destination-jndi-name>

Where eDesignTopicFactory is defined Resources/JMS Resources/
Connection Factories
and eDesignTopic is defined in Resources/JMS Resources/
DestinationResources. It also has the property Name=eDesignDestination


So I figure that each instance of glassfish should use a single
destination (topic), so clients connected to glassfish A would receive
messages sent through glassfish A and B.

Eventually I want to set up JMS in a clustered, hi availability way,
but for now I want to get something a little simpler to work. My first
step was to try and get glassfish set up to use a LOCAL JMS setup,
instead of the default EMBEDDED set up.

So, simply changing EMBEDDED to LOCAL (after a domain restart) yeilds
the following output:

[#|2008-07-07T17:39:22.021-0400|INFO|sun-appserver9.1|
javax.resourceadapter.mqjmsra.outbound.connection|
_ThreadID=17;_ThreadName=httpSSLWorkerThread-8080-1;|MQJMSRA_MC1101:
constructor:Created mcId=8:xacId=7706814546852124928: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=localhost:7676,
imqOverrideJMSHeadersToTemporaryDestinations=false}|#]

[#|2008-07-07T17:39:22.161-0400|WARNING|sun-appserver9.1|
javax.jms.connection|
_ThreadID=19;_ThreadName=MessageReceiveThread-0;_RequestID=b949feee-
b195-4219-a3a0-149e4c7d082e;|[W2003]: Broker not responding [STOP(22)]
for 120 seconds. Still trying..., broker addr=localhost:7676(60152),
connectionID=7706814546852087552, clientID=null, consumerID=11|#]


and an error on the client saying:
Consumer Fault: Client is unsubscribed because its corresponding JMS
consumer for JMS destination 'eDesignTopic' encountered an error
during message delivery: [C4063]: Cannot perform operation, consumer
is closed.

The out put of jps is:
13331 NetworkServerControl
13556 Broker
13565 Jps
13538 PELaunch
13151 Main
12494

So it looks like the broker s running (13556), assuming that is what I
think it is.

Question 1) The broker should start and stop with the application
server right? if not, how is it started, stopped.
Question 2) What steps am I missing in order to use a LOCAL jms broker?





I then tried to connect instance A of glassfish to an embedded broker
running in instance B.
Again I set up instance B to work with the application.
Then I created a new JMS host on instance A called remote_host with
the settings:
host: 192.168.254.5 (the address of instance B)
port: 7676
admin username: admin (the default value)
admin password: admin (the default value)

Set the Type=REMOTE and changes the default JMS Host and restarted.
when I hit ping I get this output:

[#|2008-07-07T17:53:44.170-0400|WARNING|sun-appserver9.1|
javax.resourceadapter.mqjmsra.lifecycle|
_ThreadID
=20;_ThreadName=httpWorkerThread-4848-4;_RequestID=9c00cdfb-66c3-4778-
a322-664df45f3f79;|MQJMSRA_RA4001:
getJMXServiceURLList:Exception:Message=Caught exception when contacing
portmapper.|#]

[#|2008-07-07T17:53:44.567-0400|WARNING|sun-appserver9.1|
javax.enterprise.system.stream.err|
_ThreadID
=20;_ThreadName=httpWorkerThread-4848-4;_RequestID=9c00cdfb-66c3-4778-
a322-664df45f3f79;|java.io.IOException: Failed to retrieve RMIServer
stub: javax.naming.ConfigurationException [Root exception is
java.rmi.UnknownHostException: Unknown host: localhost.localdomain;
nested exception is:
        java.net.UnknownHostException: localhost.localdomain]
        at javax.management.remote.rmi.RMIConnector.connect(RMIConnector.java:
317)
        at
javax
.management
.remote.JMXConnectorFactory.connect(JMXConnectorFactory.java:248)
        at
com
.sun
.enterprise
.connectors
.system
.MQJMXConnectorInfo.getMQMBeanServerConnection(MQJMXConnectorInfo.java:
123)
        at
com
.sun
.enterprise.admin.mbeans.JMSDestination.JMSPing(JMSDestination.java:287)
        at
com
.sun
.enterprise.admin.mbeans.ResourcesMBean.JMSPing(ResourcesMBean.java:
2461)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAcce

and many more exceptions complaining about localhost.localdomain,
which is weird, since JMS host is configured for 92.168.254.5



Any help would be really really great!
-Lucas