tags:

views:

125

answers:

1

I'm writing an administration part of the application which is responsible for CRUD operations. I decided to generate the jsf pages from the jpa entities but for some reason I keep getting this error:

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)

For the moment, the whole code is generated in Netbeans 6.9, using JSF 1.2 or 2.0 and postgresql 8.4 database. Is there any solution to that problem?

+1  A: 

#{busStop.pagingInfo.itemCount == 0}
Error reading 'pagingInfo' on type jsf.BusStopController
The type [null] is not the expected [EntityType] for the key class [class jpa.entities.BusStop].

Summarized: #{busStop} is null. Make sure that it's in the desired scope.

BalusC
but how could it be null if there are records in the database?
sass
No idea. You posted only the exception, no code. I am just translating the exception in a more understandable flavor. I'll do a shoot in the dark: it's declared to be lazily fetched, but after all something has failed?
BalusC
The whole code was generated by Netbeans - can the generator be messed up in 6.9? I left the default option for the data load, not the lazy load. However, now I'm not sure if it is not lazy load after all.
sass
In future, try to write code yourself so that you at least understand what you're programming. Don't drag'n'drop code as long as you don't understand the generated code.
BalusC
But the point of the generators is to speed up the process when needed. One can also assume that if the code was generated ny Netbeans and compiles - it should also work contrary to the code that one could write, right?
sass