-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: Class list is not found in hql query "select new list(*)"
PostPosted: Sun Apr 18, 2010 9:46 am 
Newbie

Joined: Sun Apr 18, 2010 9:08 am
Posts: 1
Hi everyone,

I am using spring-2.0.7 and hibernate-core-3.3.2.GA in a J2EE web application. I would like to create hql queries such as "select new list(t.id, t.name) from Type t".

When such a query is created, a ClassNotFoundException is thrown, seems because the "list" class cannot be found. The exception is thrown from within method classForName of org.hibernate.util.RefletHelper when it is called with the argument name="list".

Code:
   public static Class classForName(String name) throws ClassNotFoundException {
      try {
         ClassLoader contextClassLoader = Thread.currentThread().getContextClassLoader();
         if ( contextClassLoader != null ) {
            return contextClassLoader.loadClass(name);
         }
      }
      catch ( Throwable ignore ) {
      }
      return Class.forName( name );
   }


Here is the stacktrace too:
Code:
java.lang.NullPointerException
   at java.lang.Class.forName0(Native Method)
   at java.lang.Class.forName(Class.java:169)
   at org.hibernate.util.ReflectHelper.classForName(ReflectHelper.java:192)
   at org.hibernate.hql.classic.SelectParser.token(SelectParser.java:96)
   at org.hibernate.hql.classic.ClauseParser.token(ClauseParser.java:109)
   at org.hibernate.hql.classic.ClauseParser.end(ClauseParser.java:136)
   at org.hibernate.hql.classic.PreprocessingParser.end(PreprocessingParser.java:145)
   at org.hibernate.hql.classic.ParserHelper.parse(ParserHelper.java:52)
   at org.hibernate.hql.classic.QueryTranslatorImpl.compile(QueryTranslatorImpl.java:239)
   at org.hibernate.hql.classic.QueryTranslatorImpl.compile(QueryTranslatorImpl.java:208)
   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:94)
   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:1651)
   at common.base.spring.dao.CentralDaoImpl.find(CentralDaoImpl.java:630)
   at common.base.spring.dao.CentralDaoImpl.find(CentralDaoImpl.java:527)
   at sun.reflect.GeneratedMethodAccessor200.invoke(Unknown Source)
   at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
   at java.lang.reflect.Method.invoke(Method.java:597)
   at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:304)
   at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:182)
   at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:149)
   at org.springframework.orm.hibernate3.HibernateInterceptor.invoke(HibernateInterceptor.java:104)
   at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
   at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)
   at $Proxy1.find(Unknown Source)
   at common.hibernate.DBManager.find(DBManager.java:27)
   at erp.etm.tsm.basicInfo.service.impl.TaskTypeStateStepServiceImpl.getQueryByParameters(TaskTypeStateStepServiceImpl.java:39)
   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 org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:304)
   at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:182)
   at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:149)
   at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:106)
   at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
   at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)
   at $Proxy464.getQueryByParameters(Unknown Source)
   at common.base.struts.action.ActionPattern3.patternPostprocess(ActionPattern3.java:93)
   at common.base.struts.action.ActionPattern.postprocess(ActionPattern.java:121)
   at common.base.struts.action.BaseAction.execute(BaseAction.java:114)
   at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:431)
   at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:236)
   at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1196)
   at org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:414)
   at javax.servlet.http.HttpServlet.service(HttpServlet.java:705)
   at javax.servlet.http.HttpServlet.service(HttpServlet.java:818)
   at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
   at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
   at common.filter.GlobalVariable.doFilter(GlobalVariable.java:309)
   at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
   at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
   at common.filter.CharsetFilter.doFilter(CharsetFilter.java:27)
   at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
   at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
   at common.hibernate.HibenateFilter.doFilterInternal(HibenateFilter.java:80)
   at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:75)
   at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
   at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
   at common.filter.UsernameFileter.doFilter(UsernameFileter.java:34)
   at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
   at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
   at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
   at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
   at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:432)
   at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
   at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
   at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
   at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
   at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869)
   at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:664)
   at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
   at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:80)
   at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)
   at java.lang.Thread.run(Thread.java:619)


Thanks for you time in advance,


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.