Please help me understand this message. I will show the line that throws this error, then the stack-trace, then the full sources.
The line:
Code:
idList = getSession().createQuery("id from "+getGenericClassName()).list();
stack-trace:
Code:
id from app.persist.DBBook
Sep 2, 2011 4:58:20 PM com.sun.faces.context.ExceptionHandlerImpl log
SEVERE: JSF1073: javax.faces.event.AbortProcessingException caught during processing of PROCESS_VALIDATIONS 3 : UIComponent-ClientId=j_idt30:j_idt32, Message=/app/cat/books.xhtml @17,51 valueChangeListener="#{books.changeSize}": java.lang.IllegalArgumentException: node to traverse cannot be null!
Sep 2, 2011 4:58:20 PM com.sun.faces.context.ExceptionHandlerImpl log
SEVERE: /app/cat/books.xhtml @17,51 valueChangeListener="#{books.changeSize}": java.lang.IllegalArgumentException: node to traverse cannot be null!
javax.faces.event.AbortProcessingException: /app/cat/books.xhtml @17,51 valueChangeListener="#{books.changeSize}": java.lang.IllegalArgumentException: node to traverse cannot be null!
at javax.faces.event.MethodExpressionValueChangeListener.processValueChange(MethodExpressionValueChangeListener.java:157)
at javax.faces.event.ValueChangeEvent.processListener(ValueChangeEvent.java:134)
at javax.faces.component.UIComponentBase.broadcast(UIComponentBase.java:777)
at javax.faces.component.UIViewRoot.broadcastEvents(UIViewRoot.java:752)
at javax.faces.component.UIViewRoot.processValidators(UIViewRoot.java:1167)
at com.sun.faces.lifecycle.ProcessValidationsPhase.execute(ProcessValidationsPhase.java:76)
at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101)
at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:118)
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:508)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:306)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:240)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:161)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:164)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:100)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:541)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:383)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:243)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:188)
at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:288)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.IllegalArgumentException: node to traverse cannot be null!
at org.hibernate.hql.ast.util.NodeTraverser.traverseDepthFirst(NodeTraverser.java:63)
at org.hibernate.hql.ast.QueryTranslatorImpl.parse(QueryTranslatorImpl.java:280)
at org.hibernate.hql.ast.QueryTranslatorImpl.doCompile(QueryTranslatorImpl.java:182)
at org.hibernate.hql.ast.QueryTranslatorImpl.compile(QueryTranslatorImpl.java:136)
at org.hibernate.engine.query.HQLQueryPlan.<init>(HQLQueryPlan.java:101)
at org.hibernate.engine.query.HQLQueryPlan.<init>(HQLQueryPlan.java:80)
at org.hibernate.engine.query.QueryPlanCache.getHQLQueryPlan(QueryPlanCache.java:124)
at org.hibernate.impl.AbstractSessionImpl.getHQLQueryPlan(AbstractSessionImpl.java:156)
at org.hibernate.impl.AbstractSessionImpl.createQuery(AbstractSessionImpl.java:135)
at org.hibernate.impl.SessionImpl.createQuery(SessionImpl.java:1770)
at app.dao.ResultPager.populateIdList(ResultPager.java:18)
at app.BooksBean.init(BooksBean.java:35)
at app.BooksBean.changeSize(BooksBean.java:51)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.apache.el.parser.AstValue.invoke(AstValue.java:262)
at org.apache.el.MethodExpressionImpl.invoke(MethodExpressionImpl.java:278)
at com.sun.faces.facelets.el.TagMethodExpression.invoke(TagMethodExpression.java:105)
at javax.faces.event.MethodExpressionValueChangeListener.processValueChange(MethodExpressionValueChangeListener.java:144)
... 23 more
Sources:
Code:
package app.dao;
import java.util.ArrayList;
import java.util.List;
import org.hibernate.Query;
public class ResultPager<T> extends Dao<T> {
private Integer lowerLimit;
private Integer pageSize;
private List<Long> idList;
public ResultPager(Class clas){
super(clas);
}
public void populateIdList(){
System.out.println("id from "+getGenericClassName());
[b]idList = getSession().createQuery("id from "+getGenericClassName()).list();[/b]
}
public List<T> nextPage(){
List<Long> subList = new ArrayList<Long>();
for(int i = 0;i<pageSize;i++){
subList.set(i, idList.get(lowerLimit+i));
}
Query q = getSession().createQuery("from "+getGenericClassName()+" as c in (:subList)");
q.setParameterList("subList", subList);
return q.list();
}
public void setPageSize(Integer pageSize) {
if(pageSize == null || pageSize<1)
throw new IllegalArgumentException();
this.pageSize = pageSize;
}
public void setLowerLimit(Integer lowerLimit) {
if(lowerLimit == null || lowerLimit<0)
throw new IllegalArgumentException();
this.lowerLimit = lowerLimit;
}
public Integer getPageSize() {
return pageSize;
}
public Integer getLowerLimit() {
return lowerLimit;
}
}