我在JSF Managed bean中使用EJB3 DAOFacade从数据库中提取数据。它适用于第一次启动服务器,但之后它继续打印此消息错误,我不明白。有人可以告诉我发生了什么事吗?
WARNING: EJB5184:A system exception occurred during an invocation on
EJB AirportFacade, method: public java.util.List
com.procc.flams.dao.AbstractFacade.findAll() WARNING:
javax.ejb.EJBException at
com.sun.ejb.containers.BaseContainer.processSystemException(BaseContainer.java:5215)
at
com.sun.ejb.containers.BaseContainer.completeNewTx(BaseContainer.java:5113)
at
com.sun.ejb.containers.BaseContainer.postInvokeTx(BaseContainer.java:4901)
at
com.sun.ejb.containers.BaseContainer.postInvoke(BaseContainer.java:2045)
at
com.sun.ejb.containers.BaseContainer.postInvoke(BaseContainer.java:1994)
at
com.sun.ejb.containers.EJBLocalObjectInvocationHandler.invoke(EJBLocalObjectInvocationHandler.java:222)
at
com.sun.ejb.containers.EJBLocalObjectInvocationHandlerDelegate.invoke(EJBLocalObjectInvocationHandlerDelegate.java:89)
at com.sun.proxy.$Proxy173.findAll(Unknown Source) at
com.procc.flams.backing.AirportController.getItems(AirportController.java:52)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:601) at
javax.el.BeanELResolver.getValue(BeanELResolver.java:363) at
com.sun.faces.el.DemuxCompositeELResolver._getValue(DemuxCompositeELResolver.java:176)
at
com.sun.faces.el.DemuxCompositeELResolver.getValue(DemuxCompositeELResolver.java:203)
at com.sun.el.parser.AstValue.getValue(AstValue.java:138) at
com.sun.el.parser.AstValue.getValue(AstValue.java:183) at
com.sun.el.ValueExpressionImpl.getValue(ValueExpressionImpl.java:224)
at
com.sun.faces.facelets.el.TagValueExpression.getValue(TagValueExpression.java:109)
at
javax.faces.component.ComponentStateHelper.eval(ComponentStateHelper.java:194)
at
javax.faces.component.ComponentStateHelper.eval(ComponentStateHelper.java:182)
at javax.faces.component.UIData.getValue(UIData.java:731) at
org.primefaces.component.datatable.DataTable.getValue(DataTable.java:786)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:601) at
com.sun.faces.facelets.util.DevTools.writeAttributes(DevTools.java:375)
at com.sun.faces.facelets.util.DevTools.writeStart(DevTools.java:424)
at
com.sun.faces.facelets.util.DevTools.writeComponent(DevTools.java:245)
at
com.sun.faces.facelets.util.DevTools.writeComponent(DevTools.java:264)
at
com.sun.faces.facelets.util.DevTools.writeComponent(DevTools.java:264)
at
com.sun.faces.facelets.util.DevTools.writeComponent(DevTools.java:264)
at com.sun.faces.facelets.util.DevTools.debugHtml(DevTools.java:128)
at
com.sun.faces.renderkit.RenderKitUtils.renderHtmlErrorPage(RenderKitUtils.java:1162)
at
com.sun.faces.context.ExceptionHandlerImpl.throwIt(ExceptionHandlerImpl.java:276)
at
com.sun.faces.context.ExceptionHandlerImpl.handle(ExceptionHandlerImpl.java:142)
at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:119) at
com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:139)
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:594) at
org.apache.catalina.core.StandardWrapper.service(StandardWrapper.java:1550)
at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:281)
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:860)
at
com.sun.grizzly.http.ProcessorTask.doProcess(ProcessorTask.java:757)
at
com.sun.grizzly.http.ProcessorTask.process(ProcessorTask.java:1056)
at
com.sun.grizzly.http.DefaultProtocolFilter.execute(DefaultProtocolFilter.java:229)
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: WEB9031: WebappClassLoader unable to
load resource [org.postgresql.core.v3.QueryExecutorImpl$1], because it
has not yet been started, or was already stopped at
org.glassfish.web.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1401)
at
org.glassfish.web.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1359)
at
org.postgresql.core.v3.QueryExecutorImpl.sendQueryPreamble(QueryExecutorImpl.java:432)
at
org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:252)
at
org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.java:500)
at
org.postgresql.jdbc2.AbstractJdbc2Statement.executeWithFlags(AbstractJdbc2Statement.java:388)
at
org.postgresql.jdbc2.AbstractJdbc2Statement.executeQuery(AbstractJdbc2Statement.java:273) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:601) at
org.hibernate.engine.jdbc.internal.proxy.AbstractStatementProxyHandler.continueInvocation(AbstractStatementProxyHandler.java:122)
at
org.hibernate.engine.jdbc.internal.proxy.AbstractProxyHandler.invoke(AbstractProxyHandler.java:81)
at com.sun.proxy.$Proxy180.executeQuery(Unknown Source) at
org.hibernate.loader.Loader.getResultSet(Loader.java:2031) at
org.hibernate.loader.Loader.executeQueryStatement(Loader.java:1832)
at
org.hibernate.loader.Loader.executeQueryStatement(Loader.java:1811)
at org.hibernate.loader.Loader.doQuery(Loader.java:899) at
org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:341)
at org.hibernate.loader.Loader.doList(Loader.java:2516) at
org.hibernate.loader.Loader.doList(Loader.java:2502) at
org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2332) at
org.hibernate.loader.Loader.list(Loader.java:2327) at
org.hibernate.loader.hql.QueryLoader.list(QueryLoader.java:490) at
org.hibernate.hql.internal.ast.QueryTranslatorImpl.list(QueryTranslatorImpl.java:355)
at
org.hibernate.engine.query.spi.HQLQueryPlan.performList(HQLQueryPlan.java:195)
at org.hibernate.internal.SessionImpl.list(SessionImpl.java:1247) at
org.hibernate.internal.QueryImpl.list(QueryImpl.java:101) at
org.hibernate.ejb.QueryImpl.getResultList(QueryImpl.java:264) at
org.hibernate.ejb.criteria.CriteriaQueryCompiler$3.getResultList(CriteriaQueryCompiler.java:254)
at com.procc.flams.dao.AbstractFacade.findAll(AbstractFacade.java:42)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:601) at
org.glassfish.ejb.security.application.EJBSecurityManager.runMethod(EJBSecurityManager.java:1052)
at
org.glassfish.ejb.security.application.EJBSecurityManager.invoke(EJBSecurityManager.java:1124)
at
com.sun.ejb.containers.BaseContainer.invokeBeanMethod(BaseContainer.java:5388)
at com.sun.ejb.EjbInvocation.invokeBeanMethod(EjbInvocation.java:619)
at
com.sun.ejb.containers.interceptors.AroundInvokeChainImpl.invokeNext(InterceptorManager.java:800)
at com.sun.ejb.EjbInvocation.proceed(EjbInvocation.java:571) at
com.sun.ejb.containers.interceptors.SystemInterceptorProxy.doAround(SystemInterceptorProxy.java:162)
at
com.sun.ejb.containers.interceptors.SystemInterceptorProxy.aroundInvoke(SystemInterceptorProxy.java:144)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:601) at
com.sun.ejb.containers.interceptors.AroundInvokeInterceptor.intercept(InterceptorManager.java:861)
at
com.sun.ejb.containers.interceptors.AroundInvokeChainImpl.invokeNext(InterceptorManager.java:800)
at
com.sun.ejb.containers.interceptors.InterceptorManager.intercept(InterceptorManager.java:370)
at
com.sun.ejb.containers.BaseContainer.__intercept(BaseContainer.java:5360)
at
com.sun.ejb.containers.BaseContainer.intercept(BaseContainer.java:5348)
at
com.sun.ejb.containers.EJBLocalObjectInvocationHandler.invoke(EJBLocalObjectInvocationHandler.java:214)
... 59 more
在JSF页面中:
<p:panel header="Airports list">
<p:dataTable value="#{airportController.items}" var="item">
<p:column>
<f:facet name="header">ID</f:facet>
<h:outputText value="#{item.airportId}"/>
</p:column>
生成错误的JSF代码:
public List<Airport> getItems() {
if(items==null){
items = airportFacade.findAll();
}
return items;
}
和持久性代码(我使用Hibernate 4.1作为JPA Provider):
public List<T> findAll() {
javax.persistence.criteria.CriteriaQuery cq = getEntityManager().getCriteriaBuilder().createQuery();
cq.select(cq.from(entityClass));
return getEntityManager().createQuery(cq).getResultList();
}
答案 0 :(得分:0)
例外的关键部分似乎是:
java.lang.IllegalStateException: WEB9031: WebappClassLoader unable to
load resource [org.postgresql.core.v3.QueryExecutorImpl$1], because it
has not yet been started, or was already stopped at
org.glassfish.web.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1401)
at
org.glassfish.web.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1359)
at
org.postgresql.core.v3.QueryExecutorImpl.sendQueryPreamble(QueryExecutorImpl.java:432)
at
PgJDBC尝试加载一个类和自定义Glassfish类加载器扼流圈。
我建议您将其转换为可以独立编译和运行的最小自包含测试用例,然后将其作为可能的Glassfish错误提交。测试案例至关重要;如果他们无法复制,他们就无法采取行动。
我能想到的唯一其他事情就是你的claasspath中可能有多个PgJDBC版本;你可能在古老的Java上使用v4 JDBC驱动程序,它只能理解JDBCv3和Glassfish掩盖真正的错误;或者您可能正在使用Java 1.6的最新v4驱动程序(由于构建问题而仅为1.7)。