Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

NameNotFoundException during JNDI lookup

Hi !

I am really new in developing java on SAP Netweaver 7.1. In the past i used JBOSS.

Unfortunately i dont find the solution that fixes my problem in the forums here.

My problem is as follows:

I created a stateless session bean (EJB 3.0) in the developerstudio named "WorkerBean.java" and the interface "WorkerRemote.java". Its only a hello world bean.

Then I deployed the WorkerEAR with the DeveloperStudio on my NetWeaver 7.1 without problems. The Netweaver stans in the local network in the company.

Now I wrote a java client to call and test the WorkerBean via remote over JNDI lookup.

The client looks this way:

public class Main {
public static void main(String[] args){
        
try{	
      Properties props = new Properties();
      props.put(Context.INITIAL_CONTEXT_FACTORY, "com.sap.engine.services.jndi.InitialContextFactoryImpl");
      props.put(Context.PROVIDER_URL, "10.XXX.17.XXX:50004");
        
        Context ctx = new InitialContext(props);
			
        Object o = ctx.lookup("ejb:/sap.com/WorkerEAR/REMOTE/WorkerBean/WorkerRemote");
        WorkerRemote ref = (WorkerRemote)PortableRemoteObject.narrow(o, WorkerBean.class);
        String msg = ref.sayHello();
        System.out.println(">>>"+ ref.sayHello());
.....
...

So now I get a Error when I execute the main class:

com.sap.engine.services.jndi.persistent.exceptions.NameNotFoundException:

Path to object does not exist at ejb:, the whole lookup name is ejb:/sap.com/WorkerEAR/REMOTE/WorkerBean/WorkerRemote.

at com.sap.engine.services.jndi.implserver.ServerContextImpl.getLastContainer(ServerContextImpl.java:241)

at com.sap.engine.services.jndi.implserver.ServerContextImpl.lookup(ServerContextImpl.java:559)

at com.sap.engine.services.jndi.implserver.ServerContextRedirectableImpl.lookup(ServerContextRe

I dont understand, where the problem is, because i did the same as described on this sap help page:

http://help.sap.com/saphelp_nwce10/helpdata/en/45/e692b2cfaa5591e10000000a1553f7/frameset.htm

note: I dont setup any ejb-j2ee-engine.xml or application-j2ee-engine.xml because I thought its not nesscerary.

Can anybody help me please ?

Thanks in advance and sry for my english,

hendrik

Former Member
replied

Hi Henne,

I would propose you to use the simplest format of the ejb scheme lookup strings, try just:

"ejb:/interfaceName=test.WorkerRemote"

/you are right the interface name property is the name of the EJB business interface you want to use as client view after the lookup operation/

or

"ejb:/beanName=WorkerBean,interfaceName=test.WorkerRemote"

/beanName property is the name of the bean. By default the bean name in ejb 3.0 is the bean class name (without the package)/

Best Regards,

Krasimir Topchiyski

0 View this answer in context
Not what you were looking for? View more on this topic or Ask a question