Ok, I double checked (with the latest CVS JBoss), with the following:
<snip language="jython">
from java.lang import *;
from java.util import *;
from javax.naming import *;
env = Hashtable();
env.put(Context.INITIAL_CONTEXT_FACTORY,
"org.jnp.interfaces.NamingContextFactory");
env.put(Context.PROVIDER_URL, "jnp://reason.boldfish.com:1099");
env.put(Context.URL_PKG_PREFIXES, "org.jboss.naming:org.jnp.interfaces");
print env;
ctx = InitialContext(env);
print ctx
print ctx.lookup("java:/Mail");
ctx.close();
</snip>
Using a classpath with the following:
jython.jar
activation.jar
mail.jar
jndi.jar
jboss-client.jar
jbosssx-client.jar
jbossmq-client.jar
jnp-client.jar
Will produce this output:
<snip>
{java.naming.provider.url=jnp://reason.boldfish.com:1099,
java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory,
java.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces}
javax.naming.InitialContext@30fc1f
Traceback (innermost last):
File "/home/jason/tmp/test.py", line 14, in ?
javax.naming.ServiceUnavailableException: jnp. Root exception is
java.net.UnknownHostException: jnp
at java.net.InetAddress.getAllByName0(InetAddress.java:571)
at java.net.InetAddress.getAllByName0(InetAddress.java:540)
at java.net.InetAddress.getByName(InetAddress.java:449)
at java.net.Socket.<init>(Socket.java:100)
at
org.jnp.interfaces.NamingContext.getServer(NamingContext.java:102)
at org.jnp.interfaces.NamingContext.checkRef(NamingContext.java:763)
at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:340)
at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:333)
at javax.naming.InitialContext.lookup(InitialContext.java:350)
at java.lang.reflect.Method.invoke(Native Method)
at
org.python.core.PyReflectedFunction.__call__(PyReflectedFunction.java:158)
at org.python.core.PyMethod.__call__(PyMethod.java:83)
at org.python.core.PyObject.__call__(PyObject.java:272)
at org.python.core.PyInstance.invoke(PyInstance.java:275)
at org.python.pycode._pyx0.f$0(/home/jason/tmp/test.py)
at org.python.pycode._pyx0.call_function(/home/jason/tmp/test.py)
at org.python.core.PyTableCode.call(PyTableCode.java:155)
at org.python.core.Py.runCode(Py.java:1055)
at org.python.core.__builtin__.execfile(__builtin__.java:288)
at org.python.core.__builtin__.execfile(__builtin__.java:292)
at
org.python.util.PythonInterpreter.execfile(PythonInterpreter.java:155)
at org.python.util.jython.main(jython.java:159)
javax.naming.ServiceUnavailableException:
javax.naming.ServiceUnavailableException: jnp [Root exception is
java.net.UnknownHostException: jnp]
</snip>
So I can create an InitialContext, but as soon as I try to lookup anything I
will get an exception.
--jason
On Sun, 6 May 2001, Jason Dillon wrote:
> I will check again. I do belive that this will work, but I think that
> there might be a problem when it comes to using lookup() on the
> InitialContext. I will try this again and let you know... I might be
> doing something wrong =)
>
> --jason
>
>
> On Sat, 5 May 2001, Scott M Stark wrote:
>
> > Its been about a week. Here is a simple test that works against the current cvs:
> >
> > jboss 722>cat tstNS.java
> > import java.util.Properties;
> > import javax.naming.*;
> >
> > class tstNS
> > {
> > public static void main(String[] args) throws NamingException
> > {
> > Properties env = new Properties();
> > env.setProperty(Context.INITIAL_CONTEXT_FACTORY,
>"org.jnp.interfaces.NamingContextFactory");
> > env.setProperty(Context.PROVIDER_URL, "jnp://localhost:1099");
> > env.setProperty(Context.URL_PKG_PREFIXES ,
>"org.jboss.naming:org.jnp.interfaces");
> > InitialContext ctx = new InitialContext(env);
> > System.out.println("Connected to JNDI");
> > }
> > }
> > jboss 723>java -classpath "/tmp/cvs/jboss/dist/client/jnp-client.jar;." tstNS
> > Connected to JNDI
> > jboss 724>
> >
> > Most likely your using a jndi.properties that does not include the
>org.jnp.interfaces
> > package in the URL_PKG_PREFIXES if this does not work for you.
> >
> > ----- Original Message -----
> > From: "Jason Dillon" <[EMAIL PROTECTED]>
> > To: <[EMAIL PROTECTED]>
> > Sent: Friday, May 04, 2001 9:50 PM
> > Subject: Re: [JBoss-user] Anyone know how to federate across multiple jnp ...
> >
> >
> > > How recently was this added? I am just curious, because the EJB handle
> > > impl that I added (for container remembrance) would not work if I set the
> > > url to jnp://<host>:<port>, I had to set it to <host>:<port>.
> > >
> > > --jason
> > >
> > > On Fri, 4 May 2001, Scott M Stark wrote:
> > >
> > > > This is an issue seperate from References of type URL, but the jnp
> > > > InitialContextFactory does now accept jnp urls passed in via the provider url
> > > > property.
> >
> >
> >
> > _______________________________________________
> > JBoss-user mailing list
> > [EMAIL PROTECTED]
> > http://lists.sourceforge.net/lists/listinfo/jboss-user
> >
>
>
> _______________________________________________
> JBoss-user mailing list
> [EMAIL PROTECTED]
> http://lists.sourceforge.net/lists/listinfo/jboss-user
>
_______________________________________________
JBoss-user mailing list
[EMAIL PROTECTED]
http://lists.sourceforge.net/lists/listinfo/jboss-user