简体   繁体   English

什么是Websphere Application Server 7(WAS)中EJB的默认JNDI名称?

[英]What's the default JNDI name of an EJB in Websphere Application Server 7 (WAS)?

In the Administration COnsole of WAS 7, on the Applications > Application Types > WebSphere enterprise applications > application > EJB JNDI names section, I have a table with four columns : 在WAS 7的Administration COnsole中,在Applications> Application Types> WebSphere enterprise applications> application> EJB JNDI names部分中,我有一个包含四列的表:

  • EJB Module (eg ProjectEJB.jar) EJB模块(例如ProjectEJB.jar)
  • EJB (eg BeanBO ) EJB(例如BeanBO)
  • URI (eg ProjectEJB.jar, META-INF/ejb-jar.xml URI(例如ProjectEJB.jar,META-INF / ejb-jar.xml
  • Target resource JNDI Name (with empty fields) 目标资源JNDI名称(带空字段)

Something like this : 像这样的东西:

在此输入图像描述

What's the jndi name of my LogWriter bean ? 我的LogWriter bean的jndi名称是什么?

Below you have table with default names. 下面是包含默认名称的表。 Each bean gets short and long form. 每个豆都有短而长的形状。 You can override default using ibm-ejb-jar-bnd.xml file or during installation via console. 您可以使用ibm-ejb-jar-bnd.xml文件或在通过控制台安装期间覆盖默认值。 During module startup bindings will be visible in SysyemOut.log 在模块启动期间,绑定将在SysyemOut.log中可见

You can read about default bindings here: http://pic.dhe.ibm.com/infocenter/wasinfo/v7r0/topic/com.ibm.websphere.express.iseries.doc/info/iseriesexp/ae/cejb_bindingsejbfp.html 您可以在此处阅读有关默认绑定的信息: http//pic.dhe.ibm.com/infocenter/wasinfo/v7r0/topic/com.ibm.websphere.express.iseries.doc/info/iseriesexp/ae/cejb_bindingsejbfp.html

Description                              Binding pattern
Short form local interfaces and homes    ejblocal:<package.qualified.interface>
Short form remote interfaces and homes   <package.qualified.interface>
Long form local interfaces and homes     ejblocal:<component-id>#<package.qualified.interface>
Long form remote interfaces and homes    ejb/<component-id>#<package.qualified.interface>

The component-id defaults to <application-name>/<module-jar-name>/<ejb-name>

One can set it by adding a file META-INF/ibm-ejb-jar-bnd.xml - something like this: 可以通过添加文件META-INF / ibm-ejb-jar-bnd.xml来设置它 - 如下所示:

<?xml version="1.0" encoding="UTF-8"?>
<ejb-jar-bnd xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://websphere.ibm.com/xml/ns/javaee" xsi:schemaLocation="http://websphere.ibm.com/xml/ns/javaee http://websphere.ibm.com/xml/ns/javaee/ibm-ejb-jar-bnd_1_0.xsd" version="1.0">
    <session name="LogWriter" simple-binding-name="my/ejb/LogWriterService"/>
</ejb-jar-bnd>

We used to have a script to generate these server-specific files for the different vendors. 我们曾经有一个脚本为不同的供应商生成这些特定于服务器的文件。

Thanks to [ https://stackoverflow.com/a/16936264/539783][2] 感谢[ https://stackoverflow.com/a/16936264/539783] [2 ]

For local lookup : 对于本地查找:

String jndi = "ejblocal:enterprise_app_name/ejb_web_project_name.jar/ejb_name#name.of.local.impl.interface";

For remote lookup : 对于远程查找:

String jndi = "ejb/enterprise_app_name/ejb_web_project_name.jar/ejb_name#name.of.remote.impl.interface";

Example : 示例:

ejblocal:ServicesEAR/LogWriter.jar/LogWriter#ILogWriter ejblocal:ServicesEAR / LogWriter.jar /写进程#ILogWriter

UPDATE : It doesn't work in some cases. 更新:在某些情况下它不起作用。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM