Win a copy of Rust Web Development this week in the Other Languages forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
  • Tim Cooke
  • Campbell Ritchie
  • Ron McLeod
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Junilu Lacar
  • Rob Spoor
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Tim Moores
  • Jesse Silverman
  • Stephan van Hulst
  • Carey Brown
  • Al Hobbs
  • Piet Souris
  • Frits Walraven

Local Client JMS Connection to Local Glassfish?

Posts: 22
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
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.

[Thumbnail for Junk-Ranch-Attachment.jpg]
Posts: 3648
Android Mac OS X Firefox Browser Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Posts: 22
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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.
[Thumbnail for CodeRanchExample.jpg]
Don't get me started about those stupid light bulbs.
    Bookmark Topic Watch Topic
  • New Topic