Injection of EJB3 into Annotation Based JSF2 Backing bean causing javax.naming.NameNotFoundException:

放肆的年华 提交于 2019-12-01 01:03:40

Shared libraries are not considered for locating component-defining annotations (like @ManagedBean), so the component is not found, which means its @EJB is not found while building the java:comp namespace. Your options are:

  1. Mention the JSF bean in faces-config.xml in the WAR.
  2. Place the JSF bean in the WAR.
  3. Define the <ejb-ref> in web.xml.
  4. Define the ejb-ref with annotations in a dummy "resource producer" bean in the WAR.

For #4, an example would be:

@ManagedBean
@EJBs({
   @EJB(name="helloworld.HelloBean", type=SampleService.class)
   // ... etc
})
public class ResourceProducerBean { }
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!