[jboss-user] [EJB3] - jndi.properties files is not read

Samuel Navarro do-not-reply at jboss.com
Fri Dec 2 17:18:54 EST 2011


Samuel Navarro [http://community.jboss.org/people/snavarro89] created the discussion

"jndi.properties files is not read"

To view the discussion, visit: http://community.jboss.org/message/639622#639622

--------------------------------------------------------------
Hello everyone,

Im starting to develop with JBoss, and got stuck while trying to create my first application.
Im running JBoss 7.0, maven 3.0.3, Eclipse Indigo 3.7

So, I started with a Hello World Project just to test if my setup was correct, and it worked, I succesfully deployed the project and acces it through a web page.
Then I tried to create a Hello World from my own, but this time I wanted to access my bean from a client application. So I deployed another bean to the server, so far so good, but then I created another project to create a test client application, and I got the following error

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

So I start searching in the web and read a lot of forums (before posting a question that surely was previously asked) and everyone said the same, I needed to add a jndi.properties file to my classpath, so I did, and the error still appeared, then I followed a basic tutorial for  stateless session beans, and did as the tutorial specified, which was the same as I was doing, but insted the client application class, was in the same project, I added the jndi file and the error was still coming up.
I have the following structure
SampleEJBProject
  -ejbModule
     -com.code.project
         -XXX.java
         -YYY.java
         -jndi.properties

This is how I have the file configured
java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory
java.naming.provider.url=localhost:1099  (already tried with jpn:// at the beginning)
java.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces

I searched on how could I be sure that my file was being used and found
loader.getResources("jndi.properties")
Which returns null.

Ive already places the jdni.properties file in the root folder of the classpath and it didnt work.

Is there configuration I may be missing?
Do I need to place jdni.properties file somewhere else?

Thanks in advance!
--------------------------------------------------------------

Reply to this message by going to Community
[http://community.jboss.org/message/639622#639622]

Start a new discussion in EJB3 at Community
[http://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2029]

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/jboss-user/attachments/20111202/920347d6/attachment.html 


More information about the jboss-user mailing list