cancel
Showing results for 
Search instead for 
Did you mean: 

PortableRemoteObject.narrow(obj, test.class) returns NULL

former_member462539
Participant
0 Kudos

Hello Experts,

I'm getting NULL value when I'm trying to create an instance of EJB bean class. Any idea please, why I'm getting this null value?

This is my scenario. I do have a simple EJB application with a method called sayHello(String name), and this bean Application is deployed on SAP Netweaver server. I'm able to see my bean & method, from EJB explorer(http://host:port/ejbexplorer), and can see a lookup value in JNDI browser(http://host:port/nwa/jndi). I do have client application which is running on same server which is part of CRM engine which is nothing but a simple executable Jar file calling this EJB bean and trying to get the result back from the bean.


Properties props = new Properties();

          props.put(Context.INITIAL_CONTEXT_FACTORY,"com.sap.engine.services.jndi.InitialContextFactoryImpl");

          props.put(Context.PROVIDER_URL, "sapjcd.int.client.com:51104");

        

          try {

          //Context ctx = new InitialContext(props);

          Context ctx = new InitialContext();

          Object obj = ctx.lookup("sap.com/EJBPOCEAR/REMOTE/POCMessage/com.sap.client.test.POCMessageRemote");        

          POCMessageRemote POCMessageRemoteRef = (POCMessageRemote)PortableRemoteObject.narrow(obj, POCMessageRemote.class);

          String msg1 = POCMessageRemoteRef.sayHello("TRAVELER");

Object lookup seems working fine, as I do see a value(com.sap.engine.services.ejb3.runtime.impl.RemoteEJBProxyInvocationHandler@2790bfc6

) in the debugging mode. I'm getting null value when trying to create an instance of POCMessageRemote class through narrow method.

Any help is appreciated.

Regards,

BV POCMessageRemote

Accepted Solutions (0)

Answers (1)

Answers (1)

former_member462539
Participant
0 Kudos

Would anyone please advise what part that I'm missing to lead into this Null error?