EJB

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服务器端

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);
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值