原始问题是由于混合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