gpt4 book ai didi

java - 将 EJB3 与 Spring 集成

转载 作者:行者123 更新时间:2023-12-02 08:30:44 25 4
gpt4 key购买 nike

我正在使用 EJB 和 Spring 3 构建应用程序。我有三个 Maven 模块 - Spring jar、EJB jar 和 Web 部件。在 Web 部分中,我想调用我的 EJB session bean。这是它的代码:

@Controller
public class IndexController {

@EJB
PaymentRemote paymentRemote;
}

我还有一个应用程序上下文文件,其内容为:

<jee:local-slsb id="paymentRemote" jndi-name="ejb/myBean" 
business-interface="net.learntechnology.ejb.PaymentRemote"/>

<bean class="org.springframework.context.annotation.CommonAnnotationBeanPostProcessor">
<property name="alwaysUseJndiLookup" value="true"/>

在我的 ejb 模块中,我有一个接口(interface):

@Local
public interface PaymentRemote {
}

不幸的是,当我将其部署在 JBoss 5 上时,出现以下错误:

Error creating bean with name 'paymentRemote': Invocation of init method failed; nested exception is javax.naming.NameNotFoundException: ejb not bound.

我在网上看到很多例子,都是这样配置的。我被困住了...有人可以帮我解决这个问题吗?我将不胜感激!

最佳答案

对于 JBOSS,正确的模式是:应用程序名称/bean/远程或本地

关于java - 将 EJB3 与 Spring 集成,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3439557/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com