aspose file tools*
The moose likes EJB and other Java EE Technologies and the fly likes .NameNotFoundException: Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark ".NameNotFoundException: " Watch ".NameNotFoundException: " New topic
Author

.NameNotFoundException:

hemapriya raag
Greenhorn

Joined: Jul 09, 2007
Posts: 4
Hi,
I am trying to run the project given in headfirst ejb 1 chapter by using netbeans where my client file is not able to recognise the bean by using JNDI
My client file is:
----------------------------------------------
package adviceclient;
import Headfirst1.*;
import java.rmi.RemoteException;
import javax.ejb.EJB;
import javax.naming.InitialContext;
import javax.naming.NamingException;
import javax.rmi.PortableRemoteObject;

public class Main {

@EJB
private static Advice2Remote advice2Bean;
public static void main(String[] args) {
try{
InitialContext ic = new InitialContext();
Object o=ic.lookup("ejb/Advice2Bean");
Advice2Home home=(Advice2Home)PortableRemoteObject.narrow(o,Advice2Home.class);
Advice2Remote advisor=home.create();
System.out.print(advisor.getResult2());
}
catch(Exception ex)
{
ex.printStackTrace();
}

}
}
And errors are:
----------------------------------------------------------------

javax.naming.NameNotFoundException: Advice2Bean not found
at com.sun.enterprise.naming.TransientContext.doLookup(TransientContext.java:203)
at com.sun.enterprise.naming.TransientContext.lookup(TransientContext.java:175)
at com.sun.enterprise.naming.TransientContext.lookup(TransientContext.java:179)
at com.sun.enterprise.naming.SerialContextProviderImpl.lookup(SerialContextProviderImpl.java:61)
at com.sun.enterprise.naming.RemoteSerialContextProviderImpl.lookup(RemoteSerialContextProviderImpl.java:116)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at com.sun.corba.ee.impl.presentation.rmi.ReflectiveTie._invoke(ReflectiveTie.java:121)
at com.sun.corba.ee.impl.protocol.CorbaServerRequestDispatcherImpl.dispatchToServant(CorbaServerRequestDispatcherImpl.java:650)
at com.sun.corba.ee.impl.protocol.CorbaServerRequestDispatcherImpl.dispatch(CorbaServerRequestDispatcherImpl.java:193)
at com.sun.corba.ee.impl.protocol.CorbaMessageMediatorImpl.handleRequestRequest(CorbaMessageMediatorImpl.java:1705)
at com.sun.corba.ee.impl.protocol.CorbaMessageMediatorImpl.handleRequest(CorbaMessageMediatorImpl.java:1565)
at com.sun.corba.ee.impl.protocol.CorbaMessageMediatorImpl.handleInput(CorbaMessageMediatorImpl.java:947)
at com.sun.corba.ee.impl.protocol.giopmsgheaders.RequestMessage_1_2.callback(RequestMessage_1_2.java:178)
at com.sun.corba.ee.impl.protocol.CorbaMessageMediatorImpl.handleRequest(CorbaMessageMediatorImpl.java:717)
at com.sun.corba.ee.impl.transport.SocketOrChannelConnectionImpl.dispatch(SocketOrChannelConnectionImpl.java:473)
at com.sun.corba.ee.impl.transport.SocketOrChannelConnectionImpl.doWork(SocketOrChannelConnectionImpl.java:1270)
at com.sun.corba.ee.impl.orbutil.threadpool.ThreadPoolImpl$WorkerThread.run(ThreadPoolImpl.java:479)

please some one help me.........
Freddy Wong
Ranch Hand

Joined: Sep 11, 2006
Posts: 959

Have you mapped your bean with its JDNI name?


SCJP 5.0, SCWCD 1.4, SCBCD 1.3, SCDJWS 1.4
My Blog
Sumit Malik
Ranch Hand

Joined: Jan 05, 2007
Posts: 84
Hi Hemapriya,

As mentioned by Freddy first ensure that ejb is associated jndi name "ejb/Advice2Bean" in your application server.

If you are using jboss you can view already deployed bean through jndiView service(of jmxConsole). Once you land up on service page then by clicking invoke button of view operation you would come to know which are the already deployed bean on your app server.

If you bean is listed there then you can call you bean with mentioned jndi name.

Cheers !!!
Sumit Malik


If at first you don't succeed, don't try skydiving
 
 
subject: .NameNotFoundException: