users@glassfish.java.net

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

From: Cheng Fang <cheng.fang_at_oracle.com>
Date: Sun, 27 Nov 2011 11:46:22 -0500

Hi Richard,

What's the content of your META-INF/jndi.properties? Why do you need
have your own jndi.properties, in addition to the default one available
in glassfish library jars? I guess one of the reasons may be to specify
target information. Can you specify the dest info as system properties
in command line?

If your custom jndi.properties is only packaged in META-INF/ of
appclient jar, I doubt it is loaded correctly, unless it is also
included somewhere else in client classpath.

Have you tried running server and client on the same host with the
default jndi.properties? Just to narrow it down.

If you use $GLASSFISH_HOME/lib/gf-client.jar:<application-classes> as
your client classpath, does it make any difference?

-cheng

On 11/16/11 3:54 PM, Richard Blaha wrote:
> 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
>