1, Local/Remote/WebService Bean
Local就是在自己应用中调用。 同一个JVM。 可以传递引用
Remote用RMI的方式调用。值传递
2, Stateful/ Stateless
Stateful 保存实例变量
Stateless 共享实例变量, 单例模式
3, 分布式事务 JTA
在原来调用Bean的基础上加上一个session
[img]http://dl.iteye.com/upload/attachment/0065/6710/7516a968-2ff1-39cf-8058-418372dc5d14.jpg[/img]
[img]http://dl.iteye.com/upload/attachment/0076/2810/430845ce-ffa1-3a39-9665-934fdcd78e4e.jpg[/img]
4, 客户端用main测试EJB服务器端
Local就是在自己应用中调用。 同一个JVM。 可以传递引用
Remote用RMI的方式调用。值传递
2, Stateful/ Stateless
Stateful 保存实例变量
Stateless 共享实例变量, 单例模式
3, 分布式事务 JTA
在原来调用Bean的基础上加上一个session
[img]http://dl.iteye.com/upload/attachment/0065/6710/7516a968-2ff1-39cf-8058-418372dc5d14.jpg[/img]
[img]http://dl.iteye.com/upload/attachment/0076/2810/430845ce-ffa1-3a39-9665-934fdcd78e4e.jpg[/img]
4, 客户端用main测试EJB服务器端
Hashtable<String, String> environment = new Hashtable<String, String>();
environment.put("java.naming.factory.initial","weblogic.jndi.WLInitialContextFactory");
environment.put("java.naming.provider.url", "t3://【IP】:25679");
environment.put("java.naming.security.principal", "appadmin");
environment.put("java.naming.security.credentials", "itrcpwdxx11");
Context context= new InitialContext(environment);
System.out.println("get naming context:" + context.toString());
Object ref = context.lookup("DeviceGroupBean#com.hp.it.sp4ts.devicegroup.DeviceGroupBeanSharedRemote");
System.out.println("look up jndi name");
System.out.println(ref);
DeviceGroupBeanSharedRemote deviceGroupeEJB = (DeviceGroupBeanSharedRemote) ref;
DeviceGroupServiceResponse dgResponse = deviceGroupeEJB.getDeviceGroupsByUserGroupId(null, null, null);
System.out.println(dgResponse);