我想问一下我的代码有什么问题。我在项目中遇到有关 IllegalStateException 的问题。我的设置如下:
我使用'来自数据库的实体'功能来生成我的实体。
我一直试图找到解决方案很长一段时间,我总是得到有关jboss问题的信息。但大多数帖子大约有1~2年的历史,其中一些帖子已经解决了。
以下是我的代码:
PleaseBean.java
package please.bean;
import java.io.Serializable;
import java.util.List;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.ViewScoped;
import javax.faces.model.DataModel;
import javax.faces.model.ListDataModel;
import please.model.CoopProspect;
import please.util.CoopProspectFacade;
@ManagedBean(name="pleaseBean")
@ViewScoped
public class PleaseBean implements Serializable {
private static final long serialVersionUID = 1L;
private CoopProspect prospect;
private CoopProspect[] selectedProspects;
private CoopProspect selectedProspect;
private List<CoopProspect> prospectList;
private List<CoopProspect> filteredProspect;
private transient DataModel<CoopProspect> prospectModel;
private CoopProspectFacade prospectFacade;
public PleaseBean() {
prospect = new CoopProspect();
prospectList = prospectFacade.findAll();
prospectModel = new ListDataModel<CoopProspect>(prospectList);
}
public String create() {
prospectFacade.create(prospect);
prospect = new CoopProspect();
refreshList();
return "";
}
public void editMode() {
prospect = selectedProspect;
}
public void refreshList() {
prospectList = prospectFacade.findAll();
prospectModel = new ListDataModel<CoopProspect>(prospectList);
}
public void save() {
editMode();
prospectFacade.edit(prospect);
prospect = new CoopProspect();
}
public void delete() {
prospectFacade.remove(selectedProspects);
refreshList();
}
public List<CoopProspect> getProspectList() {
return prospectList;
}
public void setFilteredProspectList(List<CoopProspect> filteredProspect) {
this.filteredProspect = filteredProspect;
}
public List<CoopProspect> getFilteredProspectList() {
return filteredProspect;
}
public DataModel<CoopProspect> getProspectModel() {
if (prospectModel == null) {
prospectModel = new ListDataModel<CoopProspect>(prospectList);
}
return prospectModel;
}
public CoopProspect getProspect() {
if (prospect == null) {
prospect = new CoopProspect();
}
return prospect;
}
public CoopProspect[] getSelectedProspects() {
return selectedProspects;
}
public void setSelectedProspects(CoopProspect[] selectedProspects) {
this.selectedProspects = selectedProspects;
}
public CoopProspect getSelectedProspect() {
if (selectedProspect == null) {
selectedProspect = new CoopProspect();
}
return selectedProspect;
}
public void setSelectedProspect(CoopProspect selectedProspect) {
this.selectedProspect = selectedProspect;
}
}
AbstractFacade.java
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package please.util;
import java.util.List;
import javax.persistence.EntityManager;
import javax.persistence.Query;
import javax.persistence.criteria.CriteriaQuery;
import javax.persistence.criteria.Root;
/**
*
* @author mis
*/
public abstract class AbstractFacade<T> {
private Class<T> entityClass;
public AbstractFacade(Class<T> entityClass) {
this.entityClass = entityClass;
}
protected abstract EntityManager getEntityManager();
public void create(T entity) {
getEntityManager().persist(entity);
}
public void edit(T entity) {
getEntityManager().merge(entity);
}
public void remove(T entity) {
getEntityManager().remove(getEntityManager().merge(entity));
}
public boolean remove(T[] entities) {
for(T entity: entities) {
getEntityManager().remove(getEntityManager().merge(entity));
}
return true;
}
public T find(Object id) {
return getEntityManager().find(entityClass, id);
}
public List<T> findAll() {
CriteriaQuery cq =
getEntityManager().getCriteriaBuilder().createQuery();
cq.select(cq.from(entityClass));
return getEntityManager().createQuery(cq).getResultList();
}
public List<T> findRange(int[] range) {
CriteriaQuery cq =
getEntityManager().getCriteriaBuilder().createQuery();
cq.select(cq.from(entityClass));
Query q = getEntityManager().createQuery(cq);
q.setMaxResults(range[1] - range[0]);
q.setFirstResult(range[0]);
return q.getResultList();
}
public int count() {
CriteriaQuery cq =
getEntityManager().getCriteriaBuilder().createQuery();
Root<T> rt = cq.from(entityClass);
cq.select(getEntityManager().getCriteriaBuilder().count(rt));
Query q = getEntityManager().createQuery(cq);
return ((Long) q.getSingleResult()).intValue();
}
}
CoopProspectFacade.java
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package please.util;
import javax.ejb.Stateless;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;
import please.model.CoopProspect;
@Stateless
public class CoopProspectFacade extends AbstractFacade<CoopProspect> {
@PersistenceContext(unitName = "please1PU")
private EntityManager em;
@Override
protected EntityManager getEntityManager() {
return em;
}
public CoopProspectFacade() {
super(CoopProspect.class);
}
}
的index.xhtml
<?xml version='1.0' encoding='UTF-8' ?>
<f:view xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:p="http://primefaces.org/ui">
<h:head/>
<h:body>
<h:form id="adform">
<p:panelGrid styleClass="nameruna" >
<p:row>
<p:column>
<p:outputLabel for="datepros" value="Date: "/>
</p:column>
<p:column>
<p:calendar id="datepros" value="#{pleaseBean.prospect.prosDate}" readonlyInput="true" required="true" pattern="MM/dd/yyyy"/>
</p:column>
</p:row>
<p:row>
<p:column>
<p:outputLabel for="fname" value="Firstname: "/>
</p:column>
<p:column>
<p:inputText id="fname" value="#{pleaseBean.prospect.firstName}" required="true" size="25" maxlength="25"/>
</p:column>
</p:row>
<p:row>
<p:column>
<p:outputLabel for="mname" value="Middlename: "/>
</p:column>
<p:column>
<p:inputText id="mname" value="#{pleaseBean.prospect.middleName}" size="20" maxlength="20"/>
</p:column>
</p:row>
<p:row>
<p:column>
<p:outputLabel for="lname" value="Lastname: "/>
</p:column>
<p:column>
<p:inputText id="lname" value="#{pleaseBean.prospect.lastName}" required="true" size="20" maxlength="20"/>
</p:column>
</p:row>
<p:row>
<p:column>
<p:outputLabel for="gender" value="Gender: "/>
</p:column>
<p:column>
<p:selectOneRadio id="gender" required="true" value="#{pleaseBean.prospect.gender}">
<f:selectItem itemLabel="Male" itemValue="M"/>
<f:selectItem itemLabel="Female" itemValue="F"/>
</p:selectOneRadio>
</p:column>
</p:row>
<p:row>
<p:column>
<p:outputLabel for="bday" value="Date of birth: "/>
</p:column>
<p:column>
<p:calendar id="bday"
value="#{pleaseBean.prospect.birthdate}"
navigator="true"
readonlyInput="true"
pattern="MM/dd/yyyy"
yearRange="c-100:c+0"/>
</p:column>
</p:row>
<p:row>
<p:column>
<p:outputLabel for="cntno" value="Contact number: "/>
</p:column>
<p:column>
<p:inputText id="cntno" value="#{pleaseBean.prospect.contactNumber}" size="12" maxlength="12"/>
</p:column>
</p:row>
<p:row>
<p:column>
<p:outputLabel for="los" value="Length of stay is two years? "/>
</p:column>
<p:column>
<p:selectBooleanCheckbox id="los" value="#{pleaseBean.prospect.lengthOfStay}"/>
</p:column>
</p:row>
<p:row>
<p:column>
<p:outputLabel for="natl" value="Nationality: "/>
</p:column>
<p:column>
<p:inputText id="natl" value="#{pleaseBean.prospect.nationality}" required="true" size="8" maxlength="8"/>
</p:column>
</p:row>
<p:row>
<p:column>
<p:outputLabel for="orgu" value="Organizational Unit: "/>
</p:column>
<p:column>
<p:selectOneMenu id="orgu" required="true" value="#{pleaseBean.prospect.ouCode}">
<f:selectItem itemLabel="PT01" itemValue="PT01"/>
</p:selectOneMenu>
</p:column>
</p:row>
<p:row>
<p:column>
<h2>
<h:outputText value="ADDRESS"/>
</h2>
</p:column>
</p:row>
<p:row>
<p:column>
<p:outputLabel for="street" value="Street/Phase: "/>
</p:column>
<p:column>
<p:inputText id="street" value="#{pleaseBean.prospect.street}" size="60" maxlength="60"/>
</p:column>
</p:row>
<p:row>
<p:column>
<p:outputLabel for="bgy" value="Barangay: "/>
</p:column>
<p:column>
<p:inputText id="bgy" value="#{pleaseBean.prospect.barangay}" size="50" maxlength="50"/>
</p:column>
</p:row>
<p:row>
<p:column>
<p:outputLabel for="city" value="City/Municipality: "/>
</p:column>
<p:column>
<p:inputText id="city" value="#{pleaseBean.prospect.cityMun}" size="50" maxlength="50"/>
</p:column>
</p:row>
<p:row>
<p:column>
<p:outputLabel for="regn" value="Region: "/>
</p:column>
<p:column>
<p:inputText id="regn" value="#{pleaseBean.prospect.region}" size="50" maxlength="50"/>
</p:column>
</p:row>
<p:row>
<p:column>
<p:outputLabel for="provnc" value="Province: "/>
</p:column>
<p:column>
<p:inputText id="provnc" value="#{pleaseBean.prospect.province}" size="50" maxlength="50"/>
</p:column>
</p:row>
<p:row>
<p:column>
<p:commandButton actionListener="#{pleaseBean.create}"
value="Submit"
onclick="adform.reset()"
/>
</p:column>
</p:row>
</p:panelGrid>
</h:form>
</h:body>
</f:view>
堆栈跟踪
2013-03-07T06:11:31.122+0000|WARNING|glassfish3.1.2|javax.enterprise.system.container.web.com.sun.enterprise.web|_ThreadID=177;_ThreadName=Thread-2;|ApplicationDispatcher[/please1-portlet] PWC1231: Servlet.service() for servlet please1 Servlet threw exception
javax.portlet.faces.BridgeException: java.lang.IllegalStateException: Must call associate() before calling activate()
at com.liferay.faces.bridge.BridgePhaseRenderImpl.execute(BridgePhaseRenderImpl.java:193)
at com.liferay.faces.bridge.BridgePhaseRenderImpl.execute(BridgePhaseRenderImpl.java:85)
at com.liferay.faces.bridge.BridgeImpl.doFacesRequest(BridgeImpl.java:112)
at javax.portlet.faces.GenericFacesPortlet.doView(GenericFacesPortlet.java:255)
at javax.portlet.GenericPortlet.doDispatch(GenericPortlet.java:328)
at javax.portlet.faces.GenericFacesPortlet.doDispatch(GenericFacesPortlet.java:204)
at javax.portlet.GenericPortlet.render(GenericPortlet.java:233)
at com.liferay.portlet.FilterChainImpl.doFilter(FilterChainImpl.java:100)
at com.liferay.portal.kernel.portlet.PortletFilterUtil.doFilter(PortletFilterUtil.java:64)
at com.liferay.portal.kernel.servlet.PortletServlet.service(PortletServlet.java:111)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:770)
at org.apache.catalina.core.StandardWrapper.service(StandardWrapper.java:1550)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:343)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:217)
at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:72)
at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilter.doFilter(InvokerFilter.java:73)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:256)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:217)
at org.apache.catalina.core.ApplicationDispatcher.doInvoke(ApplicationDispatcher.java:807)
at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:671)
at org.apache.catalina.core.ApplicationDispatcher.doInclude(ApplicationDispatcher.java:626)
at org.apache.catalina.core.ApplicationDispatcher.include(ApplicationDispatcher.java:556)
at com.liferay.portlet.InvokerPortletImpl.invoke(InvokerPortletImpl.java:534)
at com.liferay.portlet.InvokerPortletImpl.invokeRender(InvokerPortletImpl.java:607)
at com.liferay.portlet.InvokerPortletImpl.render(InvokerPortletImpl.java:359)
at org.apache.jsp.html.portal.render_005fportlet_jsp._jspService(render_005fportlet_jsp.java:1174)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:111)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:770)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:403)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:473)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:377)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:770)
at org.apache.catalina.core.StandardWrapper.service(StandardWrapper.java:1550)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:343)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:217)
at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:72)
at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:116)
at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilter.doFilter(InvokerFilter.java:73)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:256)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:217)
at org.apache.catalina.core.ApplicationDispatcher.doInvoke(ApplicationDispatcher.java:807)
at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:671)
at org.apache.catalina.core.ApplicationDispatcher.doInclude(ApplicationDispatcher.java:626)
at org.apache.catalina.core.ApplicationDispatcher.include(ApplicationDispatcher.java:556)
at com.liferay.portal.servlet.DirectServletPathRegisterDispatcher.include(DirectServletPathRegisterDispatcher.java:53)
at com.liferay.portal.servlet.PACLRequestDispatcherWrapper.doDispatch(PACLRequestDispatcherWrapper.java:90)
at com.liferay.portal.servlet.PACLRequestDispatcherWrapper.include(PACLRequestDispatcherWrapper.java:54)
at com.liferay.portal.util.PortalImpl.renderPortlet(PortalImpl.java:5158)
at com.liferay.portal.util.PortalImpl.renderPortlet(PortalImpl.java:5116)
at com.liferay.portal.util.PortalUtil.renderPortlet(PortalUtil.java:1557)
at com.liferay.portal.action.RenderPortletAction.execute(RenderPortletAction.java:92)
at com.liferay.portal.action.UpdateLayoutAction.addPortlet(UpdateLayoutAction.java:334)
at com.liferay.portal.action.UpdateLayoutAction.getJSON(UpdateLayoutAction.java:287)
at com.liferay.portal.struts.JSONAction.execute(JSONAction.java:75)
at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:431)
at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:236)
at com.liferay.portal.struts.PortalRequestProcessor.process(PortalRequestProcessor.java:176)
at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1196)
at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:432)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:688)
at com.liferay.portal.servlet.MainServlet.callParentService(MainServlet.java:560)
at com.liferay.portal.servlet.MainServlet.service(MainServlet.java:537)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:770)
at org.apache.catalina.core.StandardWrapper.service(StandardWrapper.java:1550)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:343)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:217)
at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:72)
at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:116)
at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:116)
at com.liferay.portal.kernel.servlet.BaseFilter.processFilter(BaseFilter.java:163)
at com.liferay.portal.servlet.filters.strip.StripFilter.processFilter(StripFilter.java:335)
at com.liferay.portal.kernel.servlet.BaseFilter.doFilter(BaseFilter.java:57)
at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.processDoFilter(InvokerFilterChain.java:206)
at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:108)
at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:116)
at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:116)
at com.liferay.portal.kernel.servlet.BaseFilter.processFilter(BaseFilter.java:163)
at com.liferay.portal.servlet.filters.secure.SecureFilter.processFilter(SecureFilter.java:294)
at com.liferay.portal.kernel.servlet.BaseFilter.doFilter(BaseFilter.java:57)
at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.processDoFilter(InvokerFilterChain.java:206)
at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:108)
at com.liferay.portal.kernel.servlet.BaseFilter.processFilter(BaseFilter.java:163)
at com.liferay.portal.servlet.filters.sso.ntlm.NtlmPostFilter.processFilter(NtlmPostFilter.java:83)
at com.liferay.portal.kernel.servlet.BaseFilter.doFilter(BaseFilter.java:57)
at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.processDoFilter(InvokerFilterChain.java:206)
at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:108)
at com.liferay.portal.kernel.servlet.BaseFilter.processFilter(BaseFilter.java:163)
at com.liferay.portal.sharepoint.SharepointFilter.processFilter(SharepointFilter.java:80)
at com.liferay.portal.kernel.servlet.BaseFilter.doFilter(BaseFilter.java:57)
at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.processDoFilter(InvokerFilterChain.java:206)
at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:108)
at com.liferay.portal.kernel.servlet.BaseFilter.processFilter(BaseFilter.java:163)
at com.liferay.portal.servlet.filters.virtualhost.VirtualHostFilter.processFilter(VirtualHostFilter.java:216)
at com.liferay.portal.kernel.servlet.BaseFilter.doFilter(BaseFilter.java:57)
at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.processDoFilter(InvokerFilterChain.java:206)
at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:108)
at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.processDirectCallFilter(InvokerFilterChain.java:187)
at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:95)
at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:116)
at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:116)
at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:116)
at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:116)
at org.tuckey.web.filters.urlrewrite.UrlRewriteFilter.doFilter(UrlRewriteFilter.java:738)
at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.processDoFilter(InvokerFilterChain.java:206)
at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:108)
at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.processDirectCallFilter(InvokerFilterChain.java:167)
at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:95)
at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:116)
at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.processDirectCallFilter(InvokerFilterChain.java:167)
at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:95)
at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:116)
at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.processDirectCallFilter(InvokerFilterChain.java:187)
at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:95)
at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilter.doFilter(InvokerFilter.java:73)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:256)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:217)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:279)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:655)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:595)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:161)
at org.apache.catalina.connector.CoyoteAdapter.doService(CoyoteAdapter.java:331)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:231)
at com.sun.enterprise.v3.services.impl.ContainerMapper$AdapterCallable.call(ContainerMapper.java:317)
at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:195)
at com.sun.grizzly.http.ProcessorTask.invokeAdapter(ProcessorTask.java:849)
at com.sun.grizzly.http.ProcessorTask.doProcess(ProcessorTask.java:746)
at com.sun.grizzly.http.ProcessorTask.process(ProcessorTask.java:1045)
at com.sun.grizzly.http.DefaultProtocolFilter.execute(DefaultProtocolFilter.java:228)
at com.sun.grizzly.DefaultProtocolChain.executeProtocolFilter(DefaultProtocolChain.java:137)
at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:104)
at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:90)
at com.sun.grizzly.http.HttpProtocolChain.execute(HttpProtocolChain.java:79)
at com.sun.grizzly.ProtocolChainContextTask.doCall(ProtocolChainContextTask.java:54)
at com.sun.grizzly.SelectionKeyContextTask.call(SelectionKeyContextTask.java:59)
at com.sun.grizzly.ContextTask.run(ContextTask.java:71)
at com.sun.grizzly.util.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:532)
at com.sun.grizzly.util.AbstractThreadPool$Worker.run(AbstractThreadPool.java:513)
at java.lang.Thread.run(Thread.java:722)
Caused by: java.lang.IllegalStateException: Must call associate() before calling activate()
at org.jboss.weld.context.AbstractConversationContext.activate(AbstractConversationContext.java:200)
at org.jboss.weld.jsf.WeldPhaseListener.activateConversations(WeldPhaseListener.java:108)
at org.jboss.weld.jsf.WeldPhaseListener.beforePhase(WeldPhaseListener.java:85)
at com.sun.faces.lifecycle.Phase.handleBeforePhase(Phase.java:228)
at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:99)
at com.sun.faces.lifecycle.RestoreViewPhase.doPhase(RestoreViewPhase.java:116)
at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:118)
at com.liferay.faces.bridge.lifecycle.LifecycleWrapper.execute(LifecycleWrapper.java:35)
at com.liferay.faces.bridge.BridgePhaseRenderImpl.execute(BridgePhaseRenderImpl.java:185)
... 138 more
任何人都可以帮助我吗?
注意:这不是一个好的编码示例,任何人都不能模仿。
答案 0 :(得分:1)
我认为此错误表明CDI(JBoss Weld)正在被激活,目前与portlet环境不兼容。建议您在WAR工件中查找WEB-INF / beans.xml描述符,或在ClassPath中的任何JAR文件中查找META-INF / beans.xml。如果您发现任何问题,则需要将其删除。希望我们很快就能与FACES-1211保持CDI兼容性。