How to deploy EJB on sun app.
i am facing problem with deploy my 1st EJB
i have no excperince with it at all.
i have deploy them in EJB on sun appliaction server 8.2 but how can i try to use it with it client.
when try to run client says it can not connect to ORB
please give me hand to get up
1-i have this homeobject
import javax.ejb.*;
import java.rmi.RemoteException;
/**
* This is the home interface for HelloBean. This interface
* is implemented by the EJB Server - the
* implemented object is called the Home Object, and serves
* as a factory for EJB Objects.
*
* The create() method in this Home Interface corresponds to
* the ejbCreate() method in HelloBean.
*/
public interface HelloHome extends EJBHome {
/*
* This method creates the EJB Object.
*
* then returns a reference to the newly created EJB Object.
*/
Hello create() throws RemoteException, CreateException;
}
2- this is ojb
import javax.ejb.*;
import java.rmi.RemoteException;
import java.rmi.Remote;
/**
* This is the HelloBean remote interface.
*
* This interface is what clients use to
* interact with EJB objects. The container
* vendor implements this interface. The
* implemented object is the EJB object, which
* delegates method calls to the actual EJB.
*/
public interface Hello extends EJBObject {
/**
* The hello() method returns a greeting to the client.
*/
public String hello() throws RemoteException;
}
3- this is the bean it self.
import javax.ejb.*;
import javax.naming.*;
import javax.rmi.*;
/**
* Demonstration stateless session bean.
*/
public class HelloBean implements SessionBean {
public String test;
//
// EJB-required methods
//
public void ejbCreate() {
System.out.println("ejbCreate()");
}
public void ejbRemove() {
System.out.println("ejbRemove()");
}
public void ejbActivate() {
System.out.println("ejbActivate()");
}
public void ejbPassivate() {
System.out.println("ejbPassivate()");
}
public void setSessionContext(SessionContext ctx) {
System.out.println("setSessionContext()");
}
//
// Business methods
//
public String hello() {
System.out.println("hello()");
return "Hello, World!";
}
}
4- this th client
import javax.ejb.*;
import javax.rmi.*;
import javax.naming.*;
import java.util.*;
public class HelloClient {
public static void main (String args[]) {
Hashtable props = new Hashtable();
InitialContext initCtx;
try {
props.put("java.naming.factory.initial", "com.sun.jndi.cosnaming.CNCtxFactory");
props.put("java.naming.provider.url", "iiop://localhost:1050");
initCtx = new InitialContext(props);
Object obj = initCtx.lookup("HelloHome");
HelloHome hh = (HelloHome) PortableRemoteObject.narrow(obj, HelloHome.class);
Hello h = (Hello)hh.create();
System.out.println(h.hello());
h.remove();
}
catch(Exception e) {
e.printStackTrace();
System.out.println(e.getMessage());
}
}
}

