EJB 的 jndi语法(在整个调用远程ejb的过程中语法的遵循是相当重要的)

参见jboss-as-quickstarts-7.1.1.CR2\ejb-remote\client\src\main\java\org\jboss\as\quickstarts\ejb\remote\client\RemoteEJBClient.java 中的注释:

<span style="font-size:18px;"><span style="font-size:18px;">  // The JNDI lookup name for a stateless session bean has the syntax of:
// ejb:<appName>/<moduleName>/<distinctName>/<beanName>!<viewClassName> // <appName> The application name is the name of the EAR that the EJB is deployed in
// (without the .ear). If the EJB JAR is not deployed in an EAR then this is
// blank. The app name can also be specified in the EAR's application.xml
//
// <moduleName> By the default the module name is the name of the EJB JAR file (without the
// .jar suffix). The module name might be overridden in the ejb-jar.xml
//
// <distinctName> : AS7 allows each deployment to have an (optional) distinct name.
// This example does not use this so leave it blank.
//
// <beanName> : The name of the session been to be invoked.
//
// <viewClassName>: The fully qualified classname of the remote interface. Must include
// the whole package name.</span></span>

// The JNDI lookup name for a stateful session bean has the syntax of:

// ejb:<appName>/<moduleName>/<distinctName>/<beanName>!<viewClassName>?stateful

<span style="font-size:18px;"><span style="font-size:18px;"> //
// <appName> The application name is the name of the EAR that the EJB is deployed in
// (without the .ear). If the EJB JAR is not deployed in an EAR then this is
// blank. The app name can also be specified in the EAR's application.xml
//
// <moduleName> By the default the module name is the name of the EJB JAR file (without the
// .jar suffix). The module name might be overridden in the ejb-jar.xml
//
// <distinctName> : AS7 allows each deployment to have an (optional) distinct name.
// This example does not use this so leave it blank.
//
// <beanName> : The name of the session been to be invoked.
//
// <viewClassName>: The fully qualified classname of the remote interface. Must include
// the whole package name.</span></span>

现在我们对上面的语法进行细化,这是最容易出错的地方!

1. 纯EJB jar部署中的bean的访问

1.1 JNDI lookup name for astatelesssession bean has the  syntax of:

<span style="font-size:18px;"><span style="font-size:18px;"><span style="font-size:18px;">    ejb:/<moduleName>/<distinctName>/<beanName>!<viewClassName>
或者
ejb:/<moduleName>/<distinctName>//<beanName>!<viewClassName> 比如:
"ejb:/jboss-as-ejb-remote-app/CounterBean!" + RemoteCounter.class.getName()
"ejb:/jboss-as-ejb-remote-app//CounterBean!" + RemoteCounter.class.getName()</span></span></span>

1.2 JNDI lookup name for astatefullsession bean has the  syntax of:

<span style="font-size:18px;"><span style="font-size:18px;">ejb:/<moduleName>/<distinctName>/<beanName>!<viewClassName>?stateful
或者
ejb:/<moduleName>/<distinctName>//<beanName>!<viewClassName>?stateful 比如:
"ejb:/jboss-as-ejb-remote-app/CounterBean!" + RemoteCounter.class.getName()+"?stateful"
"ejb:/jboss-as-ejb-remote-app//CounterBean!" + RemoteCounter.class.getName()+"?stateful"</span></span>

2. 包含在 ear部署中的EJB jar中的bean的访问

2.1 JNDI lookup name for astatelesssession bean has the

syntax of:

<span style="font-size:18px;"><span style="font-size:18px;">ejb:<appName>/<moduleName>/<distinctName>/<beanName>!<viewClassName>
或者
ejb:<appName>/<moduleName>/<distinctName>//<beanName>!<viewClassName> 比如:
"ejb:nms-server-ear/nms-server-ejb/SecuredRemoteSession!" + ISecuredRemoteSession.class.getName()
"ejb:nms-server-ear/nms-server-ejb//SecuredRemoteSession!" + ISecuredRemoteSession.class.getName() 注意: appName 前面没有 斜线 "/"!!! 这是最容易出错的地方!!!
(如果以斜线开头,表明是ejb jar不是在 ear中部署的!!!)</span></span>

2.2 JNDI lookup name for astatefullsession bean has the syntax of:

<span style="font-size:18px;"><span style="font-size:18px;">ejb:<appName>/<moduleName>/<distinctName>/<beanName>!<viewClassName>?stateful
或者
ejb:<appName>/<moduleName>/<distinctName>//<beanName>!<viewClassName>?stateful 注意: <span style="color:#FF0000;">appName 前面没有 斜线 "/"!!! 这是最容易出错的地方!!!</span>
(如果以斜线开头,表明是ejb jar不是在 ear中部署的!!!)</span></span>

总结

看英文文档耐人寻味啊,好好学习英语吧,外网的资料更加的可靠啊!

JBOSS EAP6 系列二 客户端访问位于EAR中的EJB时,jndi name要遵守的规则的更多相关文章

  1. Katalon系列二十一:用例中语句失败处理

    假如有一个用例:1.登陆2.下单3.对历史单评价4.退出 情况一:当第1步执行失败时,我们希望用例不再执行,因为再执行也没有意义了,反而浪费时间:情况二:当第2步执行失败时,我们希望能略过第2步操作, ...

  2. Mybatis系列(二):优化MyBatis配置文件中的配置和解决字段名与实体类属性名不相同的冲突

    原文链接:http://www.cnblogs.com/xdp-gacl/p/4264301.html     http://www.cnblogs.com/xdp-gacl/p/4264425.ht ...

  3. logback系列二:logback在项目中的应用

    1.输出http日志 2.输出dubbo日志 3.输出interfacer日志 4.输出到access,remote,app等目录中

  4. 访问cv::Mat中的数据时遇到的指针类型问题

    在用Opencv的时候由于下图原本的图像尺寸是1111*1111,要进行resize,代码如下: cv::Mat img = cv::imread("//Users//apple//td3/ ...

  5. [知识库分享系列] 二、.NET(ASP.NET)

    最近时间又有了新的想法,当我用新的眼光在整理一些很老的知识库时,发现很多东西都已经过时,或者是很基础很零碎的知识点.如果分享出去大家不看倒好,更担心的是会误人子弟,但为了保证此系列的完整,还是选择分享 ...

  6. ANDROID Porting系列二、配置一个新产品

    ANDROID Porting系列二.配置一个新产品 详细说明 下面的步骤描述了如何配置新的移动设备和产品的makefile运行android. 1.         目录//vendor/创建一个公 ...

  7. 系列二VS项目软件配置工具介绍

    原文:系列二VS项目软件配置工具介绍 Svn和VisualSvn介绍 在使用TortoiseSvn(SVN客户端)+ AnkhSvn(VS2008插件) +VisualSvn Server(版本控制服 ...

  8. [CXF REST标准实战系列] 二、Spring4.0 整合 CXF3.0,实现测试接口(转)

    转自:[CXF REST标准实战系列] 二.Spring4.0 整合 CXF3.0,实现测试接口 文章Points: 1.介绍RESTful架构风格 2.Spring配置CXF 3.三层初设计,实现W ...

  9. Redis总结(五)缓存雪崩和缓存穿透等问题 Web API系列(三)统一异常处理 C#总结(一)AutoResetEvent的使用介绍(用AutoResetEvent实现同步) C#总结(二)事件Event 介绍总结 C#总结(三)DataGridView增加全选列 Web API系列(二)接口安全和参数校验 RabbitMQ学习系列(六): RabbitMQ 高可用集群

    Redis总结(五)缓存雪崩和缓存穿透等问题   前面讲过一些redis 缓存的使用和数据持久化.感兴趣的朋友可以看看之前的文章,http://www.cnblogs.com/zhangweizhon ...

随机推荐

  1. [TJOI 2016&HEOI 2016]求和

    Description 题库链接 求 \[f(n)=\sum_{i=0}^n\sum_{j=0}^i S(i,j)\times 2^j \times (j!)\] \(S(i, j)\) 表示第二类斯 ...

  2. 【网络流问题·我就想建好模】

    ·为了有助于你读后文,在写题前先列出一些大米饼的代码习惯: 一个提醒:所有的ADD函数无特殊说明均如图:(没有w就直接跳过) 以及: go(i,a,b)=====for(int i=a;i<=b ...

  3. bzoj2753[SCOI2012]滑雪与时间胶囊 最小生成树

    Time Limit: 50 Sec  Memory Limit: 128 MBSubmit: 2843  Solved: 993[Submit][Status][Discuss] Descripti ...

  4. 零开始:NetCore项目权限管理系统:基础框架搭建

    有兴趣的同学可以一起做 喜欢NetCore的朋友,欢迎加群QQ:86594082 源码地址:https://github.com/feiyit/SoaProJect 新建一个空的解决方案,建立对应的解 ...

  5. Java利用Apache POI将数据库数据导出为excel

    将数据库中的数据导出为excel文件,供其他人查看 public class POITest { public static void main(String[] args) { POITest te ...

  6. python 字典实现简单购物车

    # -*- coding: utf-8 -*-#总金额asset_all=0i1=input('请输入总资产:')asset_all=int(i1)#商品列表goods=[ {'name':'电脑', ...

  7. c++中双冒号的作用

    双冒号(::)用法 参考链接:https://segmentfault.com/a/1190000000345680 1.表示“域操作符”例:声明了一个类A,类A里声明了一个成员函数void f(), ...

  8. 《Java技术》的第二次作业

    (一)学习总结 1.什么是构造方法?什么是构造方法的重载?下面的程序是否可以通过编译?为什么? (1) 构造方法用于在创建对象时对其进行初始化,且方法名与类名相同,方法名前面没有返回值类型的声明,不能 ...

  9. 关于惠普hp服务器开机时F10菜单变成F10 Function Disabled的解决方法

    今天笔者由于在Intelligent Provisioning智能配置里不小心将"启动Intelligent Provisioning"选项钩选成禁用了,如下 结果就造成,在之后服 ...

  10. SpringMVC中HandlerMapping的三种配置方式

    <?xml version="1.0" encoding="UTF-8" ?> <!DOCTYPE beans PUBLIC "-/ ...