Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Where is the jndi.properties file located in j2ee.jar File

 
ragi singh
Ranch Hand
Posts: 198
Oracle Suse
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am writing code for JMS application .However , I am getting javax.naming.InitialContext exception . Now i want to access jndi.properties file . Can anyone tell me where i can find the jndi.properties file in the j2ee.jar file
 
Bryan Copeland
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There's a shortcut which I found after lots of sifting through online resources/specs and


Summary:

1. you just need to create your own jndi.properties like a regular .properties file (start a plaintext file in your IDE and rename .properties, or, just a basic text editor like vi or notepad)

2. set the JMS properties to the location of your actual JMS server, some optional config, and any Topic or Queue names you want to create

3. package the jndi.properties as a .jar and include it in your buildpath (simply add as a library in your IDE and it will automagically add to your buildpath)



My sample jndi.properties for ActiveMQ:





Check these out for more info:
ActiveMQ - http://activemq.apache.org/jndi-support.html
jBoss - http://docs.jboss.org/jbossmessaging/docs/usermanual-2.0.0.beta1/html/using-jms.html
 
ragi singh
Ranch Hand
Posts: 198
Oracle Suse
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Where are we getting the org.apache.activemq.jndi.ActiveMQInitialContextFactory class from ?
How are we setting the java.naming.factory.initial field
 
Bryan Copeland
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You need to be sure to include activemq5.3.1-all.jar in your project buildpath, they all come from the ActiveMQ library...
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic