• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Jeanne Boyarsky
  • Liutauras Vilda
  • Campbell Ritchie
  • Tim Cooke
  • Bear Bibeault
Sheriffs:
  • Paul Clapham
  • Junilu Lacar
  • Knute Snortum
Saloon Keepers:
  • Ron McLeod
  • Ganesh Patekar
  • Tim Moores
  • Pete Letkeman
  • Stephan van Hulst
Bartenders:
  • Carey Brown
  • Tim Holloway
  • Joe Ess

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

 
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 ]
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!