Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Call EJB from Servlet

 
nga nguyet
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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(LoaderHandler.java:531)
at java.rmi.server.RMIClassLoader$2.loadProxyClass(RMIClassLoader.java:628)
at java.rmi.server.RMIClassLoader.loadProxyClass(RMIClassLoader.java:294)
at sun.rmi.server.MarshalInputStream.resolveProxyClass(MarshalInputStream.java:238)
at java.io.ObjectInputStream.readProxyDesc(ObjectInputStream.java:1500)
at java.io.ObjectInputStream.readClassDesc(ObjectInputStream.java:1463)
at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1699)
 
Ankit Garg
Sheriff
Posts: 9510
22
Android Google Web Toolkit Hibernate IntelliJ IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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...
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic