Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

How do an application client to access remote EJB ?  RSS feed

 
mojo lai
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have an EJB called "RemoteEJB1Bean" deployed on 140.112.91.185
Server is Sun Application Java Server 9.1 with Java EE 5

I write an application client on 140.112.91.185 like this

public static void main(String[] args) throws Exception {
InitialContext ic=new InitialContext();
RemoteEJB1Remote my=(RemoteEJB1Remote)ic.lookup("RemoteEJB1Bean");
System.out.println(my.sayHello());
}
It works well.

BUT I want to write an application client on DIFFERENT HOST using iiop, exception occured, here is my code :

public static void main(String[] args) throws Exception {
Properties props1 = new Properties();
props1.setProperty("java.naming.factory.initial", "com.sun.enterprise.naming.SerialInitContextFactory");
props1.setProperty("java.naming.factory.url.pkgs", "com.sun.enterprise.naming");
props1.setProperty("java.naming.factory.state", "com.sun.corba.ee.impl.presentation.rmi.JNDIStateFactoryImpl");
props1.setProperty("org.omg.CORBA.ORBInitialHost", "140.112.91.185");
props1.setProperty("org.omg.CORBA.ORBInitialPort", "3700");
InitialContext ic = new InitialContext(props1);
System.out.println(ic.lookup("RemoteEJB1Bean"));
}

exception is :
javax.naming.NameNotFoundException: RemoteEJB1Bean not found

What should I do ?
[ February 02, 2008: Message edited by: mojo lai ]
 
Don't get me started about those stupid light bulbs.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!