I’m trying to bind an object using jndi. It works great on my local machine, but when I move the application to another machine and attempt to bind “over the network” I get an NPE in NamingContext. I have to be missing something. Can some please help me out with this. It’s driving me _crazy_.

 

This is the Exception, and the Code is below.

 

I looked at the source for NamingContext and line 251, and 222 are nothing.

<exception>

java.lang.NullPointerException:

        at org.jnp.interfaces.NamingContext.bind(NamingContext.java:251)

        at org.jnp.interfaces.NamingContext.bind(NamingContext.java:222)

        at javax.naming.InitialContext.bind(InitialContext.java:303)

        at com.tradingproduce.TestMemberRegistration.bindObject(TestMemberRegistration.java:84)

        at com.tradingproduce.TestMemberRegistration.<init>(TestMemberRegistration.java:23)

        at com.tradingproduce.TestMemberRegistration.main(TestMemberRegistration.java:27)

</exception>

 

Server is the class which implements extends UnicastRemoteObject and implements the remote interface(this is rmi specific, do I still have to do this for jndi?) Jboss is running on 63.199.148.48 and naming is started on port 2101.

<code>

public void bindObject(){

     try{

       if(System.getSecurityManager() == null){

        System.setSecurityManager(new RMISecurityManager());

       }

       ObjectSignatureFactory osf = new ObjectSignatureFactory();

       ObjectSignature signature = osf.getObjectSignature(this);

 

       System.setProperty("java.naming.factory.initial", "org.jnp.interfaces.NamingContextFactory");

       System.setProperty("java.naming.provider.url", "63.199.148.48:2101");

       Server server = new Server();

 

       //bind that baby!

       new InitialContext().bind("/applet/" + signature.getSignature(), server);

       System.out.println("Server bound and running..");

     }catch(Exception e){e.printStackTrace();}

   }

</code>

 

What am I missing here?

 

-jdm

Reply via email to