File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes EJB and other Java EE Technologies and the fly likes Where to put jndi.properties Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "Where to put jndi.properties" Watch "Where to put jndi.properties" New topic
Author

Where to put jndi.properties

Timothy Sam
Ranch Hand

Joined: Sep 18, 2005
Posts: 746
Hi

I have a client and an EJB deployed in JBoss. They're in the same machine. My jndi.jar is in the same directory as my client and I have the following folder structure for my client

MyApp
- Client
- MyApp.java
- jndi.properties

However, when I try to run my client program I get the following error...


Exception in thread "main" javax.naming.NoInitialContextException: Need to speci
fy class name in environment or system property, or as an applet parameter, or i
n an application resource file: java.naming.factory.initial
at javax.naming.spi.NamingManager.getInitialContext(Unknown Source)
at javax.naming.InitialContext.getDefaultInitCtx(Unknown Source)
at javax.naming.InitialContext.getURLOrDefaultInitCtx(Unknown Source)
at javax.naming.InitialContext.lookup(Unknown Source)
at client.MyApp.main(Unknown Source)



Source code looks like this...



SCJP 1.5
http://devpinoy.org/blogs/lamia/ - http://everypesocounts.com/
Pradeep bhatt
Ranch Hand

Joined: Feb 27, 2002
Posts: 8919

Is jndi.properties in the Client folder ?


Groovy
sudha swami
Ranch Hand

Joined: Apr 24, 2007
Posts: 179
Hi,
You should put the jndi.properties in the following folder:
\jboss\server\default\conf. Hope this works.
regards
sudha
Pradeep bhatt
Ranch Hand

Joined: Feb 27, 2002
Posts: 8919

Originally posted by sudha swami:
Hi,
You should put the jndi.properties in the following folder:
\jboss\server\default\conf. Hope this works.
regards
sudha


How would putting jndi.properties help when running the client side code ?
 
jQuery in Action, 2nd edition
 
subject: Where to put jndi.properties