epesh
I'm Joseph Ottinger, editor of TheServerSide.com.

Calendar

««Feb 2010»»
SMTWTFS
  123456
78910111213
14151617181920
21222324252627
28

My Bookmarks

My Top Tags

                                       

Mailing List

My RSS Feeds








Search Box

 

Help Me Test JNDI and JMS in Glassfish

posted Friday, 6 April 2007

Would you be willing to test out instantiation of a namespace in JNDI on Glassfish startup? I can't figure out for the life of me why I can't get JMS resources to survive a restart.

It's a simple test, oh, so simple: execute the following commands on a clean installation of Glassfish.

asadmin start-domain
asadmin create-jmsdest -T queue sampleQueue
asadmin create-jms-resource --restype javax.jms.ConnectionFactory jms/ConnectionFactory
asadmin create-jms-resource --restype javax.jms.Queue --property Name=sampleQueue jms/SampleQueue
asadmin list-jndi-entries
asadmin stop-domain

The "list-jndi-resources" should show, among other things, a "jms" namespace. If you add "--context jms" to this, you'll get the ConnectionFactory and SampleQueue references listed out. Now for the second round, the one that perplexes me so. On the same installation, after executing the sequence above:

asadmin start-domain
asadmin list-jndi-entries
asadmin stop-domain

On my systems, on every installation I've tried, including local, embedded, and remote MQ instances, the second run lists no JMS namespace. If I administer the JMS resources from the admin console or from the command line, the resources show up in the namespace, but I am working on an EIS resource, which needs the JMS namespace on startup - this "must administrate first" business is entirely inappropriate for my needs. I don't know whether this is a flaw on my part or on Glassfish' - and I have absolutely no clue as to how to fix it if it's on my part.

Any help? 

So what does this look like? Well, I'll show you. This is running in a Cygwin shell; I installed b40 nightly into C:\tools\glassfish, and linked bin/asadmin.bat to bin/asadmin for the purposes of the script. Here's my output:

jottinger@RLT-jottinger cygdrive/c/tools/glassfish
$ asadmin start-domain
Starting Domain domain1, please wait.
Log redirected to C:\tools\glassfish\domains\domain1\logs\server.log.
Redirecting output to C:/tools/glassfish/domains/domain1/logs/server.log
Domain domain1 is ready to receive client requests.
Additional services are being started in background.
Domain [domain1] is running [Sun Java System Application Server 9.1 (build b40-rc)] with its configuration and logs at: [C:\tools\glassfish\domains].
Admin Console is available at [http://localhost:4848].
Use the same port [4848] for "asadmin" commands.
User web applications are available at these URLs:
[http://localhost:8080 https://localhost:8181 ].
Following web-contexts are available: [/web1 /__wstx-services ].
Standard JMX Clients (like JConsole) can connect to JMXServiceURL:
[service:jmx:rmi:///jndi/rmi://RLT-jottinger:8686/jmxrmi] for domain management purposes.
Domain listens on at least following ports for connections:
[8080 8181 4848 3700 3820 3920 8686 ].
Domain does not support application server clusters and other standalone instances.

jottinger@RLT-jottinger /cygdrive/c/tools/glassfish
$ asadmin create-jmsdest -T queue sampleQueue
Command create-jmsdest executed successfully.

jottinger@RLT-jottinger /cygdrive/c/tools/glassfish
$ asadmin create-jms-resource --restype javax.jms.ConnectionFactory jms/ConnectionFactory
Command create-jms-resource executed successfully.

jottinger@RLT-jottinger /cygdrive/c/tools/glassfish
$ asadmin create-jms-resource --restype javax.jms.Queue --property Name=sampleQueue jms/SampleQueue
Command create-jms-resource executed successfully.

jottinger@RLT-jottinger /cygdrive/c/tools/glassfish
$ asadmin list-jndi-entries
Jndi Entries for server within root context:
UserTransaction: com.sun.enterprise.distributedtx.UserTransactionImpl
TCPLifeCycle: com.sun.xml.ws.transport.tcp.server.glassfish.WSTCPLifeCycleModule
jms: com.sun.enterprise.naming.TransientContext
Command list-jndi-entries executed successfully.

jottinger@RLT-jottinger /cygdrive/c/tools/glassfish
$ asadmin stop-domain
Domain domain1 stopped.

jottinger@RLT-jottinger /cygdrive/c/tools/glassfish
$ asadmin start-domain
Starting Domain domain1, please wait.
Log redirected to C:\tools\glassfish\domains\domain1\logs\server.log.
Redirecting output to C:/tools/glassfish/domains/domain1/logs/server.log
Domain domain1 is ready to receive client requests.
Additional services are being started in background.
Domain [domain1] is running [Sun Java System Application Server 9.1 (build b40-rc)] with its configuration and logs at: [C:\tools\glassfish\domains].
Admin Console is available at [http://localhost:4848].
Use the same port [4848] for "asadmin" commands.
User web applications are available at these URLs:
[http://localhost:8080 https://localhost:8181 ].
Following web-contexts are available:
[/web1 /__wstx-services ].
Standard JMX Clients (like JConsole) can connect to JMXServiceURL:
[service:jmx:rmi:///jndi/rmi://RLT-jottinger:8686/jmxrmi] for domain management purposes.
Domain listens on at least following ports for connections:
[8080 8181 4848 3700 3820 3920 8686 ].
Domain does not support application server clusters and other standalone instances.

jottinger@RLT-jottinger /cygdrive/c/tools/glassfish
$ asadmin list-jndi-entries
Jndi Entries for server within root context:
UserTransaction: com.sun.enterprise.distributedtx.UserTransactionImpl
TCPLifeCycle: com.sun.xml.ws.transport.tcp.server.glassfish.WSTCPLifeCycleModule
Command list-jndi-entries executed successfully.

jottinger@RLT-jottinger /cygdrive/c/tools/glassfish
$ asadmin stop-domain Domain domain1 stopped.
If you'll note the bolded line, that's the jms context; the second run of "list-jndi-entries" does not have it.

tags:            




1. Sivakumar Thyagarajan left...
Sunday, 8 April 2007 7:25 am :: http://blogs.sun.com/sivakumart

This seems to be a new issue. I tried reproducing the steps and could not list the JMS resources as well. However please do not be worried about the JMS resouces :). They are still there but do not show up with asadmin list-jndi-entries. Executing a list-jms-resources would show you the created JMS resources. Currently that is the only workaround I can think of. The application should be able to use the JMS resouces on domain restart as well.

This seems to be a bug in http://fisheye5.cenqua.com/browse/~raw,r=1.3/glas sfish/admin/monitor/src/java/com/sun/enterprise/admin/monitor/jndi/JndiMBea nHelper.java or in the naming subsystem. After lazy initialization of resources, the JMS resources are not bound to JNDI on domain startup and hence the listEntries done in JndiMBeanHelper.java doesn;t show up the JMS resources.

Could you please raise a new issue via https://glassfish.dev.java.net/issues/enter_bug.cgi?issue_type=DEFECT and we shall find out how to fix this. Thanks.