cancel
Showing results for 
Search instead for 
Did you mean: 

EJB Lookup

Former Member
0 Kudos

I am trying to lookup an EJB facade from J2EE library. I packaged the home and remote interfaces as part of this lbrary for narrowing the looked up object. But the look up is returning ObjectReferenceImpl. Any thoughts how to solve this?

Accepted Solutions (0)

Answers (3)

Answers (3)

Former Member
0 Kudos

Appreciate your response. This is not a path issue. This is little more complex than that. I am packaging the remote & home interfaces in library for class reference. But class loader will treat these classes different from the classes present in the ejb app and fails to load the lookedup bean and returns ObjectReferenceImpl. This happens because the library and ejb app both are in the same jvm. If client is outside it works perfectly.

"Vladimir Pavlov" from SAP server team wrote an article explaining how to look up ejbs from diff clients. He said lookup from J2ee libraries is possile but didnt explain it clearly. I am hoping he would shed some light on this.

Edited by: Venkat Vadlamannati on Jul 10, 2009 10:48 AM

Former Member
0 Kudos

Hi,

Check the JNDI name of the ejb:

For local lookup check this below help:

http://help.sap.com/saphelp_nw04/helpdata/en/38/3e5a4201301453e10000000a155106/content.htm

Try remote lookup using the below code:

http://help.sap.com/saphelp_nw04/helpdata/en/08/8f633e0084e946e10000000a114084/frameset.htm

public String lookupEjb()
{
           String result="";
          
           try {
            Properties env = new Properties();
            env.put(Context.INITIAL_CONTEXT_FACTORY, "com.sap.engine.services.jndi.InitialContextFactoryImpl");
            env.put(Context.PROVIDER_URL, "p4://host:port ");
            env.put(Context.SECURITY_PRINCIPAL, "username");
            env.put(Context.SECURITY_CREDENTIALS, "password");
         
            InitialContext context = new InitialContext(env);
            String jndiName = "";
            result+=context.lookup(jndiName);
          } catch (Exception e) {
          return "Error while lookup: "+e.getCause();
        }
 return result;

Regards,

Charan

siarhei_pisarenka3
Active Contributor
0 Kudos

Hi

It seems you are trying the lookup with the wrong JNDI path. What is the path?

BR, Sergei