• 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

NoInitialContextException error

 
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

I am trying to implement JMS Queues in simple java program(Not a J2EE application).I am using the jndi.properties to define the queue names and the connection factory.

I have placed the jndi.properties file in the current directory and configured the jndi.properties entry in my classpath. But still I am facing the following exception


Error connecting to null queue...
.................... 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 com.gtech.esc.server.engine.JMSMessageHandler$UnsoRequestQueue.run(JMSMessageHandler.java:413)

I didnt face any problem when creating the initialContext but i am facing this issue when it tries to lookup

Line No 412 & 413 in JMSMessageHandler :

initialContext = new InitialContext();
connFactory = (ConnectionFactory) initialContext.lookup("ConnectionFactory");

Could anyone please provide me a solution for this problem.

Thanks
Prasanna
 
Ranch Hand
Posts: 405
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

If you installed a new version of the J2SE SDK without first removing the previous one, this problem and others can result.

Regards,

Ujjwal B Soni
 
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
Maybe you're not configuring your jndi properly. Whenever you do not set it correctly it can find your objects in the application server and raise such an exception.
 
reply
    Bookmark Topic Watch Topic
  • New Topic