This week's book giveaway is in the Testing forum.
We're giving away four copies of Data Structures the Fun Way: An Amusing Adventure with Coffee-Filled Examples and have Jeremy Kubica on-line!
See this thread for details.
  • 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
  • Tim Cooke
  • Devaka Cooray
  • Ron McLeod
  • Jeanne Boyarsky
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Piet Souris
  • Carey Brown
  • Tim Holloway
Bartenders:
  • Martijn Verburg
  • Frits Walraven
  • Himai Minh

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.
 
Do the next thing next. That’s a pretty good rule. Read the tiny ad, that’s a pretty good rule, too.
the value of filler advertising in 2021
https://coderanch.com/t/730886/filler-advertising
reply
    Bookmark Topic Watch Topic
  • New Topic