简体   繁体   English

如何将无状态会话Bean注入消息驱动Bean?

[英]How to inject a Stateless Session Bean into a Message Driven Bean?

I'm trying to inject a remote stateless session bean in a message driven bean. 我正在尝试在消息驱动的bean中注入一个远程无状态会话bean。

I've been looking this post: How to inject a Session Bean into a Message Driven Bean? 我一直在看这篇文章: 如何将会话Bean注入消息驱动Bean?

The Session Bean and the Message Driven Bean are in two diff. Session Bean和Message Driven Bean分为两个版本。

Here an exemple of what i've tried to inject my EJB : 这是我试图注入我的EJB的例子:

@EJB(beanName="TraitementBeanRemote")
private TraitementBeanRemote traitementBeanRemote;

The application throws a NamingException : 应用程序抛出NamingException:

javax.naming.NamingException: Lookup failed for '#com.generator.traitement.TraitementBeanRemote' in SerialContext

My environement : Netbeans 7.4 / Glassfish 4.0 我的环境:Netbeans 7.4 / Glassfish 4.0

Does someone have any idea about that? 有人对此有任何想法吗?

If this Session Bean is deployed on the same server, then I recoment to add to it a local interface. 如果此会话Bean部署在同一服务器上,那么我重新添加一个本地接口。 EJB can have @Remote and @Local interfaces at the same time. EJB可以同时具有@Remote和@Local接口。

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

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