JBoss:启用类加载器隔离时不注入@Resource

时间:2009-11-05 13:22:18

标签: java-ee jboss resources classloader

JBoss 4.2.3,一个部署为耳朵的应用程序。作品。然后,我通过在loader-repository中添加jboss-app.xml标记来启用类加载器隔离。在多个bean中@Resource TimerService停止注入,代码抛出NullPointerException

这种行为可能是什么原因?我不知道。

谢谢,
Artem B

1 个答案:

答案 0 :(得分:1)

好吧,我没有答案,但多亏了你,我找到了解决方案。我在5.1.0.GA中遇到了同样的问题。在我的SLSB中包含:

@PersistenceContext
EntityManager entityManager;

@Resource
TimerService timerService;

我的entityManager注入得很好,但是timerService正在产生一个NPE。 在我的jboss-app.xml中注释掉<loader-repository>...</loader-repository>元素后,timerService就有效了。谢谢你的提示!