[Logo]
Forums Register Login
How do an application client to access remote EJB ?
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 ]
He's my best friend. Not yours. Mine. You can have this tiny ad:
Thread Boost - a very different sort of advertising
https://coderanch.com/t/674455/Thread-Boost-feature


This thread has been viewed 410 times.

All times above are in ranch (not your local) time.
The current ranch time is
Apr 24, 2018 22:34:14.