Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

InitialContext Exception?

0 views
Skip to first unread message

asafbu

unread,
Feb 13, 2002, 12:12:20 PM2/13/02
to

Please take a look at the code snippet from one of my test programs:

props.list(System.out); //props capture System properties + more
Context initial = new InitialContext ( props );
Object objref = initial.lookup (obj);

As you see, I'm printing out all of my properties, using Properties.list() and
I do see following in my command window:

INITIAL_CONTEXT_FACTORY=weblogic.jndi.WLInitialContextFactory
PROVIDER_URL=t3://localhost:7001

Which means I've everything, I needed for the JNDI lookup but
get following exceptions:

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:643)
at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:246)
at javax.naming.InitialContext.getURLOrDefaultInitCtx(InitialContext.java:283)
at javax.naming.InitialContext.lookup(InitialContext.java:350)
at com.brokatfs.EjbClient.callEjb(EjbClient.java:237)
at com.brokatfs.util.ExtractUBData.main(ExtractUBData.java:52)
Could not feed user billing data, reason: NamingException

Rob Woollen

unread,
Feb 13, 2002, 1:42:41 PM2/13/02
to
You need to set the property javax.naming.Context.PROVIDER_URL. It's a String constant.
I believe the actual value is java.naming.provider.url, but you should just use the
constant.

Take a look at any of the WLS EJB examples.

-- Rob

0 new messages