0

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?

2 Answers 2

2

#{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.

5
  • but how could it be null if there are records in the database?
    – sass
    Commented Aug 24, 2010 at 19:24
  • 2
    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
    Commented Aug 24, 2010 at 19:26
  • 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
    Commented Aug 24, 2010 at 19:35
  • 2
    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
    Commented Aug 24, 2010 at 21:08
  • 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
    Commented Aug 25, 2010 at 8:02
0

The workarond for DI 101 and bug #338837 to fix the IAE issue for Criteria/Metamodel users attempting to use an EntityType that is not found is to specify the location of the classes (usually not required for Java EE environments) This environment will exist in Java SE, Spring and certain implementations of Java EE 6 Web Profile.

Exception in thread "main" java.lang.IllegalArgumentException: The type [null] is not the expected [EntityType] for the key class [class org.eclipse.persistence.example.distributed.collatz.model.UnitOfWork].

http://wiki.eclipse.org/EclipseLink/Development/JPA_2.0/metamodel_api#DI_101:_20100218:_Descriptor.javaClass_is_null_on_a_container_EM_for_a_specific_case

workaround is

http://bugs.eclipse.org/338837

<exclude-unlisted-classes>false</exclude-unlisted-classes>

or

<class>org.eclipse.persistence.example.distributed.collatz.model.UnitOfWork</class>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.