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. [WC 2014]紫荆花之恋

    Description 强强和萌萌是一对好朋友.有一天他们在外面闲逛,突然看到前方有一棵紫荆树.这已经是紫荆花飞舞的季节了,无数的花瓣以肉眼可见的速度从紫荆树上长了出来. 仔细看看的话,这个大树实际上 ...

  2. 为了异常安全(swap,share_ptr)——Effecive C++

    互斥锁: 假设我们要在多线程中实现背景图片的控制: class PrettyMenu{ public: -- void changeBackground(std::istream& imgSr ...

  3. hihocoder 1035 : 自驾旅行 III

    描述 给定一棵含有 n 个结点的树,结点从 1 标号.你从 1 号结点驾车出发,希望遍历一些关键结点(访问到就好,不需要按照这些关键结点的输入顺序).每条边有两个权值,c0, c1 分别表示步行和驾车 ...

  4. bzoj2442[Usaco2011 Open]修剪草坪 单调队列优化dp

    2442: [Usaco2011 Open]修剪草坪 Time Limit: 10 Sec  Memory Limit: 128 MBSubmit: 1159  Solved: 593[Submit] ...

  5. LCD接口和RGB介绍【转】

    转自:https://www.cnblogs.com/hzl6255/p/5470583.html 阅读目录 1. 介绍 2. 接口类型 3. RGB 4. YUV 5. FOURCC 回到顶部 1. ...

  6. python3 字符串str 教程

    字符串可以用单引号或双引号来创建. Python 不支持单字符类型,单字符也在Python也是作为一个字符串使用. 例: var1 = 'Hello World!' var2 = "Pyth ...

  7. ThreadLocal基本原理及运用

    ThreadLocal提供本地线程变量.这个变量里面的值(通过get方法获取)是和其他线程分割开来的,变量的值只有当前线程能访问到,不像一般的类型比如Person,Student类型的变量,只要访问到 ...

  8. Java高新技术第一篇:类加载器详解

    首先来了解一下字节码和class文件的区别: 我们知道,新建一个Java对象的时候,JVM要将这个对象对应的字节码加载到内存中,这个字节码的原始信息存放在classpath(就是我们新建Java工程的 ...

  9. Linux阿里云挂载磁盘,并开机自动挂载

    Linux下磁盘挂载 公司新订购阿里云ECS,需要挂载当前的磁盘.暂时没有运维,自己动手挂载磁盘. 具体步骤如下: 1.查看是否已经分配 [root@iZ2ze1tefvghtbgkdur3xfZ / ...

  10. 网站用户身份识别俩大招之cookie

    导航: 原理介绍 代码实现 过程分析 追踪Cookie 原理介绍 众所周知,http协议是无状态的协议,简单理解是用户的前一步操作和后一步操作之间没有关系,互相不知道,不干扰.而在很多场景下,浏览网页 ...