The Session Bean i have written is here
import javax.ejb.Stateless;
/**
*
* @author root
*/
@Stateless
public class CustomerBankBusinessBean implements CustomerBankBusinessRemote {
// @PersistenceUnit(name="bank_server")
// private EntityManagerFactory emf;
// private EntityManager entity;
public void saveCustomer(Object obj) throws Exception {
try {
System.out.print("<========================>");
//entity = emf.createEntityManager();
//entity.getTransaction().begin();
//entity.persist(obj);
//entity.getTransaction().commit();
} catch(Exception e) {
javax.swing.JOptionPane.showMessageDialog(null,e);
throw e;
} finally {
//entity.clear();
}
}
}
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package ebankejb.server.business.stateless.bank;
import javax.ejb.Remote;
/**
*
* @author root
*/
@Remote
public interface CustomerBankBusinessRemote {
public void saveCustomer(Object obj) throws Exception;
}
-------------------------------------------------------
The client code to connect the server
public void save(Object obj) {
try {
System.setSecurityManager(new RMISecurityManager());
sun.corba.BridgePermission b= new BridgePermission("tes");
this.customerBankBusinessRemote = (CustomerBankBusinessRemote)
this.ctx.lookup("ebankejb.server.business.stateless.bank." +
"CustomerBankBusinessRemote");
ebankclient.persistobj.bank.Customer c = new Customer();
c.setName("afadsf");
this.customerBankBusinessRemote.saveCustomer(c);
//System.out.println("ASDFADSFASDFASDFASDFASDFAsd");
/* object ob = ctx.lookup("ebankejb.server.business.stateless.bank.CustomerBankBusinessRemote");
customerBankBusinessRemote = (CustomerBankBusinessRemote) PortableRemoteObject.narrow(ob,CustomerBankBusinessRemote.class);
customerBankBusinessRemote.saveCustomer(obj);
this.customerBankBusinessRemote.saveCustomer(obj);*/
} catch(Exception e) {
javax.swing.JOptionPane.showMessageDialog(null, e);
}
}
----------------------------------------------------------
ORB setting in my glassfish
private Properties getEJBProperties() {
if (this.prop == null) {
this.prop = new Properties();
prop.setProperty("java.naming.factory.initial","com.sun.enterprise.naming.SerialInitContextFactory");
prop.setProperty("java.naming.factory.url.pkgs","com.sun.enterprise.naming");
prop.setProperty("java.naming.factory.state","com.sun.corba.ee.impl.presentation.rmi.JNDIStateFactoryImpl");
this.prop.setProperty("org.omg.CORBA.ORBInitialHost","localhost");
this.prop.setProperty("org.omg.CORBA.ORBInitialPort","34169");
}
return this.prop;
}
my port listener is 34169 i've set it by my self.
As told you if i want to send a primitive variable like String or int my program works good.
But when i want to send an object the exception is appeared.
i dont have local interface because i dont need local business why do i create a local business?
Is it nesscery or not to have a local business!?