how to use application to call a remote EJB?

this is my code:

package test;

import javax.naming.Context;

import javax.naming.InitialContext;

import javax.rmi.PortableRemoteObject;

import java.util.*;

import test.HelloWorldHome;

import test.HelloWorld;

public class callremoteEjb{

public String callejb(){

try{

Properties env = new Properties();

System.setProperty("org.omg.CORBA.ORBInitialHost", "202.120.80.219");

System.setProperty("org.omg.CORBA.ORBInitialPort", "7001");

env.put(Context.INITIAL_CONTEXT_FACTORY,

"com.sun.enterprise.naming.SerialInitContextFactory");

env.put(Context.PROVIDER_URL, "t3://202.120.80.219:7001");

Context initial = new InitialContext(env);

Object objref = initial.lookup("HelloWorldBean");

HelloWorldHome home = (HelloWorldHome)PortableRemoteObject.narrow(

objref,HelloWorldHome.class);

HelloWorld helloBean = home.create();

return helloBean.sayHello();

}catch(Exception ex){

ex.printStackTrace();

}

return "aaa";

}

public static void main(String[] args){

callremoteEjb testejb = new callremoteEjb();

System.out.println(testejb.callejb());

}

}

i ' ve success deploy the EJB in the remote server.

but it run error : " Can't find SerialContextProvider "

how should i do?

[1376 byte] By [yananay] at [2007-12-28]
# 1
There is a sample called rmi-iiop. It has a Java applicationclient that talks to a remote ejb. Pl have a look at that.Sahoo
sahoo_s_k at 2007-7-6 > top of java,Enterprise & Remote Computing,AVK Portability...