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. 伊布(ib)

    [问题描述]ib 被困在了一个美术馆里,她需要收集美术馆内的每种颜料才能获得逃出美术馆的钥匙美术馆由 n*m 的房间构成,每个房间里有一种颜料,解锁进入后就可以收集.有的房间不能解锁,如果解锁的话会直 ...

  2. UVA - 11992:Fast Matrix Operations

    线段树,注意tag优先级 #include<cstdio> #include<cstdlib> #include<algorithm> #include<cs ...

  3. hdu 5398 动态树LCT

    GCD Tree Time Limit: 5000/2500 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others)Total Su ...

  4. hdu 5012(bfs)

    题意:给你2个 骰子,让你通过翻转使第一个变成第二个,求最少翻转数 思路:bfs #include<cstdio> #include<iostream> #include< ...

  5. bzoj2006 NOI2010 数据结构+堆维护区间和最大

    2006: [NOI2010]超级钢琴 Time Limit: 20 Sec  Memory Limit: 552 MBSubmit: 3431  Solved: 1686[Submit][Statu ...

  6. TensorFlow LSTM 注意力机制图解

    TensorFlow LSTM Attention 机制图解 深度学习的最新趋势是注意力机制.在接受采访时,现任OpenAI研究主管的Ilya Sutskever提到,注意力机制是最令人兴奋的进步之一 ...

  7. super 关键字

  8. c# 虚拟路径转化为物理路径

    string strPhycicsPath= Server.MapPath(path);

  9. C# 制作屏保(图片位置随机变化)

    最近无所事事,闲着无聊,在网上翻看资料时碰巧看到了屏保制作,根据大神的思路也理解到屏保也不是很难.因此根据我自己的理解,动手谢了一个屏保. 首先,打开VS2010创建一个Windows窗体应用程序,名 ...

  10. 3-学习GPRS_Air202(需要知道的关于Lua的一些基本的知识)

      http://www.cnblogs.com/yangfengwu/p/8948935.html 学东西一定是打破沙锅学到底,有问题就解决问题,不要试图去回避或者放弃解决当前的问题,如果总是回避或 ...