aspose file tools*
The moose likes EJB and other Java EE Technologies and the fly likes JMS HelloWorld Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "JMS HelloWorld " Watch "JMS HelloWorld " New topic
Author

JMS HelloWorld

Ashwin Sridhar
Ranch Hand

Joined: Jul 09, 2011
Posts: 272

Hi,

I am new to JMS. i tried to run following program. But it throws Jndi exception. I am sure i am misssiong something on intialising JNDI.



And the Stack Trace is

javax.naming.NoInitialContextException: Need to specify class name in environment or system property, or as an applet parameter, or in an application resource file: java.naming.factory.initial
at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:645)
at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:247)
at javax.naming.InitialContext.getURLOrDefaultInitCtx(InitialContext.java:284)
at javax.naming.InitialContext.lookup(InitialContext.java:351)
at TestMess.main(TestMess.java:20)


Ashwin Sridhar
SCJP | SCWCD | OCA
Udara Amarasinghe
Ranch Hand

Joined: Aug 17, 2009
Posts: 109

HI Ashwin,

I think you may have miss to create those ConnectionFactory resource with JNDI name "QueueConnectionFactory" or Queue resource with JNDI name "Queue1" inside the server. Try to create them and try again. this document will help you http://download.oracle.com/docs/cd/E19957-01/816-5904-10/816-5904-10.pdf
Ashwin Sridhar
Ranch Hand

Joined: Jul 09, 2011
Posts: 272

Hi udara,

I have missed that part. could please tell me how to create the connectionFactory resource. Couldn't find that part in the various tutorials
Udara Amarasinghe
Ranch Hand

Joined: Aug 17, 2009
Posts: 109

They can create either with using your servers configuration tools or using your EJB applications configuration files

refer these tutorials :
http://help.sap.com/saphelp_nwmobile71/helpdata/en/46/11ff893ebe14dbe10000000a155369/content.htm
http://download.oracle.com/docs/cd/E13222_01/wls/docs90/jms_admin/deployjms.html

And also if you need to read those messages that sent by your client program you have to create MessageDrivenBean that have connected with that message Queue resource.
Ashwin Sridhar
Ranch Hand

Joined: Jul 09, 2011
Posts: 272

Hi,

I had issues in creating Queue and ConnectionFactories. I solved them and now its working.

How to make Message Driven Bean listen to the queue.

Udara Amarasinghe
Ranch Hand

Joined: Aug 17, 2009
Posts: 109

Try this:This is a sample MessageDrivenBean and you may be have to make appropriate changes as your configurations. Deploy this into your server after wrap in a enterprise archive file(EAR).
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: JMS HelloWorld