Java ee 6/7中的模块和应用程序的jndi绑定有什么区别? [英] what is the difference between jndi binding of module and app in Java ee 6/7?

查看:66
本文介绍了Java ee 6/7中的模块和应用程序的jndi绑定有什么区别?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们在开发环境中从Jboss EAP 5迁移到EAP 6.

We migrated from Jboss EAP 5 to EAP 6 in our development environment.

现在我在JBOSS日志中看到以下内容.我试图了解这种绑定是如何发生的.我已阅读 JNDI名称空间绑定上的JBOSS docs.我仍然不清楚它是如何工作的.这是我的日志.

I now see the following in my JBOSS logs. I am trying to understand how this binding happens. I have read JBOSS docs on JNDI namespace binding. Still I am not totally clear how it works. Here is my log.

java:global/customerCare/services/UserDaoImpl!com.example.services.UserDao
java:app/services/UserDaoImpl!com.example.services.UserDao
java:module/UserDaoImpl!com.services.UserDao
java:global/customerCare/services/UserDaoImpl
java:app/services/UserDaoImpl
java:module/UserDaoImpl

这是我的EJBs

@Local
public interface UserDao {

    public static final String JNDI_NAME = "java:global/customCare/services/UserDaoImpl";

//interface methods here

}

@Stateless
public class UserDaoImpl implements UserDao {
// implement methods
}

我的疑问是:

  1. 在我的UserDao界面中,我明确地将JNDI binding设置为java:global/customCare/services/UserDaoImpl. 那为什么我看到我绑定了诸如appmodule之类的其他东西.

  1. I explicitly had JNDI binding to be java:global/customCare/services/UserDaoImpl in my UserDao interface. Then why do I see I binding for others such as app and module.

appmodule有什么区别?什么时候需要绑定到这些组件?这里的一些例子来说明会很有帮助

what is the difference between app and module? when would binding to these components be needed? some example here to illustrate will be very helpful

日志的最后三行显示与UserDaoImpl的绑定.是JBoss所做的事情,没有我要求它绑定吗? (对于JNDI绑定,我只设置了UserDao,而没有设置UserDaoImpl.)

The last three lines of log show binding to UserDaoImpl. Is it something that JBoss does without I ask it to bind? ( I set only UserDao but not UserDaoImpl for JNDI binding).

我对JNDI Namespace绑定不了解.阅读文档对我有帮助,但在很大程度上没有帮助.

I am a bit illiterate on JNDI Namespace binding. Reading docs helped me but not to great extent.

谢谢

推荐答案

我可以回答疑问2: 所有名称都是一回事,但上下文不同.

I can answer doubt 2: All the names are the same thing but with different contexts.

全局名称是完整的JNDI上下文,用于全局绑定.从客户端或另一个EAR文件中获取

The global name is a full JNDI context that is used to bind globally, ie. from a client or from another EAR file

模块名称可用于绑定在同一应用程序中,即在同一EAR中的不同EJB

The module name can be used to bind within the same application, ie different EJBs within the same EAR

本地名称用于绑定本地,即在jar或war中.

The local name is used to bind locally, ie within an jar or war.

使用短名称在本地进行绑定要比每次指定完整的全局名称稍微有效.

It is slightly more efficient to use the shorter names to bind locally than specifying a full global name each time.

据我所知,在部署期间,JBoss EAP 6始终会为每个企业bean列出三个/六个名称.它旨在帮助您作为开发人员识别Bean的JNDI名称.

From what I have seen JBoss EAP 6 will always list the three / six names for every enterprise bean during deployment. It is intended to help you as a developer identify the JNDI name(s) for the bean.

这篇关于Java ee 6/7中的模块和应用程序的jndi绑定有什么区别?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆