[jboss-user] [JNDI/Naming/Network] - PortableRemoteObject.narrow() returns null

One_Special_User do-not-reply at jboss.com
Wed Aug 2 18:38:08 EDT 2006


Hello, I fairly assume this problem is related to my other topic "RMI-IIOP":


I've deployed a Stateless SessionBean using IIOP bound to JNDI "mytest/MyBean" (even verified by JNDIView).
I've implemented a C#-Client, on which I can look it up and access it, no problem.

But with a Java-Client things just won't work.
I can look it up and get an instance of "org.omg.stub.javax.ejb._EJBHome_Stub" returned. But PortableRemoteObject.narrow( obj, MyBeanHome.class ) 'ing the reference to my Home-Interface "MyBeanHome" returns NULL, so i always get a NullPointerException when calling home.create(). I've included the jbossall-client.jar to classpath.

Nevertheless, compared to other source-examples it seems to me there's no mistake:
public static void main(String[] args) throws Throwable {
  |     
  |     props.put(Context.INITIAL_CONTEXT_FACTORY, "org.jnp.interfaces.NamingContextFactory");
  |     props.put(Context.PROVIDER_URL,            "jnp://localhost:1099" );
  |     props.put(Context.URL_PKG_PREFIXES,        "org.jboss.naming:org.jnp.interfaces" );
  |     Context ctx    = new InitialContext( props );
  |     System.out.println( "Got InitialContext!" );
  |     
  |     String jndi    = "mytest/MyBean";
  |     Object obj_ref = ctx.lookup( jndi );
  |     System.out.println( "Got Reference for : " + jndi );
  |     System.out.println( "Class             : " + obj_ref.getClass() );
  | 
  |     MyBeanHome home = (MyBeanHome)PortableRemoteObject.narrow( obj_ref, MyBeanHome.class );
  |     MyBean mybean   = home.create();
  |     System.out.println( "Got MyBean: " + mybean.getTime() ); 
  |     
  | }

Same, i cannot access MyBean from another SessionBean - same result: PortableRemoteObject.narrow() returns NULL.

The problem persists on JBoss 4.0.0, 4.0.3 and 4.0.4.
JDK: 1.5.0
I'm using the "all" - profile (since IIOP-support and -all- services are included)
The only thing i've modified is, that i've commented out "<jnp-context>iiop</jnp-context>" in the IIOP-invoker-proxy-binding - Section in StandardJBoss.xml



I can't figure out it must be that a problem since I think it is common that EJBs are ACCESSIBLE by clients or other EJBs ;-)

Any hint is warmly appreciated!

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3962657#3962657

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3962657



More information about the jboss-user mailing list