File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes EJB and other Java EE Technologies and the fly likes Basic JNDI problem Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "Basic JNDI problem" Watch "Basic JNDI problem" New topic

Basic JNDI problem

Mintoo kumar
Ranch Hand

Joined: Aug 21, 2007
Posts: 61
Hi Folks,

I have just started practising JNDI but facing some basic problem.
Just wanted to play with directory and files in my system to get understanding of JNDI.

I have written following CODE
javax.naming.Context c = new javax.naming.InitialContext(System.getProperties());
Object o = c.lookup("c:\");


if i simply run my class after removing "Object o = c.lookup("c:\").
it gives same error , i am posting my error below.
ERROR! Shared library ioser12 could not be found.
javax.naming.NamingException: Error accessing repository: Cannot connect to ORB
at com.sun.enterprise.naming.EJBCtx.<init>(
at com.sun.enterprise.naming.EJBInitialContextFactory.getInitialContext(
at javax.naming.spi.NamingManager.getInitialContext(
at javax.naming.InitialContext.getDefaultInitCtx(
at javax.naming.InitialContext.init(
at javax.naming.InitialContext.<init>(
at jndi.TestJndi.main(
before posting the message I have searched the previous post but could not able to find anything useful.
If anybody have idea. do let me know.
Prabhat Jha
Ranch Hand

Joined: Aug 13, 2007
Posts: 58
Two things i can see namely:

1. Does this code compile??? It should be "C:\\" and not "C:\" on windows.

2. Next you are using System.getProperties() to initialize your InitialContext, have you set the environment properties appropriately. You need to mention the class who is going to be the provider of the JNDI.

Hope this helps

SCJP 1.5, SCWCD 1.5, SCBCD 1.5
I agree. Here's the link:
subject: Basic JNDI problem
jQuery in Action, 3rd edition