【发布时间】:2014-06-10 14:02:37
【问题描述】:
我正在使用 JBoss 7.1 在 Netbeans 8 中开发 EJB 3.1 的示例: https://netbeans.org/kb/docs/javaee/javaee-entapp-ejb.html
根据 EJB 3.1 的规范,应该可以在 web 模块中拥有企业 bean。我在 web 模块中有 Singleton 会话 bean,请参见示例的这一部分: https://netbeans.org/kb/docs/javaee/javaee-entapp-ejb.html#Exercise_3a
如果我使用@Singleton、@LocalBean 注释,应用程序是可部署的。
如果我添加@WebListener,则无法部署,错误提示:
Caused by: java.lang.RuntimeException: JBAS018043: ejb.SessionManagerBean has the wrong component type, it cannot be used as a web component
有人可以帮忙吗?
注意:示例是在 Glassfish 服务器上演示的,我必须使用 JBoss 7.1。我在这里有什么遗漏吗?
【问题讨论】:
-
不知道标准是否要求这些注释应该是可组合的,或者这是否是 Glassfish 扩展,但建议here 一种解决方法(引用:
A web event listener is a different component type as opposed to an EJB. You can create a separate web event listener which injects the EJB.)
标签: web-applications singleton ejb jboss7.x