当我部署具有 jsf 2.2 的 WAR 文件时,我在 jboss 上的 JNDI 中找不到 bean,我得到以下异常。有谁知道为什么会这样?(bean 在 JNDI 中,我看到 Jboss 绑定了它,我尝试了各种查找路径)
Deployment "vfs:///C:/jboss-6.1.0.Final/server/all/deploy/web.war" is in error due to the following reason(s): java.lang.RuntimeException: Could not resolve @EJB reference: [EJB Reference: beanInterface 'se.questify.services.entities.ExamServiceBase', beanName 'null', mappedName 'null', lookupName
'null', owning unit 'AbstractVFSDeploymentContext@1298976756{vfs:///C:/jboss-6.1.0.Final/server/all/deploy/web.war}'] for environment entry: env/ExamService/local in unit AbstractVFSDeploymentContext@1298976756{vfs:///C:/jboss-6.1.0.Final/server/all/deploy/web.war}
部署 ejb.jar 时的 Jboss 堆栈
INFO [org.jboss.ejb3.nointerface.impl.jndi.AbstractNoInterfaceViewBinder] Binding the following entry in Global JNDI for bean:ExamServiceBase
ExamServiceBase/no-interface -> EJB3.1 no-interface view
EJB
@Stateless
@Named("examServiceBase")
public class ExamServiceBase{
public String getHello(){
return "hello";
}
}
JSF 代码
<h:body>
<h1>JSF 2 Demo</h1>
<h:form>
<h:outputLabel value="#{examServiceBase.hello}" />
</h:form>
</h:body>