0 Replies Latest reply on Nov 22, 2005 10:46 PM by Alfred Yao

    Exception: java.lang.ClassCastException: org.hibernate.hql.a

    Alfred Yao Newbie

      In the class below, I use EntityManager to perform the hibernate query, create Query and setParameter method is all OK, but when actually execute the getSingleResult() method, some exception occured. Please help! Thanks.

      Stateless Bean Class:

      @Stateless
      public class PublicFacadeBean implements PublicFacade, PublicFacadeLocal {

      @PersistenceContext(unitName="wpp")
      public EntityManager em;

      public Object process(VOPackage vo) {
      Map param = (HashMap) vo.getData();

      Query query = em.createQuery("FROM User AS user WHERE user.userName = :username");
      query.setParameter("username", param.get("userName").toString());
      Object obj = query.getSingleResult();
      // return ( (Business) Class.forName(vo.getBusiness(), true, this.getClass().getClassLoader()).newInstance()).process(vo);
      return (User) obj;
      }
      }

      Exception Trace:

      11:46:13,515 ERROR [PublicProxy] Class not found: null; CausedByException is:
      org.hibernate.hql.ast.HqlToken
      11:46:13,515 INFO [STDOUT] javax.ejb.EJBException: null; CausedByException is:
      org.hibernate.hql.ast.HqlToken

      11:46:13,515 INFO [STDOUT] at org.jboss.ejb3.tx.Ejb3TxPolicy.handleExceptionInOurTx(Ejb3TxPolicy.java:46)
      11:46:13,515 INFO [STDOUT] at org.jboss.aspects.tx.TxPolicy.invokeInOurTx(TxPolicy.java:70)
      11:46:13,515 INFO [STDOUT] at org.jboss.aspects.tx.TxInterceptor$Required.invoke(TxInterceptor.java:134)
      11:46:13,531 INFO [STDOUT] at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:98)
      11:46:13,546 INFO [STDOUT] at org.jboss.aspects.tx.TxPropagationInterceptor.invoke(TxPropagationInterceptor.java:61)
      11:46:13,546 INFO [STDOUT] at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:98)
      11:46:13,546 INFO [STDOUT] at org.jboss.ejb3.stateless.StatelessInstanceInterceptor.invoke(StatelessInstanceInterceptor.java:39)
      11:46:13,546 INFO [STDOUT] at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:98)
      11:46:13,546 INFO [STDOUT] at org.jboss.aspects.security.AuthenticationInterceptor.invoke(AuthenticationInterceptor.java:63)
      11:46:13,546 INFO [STDOUT] at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:98)
      11:46:13,546 INFO [STDOUT] at org.jboss.ejb3.ENCPropagationInterceptor.invoke(ENCPropagationInterceptor.java:32)
      11:46:13,546 INFO [STDOUT] at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:98)
      11:46:13,546 INFO [STDOUT] at org.jboss.ejb3.asynchronous.AsynchronousInterceptor.invoke(AsynchronousInterceptor.java:91)
      11:46:13,546 INFO [STDOUT] at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:98)
      11:46:13,546 INFO [STDOUT] at org.jboss.ejb3.stateless.StatelessContainer.localInvoke(StatelessContainer.java:163)
      11:46:13,546 INFO [STDOUT] at org.jboss.ejb3.stateless.StatelessLocalProxy.invoke(StatelessLocalProxy.java:60)
      11:46:13,546 INFO [STDOUT] at $Proxy85.process(Unknown Source)
      11:46:13,546 INFO [STDOUT] at com.alfred.common.proxy.RemoteProxy.process(RemoteProxy.java:55)
      11:46:13,546 INFO [STDOUT] at com.alfred.webpa.common.security.Authenticator.authenticate(Authenticator.java:26)
      11:46:13,546 INFO [STDOUT] at com.alfred.webpa.common.filter.AuthenticateFilter.authenticate(AuthenticateFilter.java:259)
      11:46:13,546 INFO [STDOUT] at com.alfred.webpa.common.filter.AuthenticateFilter.validateSignOn(AuthenticateFilter.java:252)
      11:46:13,546 INFO [STDOUT] at com.alfred.webpa.common.filter.AuthenticateFilter.doFilter(AuthenticateFilter.java:125)
      11:46:13,546 INFO [STDOUT] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
      11:46:13,546 INFO [STDOUT] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
      11:46:13,546 INFO [STDOUT] at com.alfred.webpa.common.filter.EncodeFilter.doFilter(EncodeFilter.java:43)
      11:46:13,546 INFO [STDOUT] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
      11:46:13,546 INFO [STDOUT] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
      11:46:13,546 INFO [STDOUT] at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:81)
      11:46:13,546 INFO [STDOUT] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
      11:46:13,546 INFO [STDOUT] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
      11:46:13,546 INFO [STDOUT] at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
      11:46:13,546 INFO [STDOUT] at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
      11:46:13,546 INFO [STDOUT] at org.jboss.web.tomcat.security.CustomPrincipalValve.invoke(CustomPrincipalValve.java:39)
      11:46:13,546 INFO [STDOUT] at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:159)
      11:46:13,546 INFO [STDOUT] at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:59)
      11:46:13,546 INFO [STDOUT] at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
      11:46:13,546 INFO [STDOUT] at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
      11:46:13,546 INFO [STDOUT] at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
      11:46:13,546 INFO [STDOUT] at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
      11:46:13,546 INFO [STDOUT] at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:856)
      11:46:13,546 INFO [STDOUT] at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:744)
      11:46:13,546 INFO [STDOUT] at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
      11:46:13,546 INFO [STDOUT] at org.apache.tomcat.util.net.MasterSlaveWorkerThread.run(MasterSlaveWorkerThread.java:112)
      11:46:13,546 INFO [STDOUT] at java.lang.Thread.run(Thread.java:595)
      11:46:13,546 INFO [STDOUT] java.lang.ClassCastException: org.hibernate.hql.ast.HqlToken
      11:46:13,562 INFO [STDOUT] at org.hibernate.hql.ast.HqlLexer.makeToken(HqlLexer.java:39)
      11:46:13,562 INFO [STDOUT] at org.hibernate.hql.antlr.HqlBaseLexer.mIDENT(HqlBaseLexer.java:580)
      11:46:13,562 INFO [STDOUT] at org.hibernate.hql.antlr.HqlBaseLexer.nextToken(HqlBaseLexer.java:264)
      11:46:13,562 INFO [STDOUT] at antlr.TokenBuffer.fill(TokenBuffer.java:69)
      11:46:13,562 INFO [STDOUT] at antlr.TokenBuffer.LA(TokenBuffer.java:80)
      11:46:13,562 INFO [STDOUT] at antlr.LLkParser.LA(LLkParser.java:52)
      11:46:13,562 INFO [STDOUT] at org.hibernate.hql.antlr.HqlBaseParser.statement(HqlBaseParser.java:139)
      11:46:13,562 INFO [STDOUT] at org.hibernate.hql.ast.QueryTranslatorImpl.parse(QueryTranslatorImpl.java:236)
      11:46:13,562 INFO [STDOUT] at org.hibernate.hql.ast.QueryTranslatorImpl.doCompile(QueryTranslatorImpl.java:153)
      11:46:13,562 INFO [STDOUT] at org.hibernate.hql.ast.QueryTranslatorImpl.compile(QueryTranslatorImpl.java:103)
      11:46:13,562 INFO [STDOUT] at org.hibernate.impl.SessionFactoryImpl.getQuery(SessionFactoryImpl.java:473)
      11:46:13,562 INFO [STDOUT] at org.hibernate.impl.SessionImpl.getQueries(SessionImpl.java:1060)
      11:46:13,562 INFO [STDOUT] at org.hibernate.impl.SessionImpl.list(SessionImpl.java:1010)
      11:46:13,562 INFO [STDOUT] at org.hibernate.impl.QueryImpl.list(QueryImpl.java:74)
      11:46:13,562 INFO [STDOUT] at org.hibernate.impl.AbstractQueryImpl.uniqueResult(AbstractQueryImpl.java:650)
      11:46:13,562 INFO [STDOUT] at org.hibernate.ejb.QueryImpl.getSingleResult(QueryImpl.java:43)
      11:46:13,562 INFO [STDOUT] at com.alfred.webpa.ejb.facade.PublicFacadeBean.process(PublicFacadeBean.java:25)
      11:46:13,562 INFO [STDOUT] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      11:46:13,562 INFO [STDOUT] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      11:46:13,562 INFO [STDOUT] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      11:46:13,562 INFO [STDOUT] at java.lang.reflect.Method.invoke(Method.java:585)
      11:46:13,562 INFO [STDOUT] at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:109)
      11:46:13,562 INFO [STDOUT] at org.jboss.ejb3.AllowedOperationsInterceptor.invoke(AllowedOperationsInterceptor.java:32)
      11:46:13,562 INFO [STDOUT] at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:98)
      11:46:13,562 INFO [STDOUT] at org.jboss.aspects.tx.TxPolicy.invokeInOurTx(TxPolicy.java:66)
      11:46:13,562 INFO [STDOUT] at org.jboss.aspects.tx.TxInterceptor$Required.invoke(TxInterceptor.java:134)
      11:46:13,562 INFO [STDOUT] at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:98)
      11:46:13,562 INFO [STDOUT] at org.jboss.aspects.tx.TxPropagationInterceptor.invoke(TxPropagationInterceptor.java:61)
      11:46:13,562 INFO [STDOUT] at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:98)
      11:46:13,562 INFO [STDOUT] at org.jboss.ejb3.stateless.StatelessInstanceInterceptor.invoke(StatelessInstanceInterceptor.java:39)
      11:46:13,562 INFO [STDOUT] at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:98)
      11:46:13,562 INFO [STDOUT] at org.jboss.aspects.security.AuthenticationInterceptor.invoke(AuthenticationInterceptor.java:63)
      11:46:13,562 INFO [STDOUT] at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:98)
      11:46:13,562 INFO [STDOUT] at org.jboss.ejb3.ENCPropagationInterceptor.invoke(ENCPropagationInterceptor.java:32)
      11:46:13,562 INFO [STDOUT] at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:98)
      11:46:13,562 INFO [STDOUT] at org.jboss.ejb3.asynchronous.AsynchronousInterceptor.invoke(AsynchronousInterceptor.java:91)
      11:46:13,562 INFO [STDOUT] at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:98)
      11:46:13,562 INFO [STDOUT] at org.jboss.ejb3.stateless.StatelessContainer.localInvoke(StatelessContainer.java:163)
      11:46:13,562 INFO [STDOUT] at org.jboss.ejb3.stateless.StatelessLocalProxy.invoke(StatelessLocalProxy.java:60)
      11:46:13,562 INFO [STDOUT] at $Proxy85.process(Unknown Source)
      11:46:13,562 INFO [STDOUT] at com.alfred.common.proxy.RemoteProxy.process(RemoteProxy.java:55)
      11:46:13,562 INFO [STDOUT] at com.alfred.webpa.common.security.Authenticator.authenticate(Authenticator.java:26)
      11:46:13,562 INFO [STDOUT] at com.alfred.webpa.common.filter.AuthenticateFilter.authenticate(AuthenticateFilter.java:259)
      11:46:13,562 INFO [STDOUT] at com.alfred.webpa.common.filter.AuthenticateFilter.validateSignOn(AuthenticateFilter.java:252)
      11:46:13,562 INFO [STDOUT] at com.alfred.webpa.common.filter.AuthenticateFilter.doFilter(AuthenticateFilter.java:125)
      11:46:13,562 INFO [STDOUT] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
      11:46:13,562 INFO [STDOUT] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
      11:46:13,562 INFO [STDOUT] at com.alfred.webpa.common.filter.EncodeFilter.doFilter(EncodeFilter.java:43)
      11:46:13,562 INFO [STDOUT] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
      11:46:13,562 INFO [STDOUT] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
      11:46:13,562 INFO [STDOUT] at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:81)
      11:46:13,562 INFO [STDOUT] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
      11:46:13,562 INFO [STDOUT] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
      11:46:13,562 INFO [STDOUT] at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
      11:46:13,562 INFO [STDOUT] at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
      11:46:13,562 INFO [STDOUT] at org.jboss.web.tomcat.security.CustomPrincipalValve.invoke(CustomPrincipalValve.java:39)
      11:46:13,562 INFO [STDOUT] at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:159)
      11:46:13,562 INFO [STDOUT] at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:59)
      11:46:13,562 INFO [STDOUT] at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
      11:46:13,562 INFO [STDOUT] at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
      11:46:13,562 INFO [STDOUT] at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
      11:46:13,562 INFO [STDOUT] at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
      11:46:13,562 INFO [STDOUT] at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:856)
      11:46:13,562 INFO [STDOUT] at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:744)
      11:46:13,562 INFO [STDOUT] at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
      11:46:13,562 INFO [STDOUT] at org.apache.tomcat.util.net.MasterSlaveWorkerThread.run(MasterSlaveWorkerThread.java:112)
      11:46:13,562 INFO [STDOUT] at java.lang.Thread.run(Thread.java:595)