如何在JBoss 4.2.2.GA中指定与EJB默认名称不同的jndi名称? [英] How to specify a different jndi-name than the default for an EJB in JBoss 4.2.2.GA?

查看:72
本文介绍了如何在JBoss 4.2.2.GA中指定与EJB默认名称不同的jndi名称?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

默认情况下,bean的jndi名称似乎基于包含它的耳朵.名为MyBean my-app.ear的EJB将具有名称"my-app/MyBean/local".

By default it seems the jndi name of a bean is based on the ear in which it is contained. An EJB named MyBean my-app.ear will have the name "my-app/MyBean/local".

如何声明性地更改该行为?我希望jndi名称为"something-else/MyBean/local".它必须是声明性的,而不是带有注释b/c,我无法修改MyBean.java的源代码;我只有一个罐子,要包装到耳朵里以便部署.

How can I change that behavior declaratively? I want the jndi name to be "something-else/MyBean/local". It has to be declarative rather than with an annotation b/c I can't modify the source of MyBean.java; I only have the jar, which I am packaging into an ear for deployment.

推荐答案

您可以在jboss.xml中提供它

You can provide this in jboss.xml

http://docs .jboss.org/ejb3/app-server/reference/build/reference/zh-CN/html/jboss_deployment_descriptor.html

jndi-name元素就是您想要的.

jndi-name element is what you want.

示例:

<jboss>
   <enterprise-beans>
      <service>
         <ejb-class>org.jboss.ejb3.test.service.ServiceSix</ejb-class>
         <local>org.jboss.ejb3.test.service.ServiceSixLocal</local>
         <remote>org.jboss.ejb3.test.service.ServiceSixRemote</remote>
         <management>org.jboss.ejb3.test.service.ServiceSixManagement</management>
         <jndi-name>serviceSix/remote</jndi-name>
         <local-jndi-name>serviceSix/local</local-jndi-name>
      </service>
   </enterprise-beans>
</jboss>

这篇关于如何在JBoss 4.2.2.GA中指定与EJB默认名称不同的jndi名称?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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