JBoss 6: Injecting EJB into servlet

北城余情 提交于 2019-12-05 22:44:52

You are trying to inject (a proxy to) the bean instance itself, instead of its interface.

Yet, according to the deployment logging you've shown, you have only declared the bean to be bounded in JNDI via its (local) interface. In order to make the injection happen, you should either declare the variable in which you're injecting as the interface:

@EJB
private UserManagerLocal userManager;

OR declare that a no-interface view should be created for your bean:

@Stateless
@LocalBean
public class UserManager implements UserManagerLocal {
    ...
}

after which you can declare the variable as you did earlier:

@EJB
private UserManager userManager;
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!