在weblogic中发布EJB的本地接口 [英] Publishing EJB's local interface in weblogic

查看:318
本文介绍了在weblogic中发布EJB的本地接口的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果只实现本地接口,有没有办法在weblogic中查找EJB?

is there a way to lookup an EJB in weblogic if it implements only local interface?

如果我使用这个

@Remote public interface TestSessionRemote { 
    public void businessMethod();
}

@Stateless(mappedName = "A")
public class TestSessionBean implements TestSessionRemote 
{
    public void businessMethod() 
    {

    }
}

可以使用EJB查找EJB这个名字:

the EJB can be looked up using this name:

"A#" + TestSessionRemote.class.getName()

如果我将TestSessionRemote的注释从@Remote更改为@Local,则EJB将从JNDI中消失。有没有解决的办法?

If I change the annotation for TestSessionRemote from @Remote to @Local the EJB disappears from JNDI. Is there a way around this?

编辑:那时我正在使用Weblogic 10.3.x(又名11g)。

I was working with Weblogic 10.3.x (aka 11g) at that time.

推荐答案

不,这是不可能的。在WebLogic 10.3.x上部署EJB 3.0应用程序的上下文中,我一直在解决同样的问题。

No, it is not possible. I have been working through the same issue, in the context of deploying an EJB 3.0 application on WebLogic 10.3.x.

该应用程序在Oracle Application Server 10.1.3上运行GlassFish 3.x.

The application runs on Oracle Application Server 10.1.3 and GlassFish 3.x.


  • Oracle AS(OC4J)有一个专有机制,用于使用JNDI查找EJB的本地接口。

  • GlassFish 3.x使用其可移植的JNDI名称语法实现EJB 3.1。

我们的应用程序对当前使用查找机制应用程序服务器,在运行时确定。

Our application uses a lookup mechanism for the current application server, which is determined at runtime.

在WebLogic Server 10.3中,EJB的本地接口:

In WebLogic Server 10.3, the local interface of an EJB:


  • 可以使用 @EJB 注释
  • $注入servlet容器(servlet,过滤器等)和其他EJB的托管类中b $ b
  • 仅在JNDI中用于在 web.xml中的 ejb-local-ref 元素中声明时才可用于查找/ code>或 ejb-jar.xml

  • can be injected into managed classes in the servlet container (servlets, filters etc.) and other EJBs using @EJB annotations
  • is only available for lookup from JNDI when it has been declared in a ejb-local-ref element in web.xml or ejb-jar.xml

它是我们声明查找所有查找的EJB是不实际的。我们有192个无状态EJB,大多数是注入的,但很多人都是从JNDI中查找的,因为我们需要它们可用于非托管类。

It is not practical for us to declare all EJBs that are looked up. We have 192 stateless EJBs, mostly injected but many looked up from JNDI because we need them available to unmanaged classes.

除了反复试验之外,我的信息来源,是 WebLogic 10.3 EJB3本地查找示例。我找到的几乎所有其他东西,包括Oracle文档,都用 mappedName#fullInterface 描述了JNDI查找语法,但是没有说清楚只有远程接口名在JNDI树中。

My source for this information, apart from trial and error, is WebLogic 10.3 EJB3 Local Lookup Sample. Almost everything else I found, including the Oracle documentation, describes the JNDI lookup syntax with mappedName#fullInterface but does not make it clear that only the remote interface name is in the JNDI tree.

更新:我们在 web.xml 和<$ c中使用了声明$ c> ejb-jar.xml (是的,有些EJB使用在JNDI中查找其他EJB的实用程序类)。从脚本开始从源生成它们然后手动编辑它们直到它们是正确的。不好,但必要。

Update: We went with declarations in web.xml and ejb-jar.xml (yes, there are EJBs that use utility classes that look up other EJBs in JNDI). Started with a script to generate them from sources then manually edited them until they were correct. Not nice but necessary.

这篇关于在weblogic中发布EJB的本地接口的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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