users@glassfish.java.net

GF 3.1.1 - JMS connection blocked - Worked great with GF 2.1

From: Richard Blaha <rd_blaha_at_hotmail.com>
Date: Wed, 16 Nov 2011 15:54:47 -0500

We have a system that has been working quite well for over two years interfacing Glassfish 2.1.

It was created as a Java Desktop Application and added JMS connectivity based on the Javaee 1.4 Tutorial.

From a Netbeans project perspective the project had the following structure

Guiclient
    Source Packages
        <default package>
            ...
        META-INF
            application-client.xml
            jndi.properties
            sun-application-client.xml
        META-INF.services
            org.jdesktop.application.Application
        com.company.java.files
            ...

I have generated the new appclient.jar from GF 3.1.1. I have modified the classpath regarding the deployed appclient.jar in my startup batch file (Thank you Tim Quinn for your very helpful information).

All resources have been added to the GF 3.1.1 that were on the original GF 2.1 setup that were required.

My META-INF/jndi.properties file information was correctly setup to connect from my PC to the server that has GF 3.1.1 installed.

Here is the following generic code

        logger.log(Level.INFO, "==================================================================");
        logger.log(Level.INFO, " JNDI SERVER INFO");
        try
            {
            InitialContext jndiCtx = config.getInitialContext();

            // Begin DEBUG related code
            Hashtable jndiCtxHsh = jndiCtx.getEnvironment();
            String jndiCtxNameInNamespace = jndiCtx.getNameInNamespace();
            logger.log(Level.INFO, "Connect: jndiCtxHsh ["+jndiCtxHsh.toString()+"]");
            logger.log(Level.INFO, "Connect: jndiCtxNameInNamespace ["+jndiCtxNameInNamespace+"]");
            // Ended DEBUG related code

            logger.log(Level.INFO, "Connect: connectionFactory = jndiCtx.lookup( \"jms/GenericQueueFactory\")");
* connectionFactory = (ConnectionFactory) jndiCtx.lookup("jms/GenericQueueFactory");
            logger.log(Level.INFO, "Connect: dest1 = jndiCtx.lookup( \"jms/GenericQueue\")");
            dest1 = (Destination) jndiCtx.lookup("jms/GenericQueue"); // defined earlier from cmd line
            logger.log(Level.INFO, "Connect: dest2 = jndiCtx.lookup( \"jms/ResponseTopic\")");
            dest2 = (Destination) jndiCtx.lookup("jms/ResponseTopic"); // defined earlier from cmd line

            logger.log(Level.INFO, "Connect: connection = connectionFactory(createConnection()");
            connection = connectionFactory.createConnection();
            logger.log(Level.INFO, "Connect: session = connection.createSession( false, Session.AUTO_ACKNOWLEDGE )");
            session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
            {

When the code reaches the line marked on the left with an asterisk it hangs. I know connection is made from the PC to the server because the /etc/hosts file is used on the server. It was redirecting me to my localhost GF 3.1.1 instance I had running. When the appropriate change was made to the server /etc/hosts file it no longer attempted to connect to my localhost GF 3.1.1 instance.

I have attempted making a glassfish-resources.xml file from the sun-application-client.xml file without any success or changes to my logging output.

I have also written a basic java program to run on my PC and access the MySQL database on the same server that has GF 3.1.1 setup and running. This works perfectly so there is no problem accessing the server. It appears to be definitely GF / JMS connectivity related.

What am I missing? I have been searching forums and tutorials (javaee 1.6 - similar to the javaee 1.4 I used initially to code the producer and consumer code/setups). I have obviously missed the easy answer possibly skillfully hidden somewhere.

I know you are all quite busy, but please help.

Thank you.
rdb