• 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 ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

sending JMS message to ESB from JBoss app

 
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi. I've just started working with JMS and ESB.
I have jboss-esb.xml file with following snippet
in my .esb file on jboss where ESB resides,
and a class that makes a connection to JMS :
on my machine.
Later on, same object sends a message, my message driven bean receives that message from JMS, and it all works fine.

But,
when I deploy sender class on jboss (on my machine), and try to execute same code, I get following exception message:


Does my object in that case even point to machine 192.168.0.100 (on which ESB resides) ? Or, does jboss-deployed class have to do something more to connect to JMS ?
 
author
Posts: 5856
7
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Usually, when looking up JNDI names within the app server, you do not specify the naming properties. In other words you need do only this:



Try making the above change to your code to see if it works. If it does, then we can decide where to go from there.
 
Dragan Jovanovic
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Well, in fact, that was previous version of my code. And it also works only in standalone application. I've set these system properties because I had impression that my jboss does not know where to send message.
 
Peter Johnson
author
Posts: 5856
7
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The same code will work in a client if you provide a jndi.properties file - the client's JNDI code will load the properties from that file. Usually that is the best way to provide the properties because then you can easily change the host name or IP address.

The next thing to do is use JNDIview to examine the JNDI tree to make sure your queue is registered: http://www.jboss.org/community/wiki/DisplayTheJNDITreeWithTheJMXConsole

If that shows the queue, then the next thing to try is to change your app to look up only "queue" in the namespace and then dump the names found under "queue". It would be interesting to do this both in the case where it works and where it doesn't.
 
Dragan Jovanovic
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks, Peter.
The problem was that my code makes JMS connection only once, while initialising object which sends messages. Looks like that code was executing before something important (maybe initialising of JMS) when I start it with JBoss (for some other reason, it's deployed in lib folder, to deploy, so I cannot redeploy it).
I discovered that while trying to execute

following your advice.
Thanks again.
 
Peter Johnson
author
Posts: 5856
7
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

it's deployed in lib folder


Your app should not be in the lib directory, it should be in server/xxx/deploy.

What kind of app do you have? You can provide a jboss-specific config file that includes a dependency on the queue's mbean - this way your app will not be deployed until the queue is deployed.
 
Dragan Jovanovic
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Your app should not be in the lib directory, it should be in server/xxx/deploy.


I know. But if I deploy it to deploy folder, I cannot just instantiate my class from other-jar's code, I must use session beans in that case. So, this way is a bit easier. (And in fact, it's my boss's idea.)

The same code will work in a client if you provide a jndi.properties file - the client's JNDI code will load the properties from that file. Usually that is the best way to provide the properties because then you can easily change the host name or IP address.


I know. I've tried that version of code too, and I've sent you most compact code version to review. Of course I will return these settings to file.

What kind of app do you have?


In that jar I have small set of frequently-used utility classes, which all of our (wanna be SOA) services will use. That jar should be deployed on all production jboss instances.

You can provide a jboss-specific config file that includes a dependency on the queue's mbean - this way your app will not be deployed until the queue is deployed.


Hmm... sounds nice. I'll think that way. Thanks.
 
I once met a man from Nantucket. He had a tiny ad
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic