File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes EJB and other Java EE Technologies and the fly likes Call EJB from Servlet Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of REST with Spring (video course) this week in the Spring forum!
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "Call EJB from Servlet" Watch "Call EJB from Servlet" New topic

Call EJB from Servlet

nga nguyet

Joined: Apr 04, 2009
Posts: 1
Hi all,
Now i'm Learning EJB, i have proplem but I can't fix, can you help me, thanks very much. My program have EJB is

public class SessionBean implements ISessionBeanRemote {

public String GetAddress(String param) {
return "Agribank";

public String GetName(String param) {
return "Hoang Phuong Thuc";

and Interface :
public interface ISessionBeanRemote {

String GetAddress(String param);

String GetName(String param);


I uses function lookup:
Properties env = new Properties();

// Definir las propiededes y ubicacion de busqueda de Nombres JNDI.
env.setProperty("java.naming.factory.initial", "org.jnp.interfaces.NamingContextFactory");
env.setProperty("java.naming.provider.url", "localhost:1099");
env.setProperty("java.naming.factory.url.pkgs", "org.jboss.naming");

Context context=new InitialContext(env);

String name="SessionBean/remote";
ISessionBeanRemote sessionBeanBean=(ISessionBeanRemote)context.lookup(name);

When I write in Main function is OK but not OK in servlet, and have Error is:

java.lang.ClassNotFoundException: agribank.ISessionBeanRemote (no security manager: RMI class loader disabled)
at sun.rmi.server.LoaderHandler.loadProxyClass(
at java.rmi.server.RMIClassLoader$2.loadProxyClass(
at java.rmi.server.RMIClassLoader.loadProxyClass(
at sun.rmi.server.MarshalInputStream.resolveProxyClass(
Ankit Garg

Joined: Aug 03, 2008
Posts: 9452

I'm not a pro at this so I did some googling and I think this tutorial might help you. I think this is happening because of some security reasons...

SCJP 6 | SCWCD 5 | Javaranch SCJP FAQ | SCWCD Links
I agree. Here's the link:
subject: Call EJB from Servlet
jQuery in Action, 3rd edition