不同profile之间EJB调用问题javax.naming.NameNotFoundException

Technote (troubleshooting)


Problem(Abstract)

In a clustered environment, in which 2 nodes have Application Servers with the same name, an attempt to lookup an EJB in the name space during an EJB invocation finds the wrong server.

Symptom

The result is that an EJB invocation fails with the following exception:

Root exception is org.omg.CosNaming.NamingContextPackage.NotFound IDL:omg.org/CosNaming/NamingContext/NotFound:1.0
 
This exception can be seen in the    SystemOut.log file.  

Despite running the    dumpNameSpace tool (run in the cell level), and finding that the name/object is in the name space, the look up does not work. 

Cause

This problem is caused by the lack of uniqueness of the host name and server name pair in a clustered environment. That is, 2 servers on the same host (federated in a Network Deployment) but on different nodes, and with the sameServer_ID and Server_UUID between the node-agents and thus are not unique according to the ORB. Server IDs used by the ORB are constructed from the host name and the server name.

For example, 2 nodes in a cluster are defined as follows:

  • Node 1 has an Application Server named server1 with an EJB deployed on that server.

  • Node 2 has an Application Server named server1. It has a Web application that is attempting to invoke the EJB onserver1 onNode 1.

These 2 nodes have the same server defined,    server1. The ORB on    Node 1 successfully finds the EJB since it is on the same node. The Web application on    Node 2 gets the error message and    NameNotFoundException.   

The reason that the problem occurs is that when the ORB code on    Node 2 looks up    server1 to find this EJB, it finds the instance on    Node 2 (the local instance) rather than the    server1 on    Node 1, which is where the EJB is initiated. 

Resolving the problem

The solution for this problem is to have different server names for the servers for 2 different nodes.


OR

Make reference per suggestion in the link below:

http://pic.dhe.ibm.com/infocenter/wasinfo/v8r0/topic/com.ibm.websphere.nd.multiplatform.doc/info/ae/ae/rtrb_namingprobs.html

--> under "Two servers with the same name running on the same host are being used to interoperate" topic.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
javax.ejb.transactionrolledbacklocalexception是一个Java编程语言中的异常类,它表示在Enterprise JavaBeans (EJB)事务中发生了回滚。 在EJB开发中,事务是指一组相关操作的逻辑单元,这些操作要么全部成功执行,要么全部回滚。回滚是指事务的操作失败或者发生异常,导致之前成功进行的操作被撤销。 javax.ejb.transactionrolledbacklocalexception表示事务被回滚的本地化异常。本地化异常指的是在应用程序内部出现的异常,例如在EJB容器内部或者在应用程序的事务管理模块中。 当发生javax.ejb.transactionrolledbacklocalexception异常时,意味着EJB事务失败并被回滚。这可能是由于以下原因导致的: 1. 数据库操作异常:例如执行数据库查询、插入或更新数据时发生错误,导致事务回滚。 2. 业务逻辑异常:例如校验失败、无效的操作或违反业务规则等导致事务回滚。 3. 系统异常:例如内存溢出、网络中断或其它不可预测的系统问题导致事务回滚。 处理javax.ejb.transactionrolledbacklocalexception异常通常需要在代码中进行适当的错误处理和故障排除。这可能包括回滚相应的操作、记录异常信息、向用户显示错误消息以及尝试修复问题。 为避免javax.ejb.transactionrolledbacklocalexception异常的发生,开发人员应该编写健壮的代码并测试各种场景下的操作。此外,正确配置和管理EJB容器和事务管理器也是关键,以确保事务能够正常进行,并将异常情况最小化。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值