Chinaunix首页 | 论坛 | 博客
  • 博客访问: 506135
  • 博文数量: 1345
  • 博客积分: 3000
  • 博客等级: 中校
  • 技术积分: 14830
  • 用 户 组: 普通用户
  • 注册时间: 2010-06-14 20:32
文章分类

全部博文(1345)

文章存档

2010年(1345)

我的朋友

分类:

2010-10-31 22:21:45

  1:本地调用   前提:   (1)被调用者实现了local接口   (2)调用者和被调用者应该在同一ejb模块打包文件(ear)內,由于是本地调用,也就是说调用者和被调用者应运行于同一个ejb容器内,所以,想用类似main函数调用的企图都是不能成功的(因为main函数不可能运行于ejb容器)。   (3)调用者的部署描述(ejb-jar.xml)中有关于被调用者的local ref的描述。   示例如下:   比如我有一个无状态sessionbean(被访问者):mapsessionbean,一个访问用的sessionbean:accessbean   其中accessbean的ejb-jar.xml应有被调用者的local ref描述,否则,不能进行本地调用: xml version="1.0" encoding="utf-8"?> doctype ejb-jar public "-//sun microsystems, inc.//dtd enterprise javabeans 2.0//en" ""> testejbdisplay-name> mapsessionejb-name> co.test.bean.mapsessionhomehome> co.test.bean.mapsessionremote> co.test.bean.mapsessionlocalhomelocal-home> co.test.bean.mapsessionlocallocal> co.test.bean.mapsessionbeanejb-class> statelesssession-type> containertransaction-type> ejb/mapsessionejb-ref-name> sessionejb-ref-type> co.test.bean.mapsessionlocalhomelocal-home> co.test.bean.mapsessionlocallocal> mapsessionejb-link> ejb-local-ref> session> accessbeanejb-name> co.test.bean.accessbeanhomehome> co.test.bean.accessbeanremote> co.test.bean.accessbeanlocalhomelocal-home> co.test.bean.accessbeanlocallocal> co.test.bean.accessbeanbeanejb-class> statelesssession-type> containertransaction-type> ejb/mapsessionejb-ref-name> sessionejb-ref-type> co.test.bean.mapsessionlocalhomelocal-home> co.test.bean.mapsessionlocallocal> mapsessionejb-link> ejb-local-ref> session> enterprise-beans> ejb-jar>   本地调用代码如下: 如果喜欢websphere ejb远程/本地调用总结请收藏或告诉您的好朋友.
阅读(165) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~