原始問題是由於混合CDI和EJB,現在已經解決了這個問題。但以下是使用EJB註釋代替Inject後的問題。當依賴的EJB bean註釋爲@EJB時,JSF無法加載
============================== ========編輯 - 新信息============
看來,JSFServlet無法在加載登錄時找到ejb bean'tauthenticator'。 XHTML。另外,當我查看Jboss管理控制檯中的jmx bean時,該名稱被註冊爲「Tauthenticator」而不是「tauthenticator」。我不知道這是否是一個問題,認爲需要
豆正在創建
21:09:42,602 INFO [org.jboss.ejb3.nointerface.impl.jndi.AbstractNoInterfaceViewBinder] Binding the following entry in Global JNDI for bean:Tauthenticator
Tauthenticator/no-interface -> EJB3.1 no-interface view
[org.jboss.ejb3.nointerface.impl.jndi.AbstractNoInterfaceViewBinder] Binding the following entry in Global JNDI for bean:TusersBean
TusersBean/no-interface -> EJB3.1 no-interface view
部分堆棧跟蹤管理bean的tauthenticator「訪問http://localhost:8080/timesheet/login.html時:Tauthenticator
的javax.servlet.ServletException
javax.faces.webapp.FacesServlet.service(FacesServlet.java:321)
org.jboss.weld.servlet.ConversationPropagationFilter.doFilter(ConversationPropagationFilter.java:67)
root cause
java.lang.StackOverflowError
java.lang.String.toLowerCase(String.java:2496)
javax.naming.NameImpl.toBoolean(NameImpl.java:202)
javax.naming.NameImpl.getBoolean(NameImpl.java:198)
javax.naming.NameImpl.recordNamingConvention(NameImpl.java:231)
javax.naming.NameImpl.<init>(NameImpl.java:254)
javax.naming.NameImpl.<init>(NameImpl.java:291)
javax.naming.CompoundName.<init>(CompoundName.java:168)
javax.naming.CompoundName.clone(CompoundName.java:260)
org.jnp.interfaces.NamingContext.composeName(NamingContext.java:1078)
org.jnp.interfaces.NamingContext.getAbsoluteName(NamingContext.java:1931)
org.jnp.interfaces.NamingContext.lookup(NamingContext.java:719)
org.jnp.interfaces.NamingContext.lookup(NamingContext.java:688)
sun.reflect.GeneratedMethodAccessor411.invoke(Unknown Source)
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
java.lang.reflect.Method.invoke(Method.java:597)
org.jboss.ejb3.EJBContainer$1.invoke(EJBContainer.java:978)
$Proxy459.lookup(Unknown Source)
org.jboss.ejb3.JndiUtil.lookup(JndiUtil.java:44)
提取物
@StatefulTimeout(unit=TimeUnit.MINUTES, value=500) @Stateful
@Named("tauthenticator") public class Tauthenticator {
@Getter @Setter private String username;
@Getter @Setter private String password;
@Getter @Setter boolean loggedIn = false;
@Getter @Setter Tusers users = null;
@EJB TusersBean usersBean;
@Inject private Event<ExceptionToCatch> catchEvent;
public String authenticate() {
來自login.xhtml的摘錄
<h:outputLabel for="username" style="font-weight:bold;">#{' '}Username</h:outputLabel>
<p:inputText id="username" value="#{tauthenticator.username}"/>
<h:outputLabel for="password" style="font-weight:bold;">#{' '}Password</h:outputLabel>
<p:password id="password" value="#{tauthenticator.password}" feedback="false"/>
<h:outputLabel>#{''}</h:outputLabel>
你能展示bean的代碼(包括導入)嗎? – perissf 2012-02-07 18:27:28
我已經加入 – Rag 2012-02-07 22:21:44