From: Samuele P. <pe...@in...> - 2001-06-12 14:43:09
|
Hi. > > Hi all. I'm working on writing a small client to an EJB in jython, that > I've already implemented in Perl. I'm using JBoss as my ejb server. I'm > stumped on calling javax.naming.initialContext. > > Here's a snippet of the java code: > > ---- JAVA CODE -------- > Properties env = new Properties(); > env.setProperty("java.naming.factory.initial", > "org.jnp.interfaces.NamingContextFactory"); > env.setProperty("java.naming.provider.url", "localhost:1099"); > env.setProperty("java.naming.factory.url.pkgs", > "org.jboss.naming"); > > InitialContext jndiContext = new InitialContext(env); > Object ref = jndiContext.lookup("interest/Interest"); > ----- END JAVA CODE ----- > > here's what I'm trying in jython: > > ---- JYTHON CODE -------- > env = java.util.Properties() > env.setProperty("java.naming.factory,initial", > "org.jnp.interfaces.NamingContextFactory") > env.setProperty("java.naming.provider.url", "localhost:1099") > env.setProperty("java.naming.factory.url.pkgs", "org.jboss.naming") > > jndiContext = javax.naming.InitialContext() where's the env here, jndiContext = javax.naming.InitialContext(env) could help ;) > jndiContext.lookup("interest/Interest"); > ---- END JYTHON CODE ---- > > Here's the error I'm getting w/ the jython code: > > File "interest.py", line 15, in ? > 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 > > Looking up javax.naming.InitialContext, I see this for its constructor: > > public InitialContext(java.util.Hashtable environment) throws > NamingException > > What I would guess, being almost totally new to both Jython and Java, is > that "env" is not being properly passed as a java.util.Hashtable, and > therefore I'm not getting a context to do my name lookup in. > > I notice that NoInitialContext is thrown when JNDI cannot create an > initial context. > > Any pointers would be much appreciated. > > ----------------------------------------------------------------------------- > Brian Knox > Just Another Perl Hacker > perl -le '$_="6110>374086;2064208213:90<307;55";tr[0->][ LEOR!AUBGNSTY];print' > > > > > _______________________________________________ > Jython-users mailing list > Jyt...@li... > http://lists.sourceforge.net/lists/listinfo/jython-users |