我正在编写负责CRUD操作的应用程序的管理部分。我决定从jpa实体生成jsf页面但由于某种原因我不断收到此错误:
org.apache.jasper.el.JspELException: /busStop/List.jsp(18,12) '#{busStop.pagingInfo.itemCount == 0}' Error reading 'pagingInfo' on type jsf.BusStopController
at org.apache.jasper.el.JspValueExpression.getValue(JspValueExpression.java:107)
at javax.faces.component.ComponentStateHelper.eval(ComponentStateHelper.java:190)
at javax.faces.component.UIComponentBase.isRendered(UIComponentBase.java:416)
at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1607)
at javax.faces.render.Renderer.encodeChildren(Renderer.java:168)
at javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:848)
at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1613)
at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1616)
at com.sun.faces.application.view.JspViewHandlingStrategy.doRenderView(JspViewHandlingStrategy.java:420)
at com.sun.faces.application.view.JspViewHandlingStrategy.renderView(JspViewHandlingStrategy.java:209)
at com.sun.faces.application.view.MultiViewHandler.renderView(MultiViewHandler.java:126)
at com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:127)
at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101)
at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:139)
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:313)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:393)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298)
at org.apache.coyote.http11.Http11AprProcessor.process(Http11AprProcessor.java:859)
at org.apache.coyote.http11.Http11AprProtocol$Http11ConnectionHandler.process(Http11AprProtocol.java:579)
at org.apache.tomcat.util.net.AprEndpoint$Worker.run(AprEndpoint.java:1555)
at java.lang.Thread.run(Thread.java:619)
Caused by: java.lang.IllegalArgumentException: The type [null] is not the expected [EntityType] for the key class [class jpa.entities.BusStop].
at org.eclipse.persistence.internal.jpa.metamodel.MetamodelImpl.entity(MetamodelImpl.java:152)
at org.eclipse.persistence.internal.jpa.querydef.AbstractQueryImpl.from(AbstractQueryImpl.java:97)
at jpa.controllers.BusStopJpaController.getBusStopCount(BusStopJpaController.java:255)
at jsf.BusStopController.getPagingInfo(BusStopController.java:43)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at javax.el.BeanELResolver.getValue(BeanELResolver.java:62)
at javax.el.CompositeELResolver.getValue(CompositeELResolver.java:54)
at com.sun.faces.el.FacesCompositeELResolver.getValue(FacesCompositeELResolver.java:72)
at org.apache.el.parser.AstValue.getValue(AstValue.java:123)
at org.apache.el.parser.AstEqual.getValue(AstEqual.java:37)
at org.apache.el.ValueExpressionImpl.getValue(ValueExpressionImpl.java:186)
at org.apache.jasper.el.JspValueExpression.getValue(JspValueExpression.java:101)
目前,整个代码是在Netbeans 6.9中使用JSF 1.2或2.0和postgresql 8.4数据库生成的。这个问题有什么解决方案吗?
答案 0 :(得分:2)
#{busStop.pagingInfo.itemCount == 0}
在类型jsf.BusStopController上读取'pagingInfo'时出错 类型[null]不是密钥类[class jpa.entities.BusStop]的预期[EntityType]。
摘要:#{busStop}
为null
。确保它在所需的范围内。
答案 1 :(得分:0)
DI 101的工作区和错误#338837修复试图使用未找到的EntityType的Criteria / Metamodel用户的IAE问题是指定类的位置(通常Java EE环境不需要) 此环境将存在于Java SE,Spring和Java EE 6 Web Profile的某些实现中。
线程“main”中的异常java.lang.IllegalArgumentException:类型[null]不是键类[class org.eclipse.persistence.example.distributed.collatz.model.UnitOfWork]的预期[EntityType]。
解决方法是
http://bugs.eclipse.org/338837
<exclude-unlisted-classes>false</exclude-unlisted-classes>
或
<class>org.eclipse.persistence.example.distributed.collatz.model.UnitOfWork</class>