users@glassfish.java.net

Bizarre inconsistency between EJB and JMS when obtaining InitialContext()

From: <glassfish_at_javadesktop.org>
Date: Fri, 19 Dec 2008 08:51:53 PST

I just tripped over an apparently bizarre inconsistency when obtaining an InitialContext();

[ running Glassfish version: Sun Java System Application Server 9.1_02 (build b06-p02) ]

It appears that, when fetching an EJB reference from an initialContext, any properties passed explicitly to the InitialContext are used in preference to the same vales set in System properties. As I'd expect.

However, when looking up JMS objects, things happen [i]the other way around[/i] - ie. System properties take priority over explicit properties!

I wrote a simple EJB and MDB that factorize a number, with a remote client to drive them, initialized as follows:

        System.setProperty("org.omg.CORBA.ORBInitialHost", "werner.wss");
        System.setProperty("org.omg.CORBA.ORBInitialPort", "1737");

        Properties props = new Properties();
        props.put("org.omg.CORBA.ORBInitialHost", "localhost");
        props.put("org.omg.CORBA.ORBInitialPort", "2037");
                
        Context ctx = new InitialContext(props);
                        
        cf = (ConnectionFactory)ctx.lookup("jms/QueueConnectionFactory");
        jmsQueue = (Destination)ctx.lookup("jms/FactorizerQueue");
        factorizer = (Factorizer) ctx.lookup("ejb/FactorizerEJB");

When invoking the EJB factorizer, it connects to the server at localhost:2037 and works just fine; The JMS one however, (presumably after having obtained its connection factory) tries to connect to the queue at werner.wss:1737 (where there is a Glassfish running but this application is not deployed) resulting in this output:

19-Dec-2008 16:38:15 com.sun.messaging.jms.ra.ResourceAdapter start
INFO: MQJMSRA_RA1101: SJSMQ JMS Resource Adapter starting...
19-Dec-2008 16:38:15 com.sun.messaging.jms.ra.ResourceAdapter start
INFO: MQJMSRA_RA1101: SJSMQ JMSRA Started:REMOTE
19-Dec-2008 16:38:15 com.sun.messaging.jms.ra.ManagedConnectionFactory setPassword
INFO: MQJMSRA_MF1101: setPassword:NOT setting default value
19-Dec-2008 16:38:15 com.sun.messaging.jms.ra.ManagedConnectionFactory setAddressList
INFO: MQJMSRA_MF1101: setAddressList:NOT setting default value=localhost
19-Dec-2008 16:38:15 com.sun.messaging.jms.ra.ManagedConnectionFactory setUserName
INFO: MQJMSRA_MF1101: setUserName:NOT setting default value=guest

19-Dec-2008 16:38:17 com.sun.messaging.jms.ra.ManagedConnection <init>
INFO: MQJMSRA_MC1101: constructor:Created mcId=1:xacId=48165550577120768: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://werner:1776/, imqOverrideJMSHeadersToTemporaryDestinations=false}

Any ideas gratefully received, thanks,
Ed.
[Message sent by forum member 'edrandall' (edrandall)]

http://forums.java.net/jive/thread.jspa?messageID=322678