• Post Reply Bookmark Topic Watch Topic
  • New Topic

Local Client JMS Connection to Local Glassfish?  RSS feed

 
George Berish
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I hope you mean it when you said greenhorns welcome, because after three days of searching I can't make this simple, seemingly generic example work.

My glassfish4 server runs on "localhost".

My java GUI client is run by Eclipse.

My glassfish4 Admin Console clearly shows under Resources/JMS Resouces/Connection Factories that I have a ConnectionFactory properly configured with a JNDI name = "jms/goConnectionFactory"

So by all that's holy, and many many postings, this code should result with my Java client in possession of that Connection Factory. But it refuses.

Can anyone please help?

Here is the code.

println(jndiContext.toString()) statement in the code prints this to the console
javax.naming.InitialContext
So I have some kind of context, I just don't know how to test it to see if it is really from glassfish or some Default context.

A try catch block around lookup() catches a NullPointerException.

I have glassfish-naming.jar in my path. It clearly contains com.sun.enterprise.naming.impl.SerialInitContextFactory.
Ditto imq-4.2.jar that has a lot of com.sun.messaging and com.sun.jms classes.

I can't see anything in the server log that indicates glassfish even notices when my client runs the above code.

I mean its such a trivial bit of code ... and such a common test environment (i.e. local Eclipse java client trying to get a connection to a local glassfish server) there must be hundreds of examples. But I can't find one. (Oracal is so focused on interactions between EJB containers it seems blind to anyone using a plain old java client.)

Ditto most other postings ... Session beans to other Session beans ... on same servers or separate ones. And they all use injection instead of properties.

Thanks for any help of suggestions.







Junk-Ranch-Attachment.jpg
[Thumbnail for Junk-Ranch-Attachment.jpg]
 
K. Tsang
Bartender
Posts: 3648
16
Firefox Browser Java Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
First you need to make sure the JMS queue/topic is indeed mapped to "jms/goConnectionFactory"

Second you may want to print out what "jndiContext" is before looking up. If this is already null then your Properties may have something to do with it.

A full stack trace will help.
 
George Berish
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks.

Here is a complete truncated Class whose only purpose is to secure a ConnectionFactory.

Here is the console ouput.

I tried to attach a screen shot of my glassfish console that shows there really is a ConnectionFactory configured under Resources/JMS Resources/Connection Factories with a jndi name of "jms/goConnectionFactory". But the web page doesn't seem to show it on preview. If it doesn't show up I'll try again all by itself.

Note: The attachment to the first post mistakenly showed the jms.Queue resources, but my local client never has to look them up. So I'm sure if I can get a ConnectionFactory the rest will fall back into place.

I truly appreciate any help or suggestions. This seems to be about as simple a step, using the simplest test code, with the most generic set up, I can imagine. And it's been defeating me all week.
CodeRanchExample.jpg
[Thumbnail for CodeRanchExample.jpg]
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!