java.lang.ClassCastException

There are no available Samebug tips for this exception. Do you have an idea how to solve this issue? A short tip would help users who saw this issue last week.

  • When I run an Integration test (org.springframework.osgi.test.AbstractConfigurableBundleCreatorTests) that test one of my Dao I get the following exception: java.lang.ClassCastException: org.hibernate.hql.ast.HqlToken cannot be cast to antlr.Token at antlr.CharScanner.makeToken(CharScanner.java:173) at org.hibernate.hql.ast.HqlLexer.makeToken(HqlLexer.java:39) at org.hibernate.hql.antlr.HqlBaseLexer.mIDENT(HqlBaseLexer.java:580) at org.hibernate.hql.antlr.HqlBaseLexer.nextToken(HqlBaseLexer.java:264) at antlr.TokenBuffer.fill(TokenBuffer.java:69) at antlr.TokenBuffer.LA(TokenBuffer.java:80) at antlr.LLkParser.LA(LLkParser.java:52) at org.hibernate.hql.antlr.HqlBaseParser.statement(HqlBaseParser.java:139) at org.hibernate.hql.ast.QueryTranslatorImpl.parse(QueryTranslatorImpl.java:248) at org.hibernate.hql.ast.QueryTranslatorImpl.doCompile(QueryTranslatorImpl.java:157) at org.hibernate.hql.ast.QueryTranslatorImpl.compile(QueryTranslatorImpl.java:111) at org.hibernate.engine.query.HQLQueryPlan.<init>(HQLQueryPlan.java:77) at org.hibernate.engine.query.HQLQueryPlan.<init>(HQLQueryPlan.java:56) at org.hibernate.engine.query.QueryPlanCache.getHQLQueryPlan(QueryPlanCache.java:72) at org.hibernate.impl.AbstractSessionImpl.getHQLQueryPlan(AbstractSessionImpl.java:133) at org.hibernate.impl.AbstractSessionImpl.createQuery(AbstractSessionImpl.java:112) at org.hibernate.impl.SessionImpl.createQuery(SessionImpl.java:1623) at org.springframework.orm.hibernate3.HibernateTemplate$39.doInHibernate(HibernateTemplate.java:1148) at org.springframework.orm.hibernate3.HibernateTemplate.doExecute(HibernateTemplate.java:419) at org.springframework.orm.hibernate3.HibernateTemplate.executeWithNativeSession(HibernateTemplate.java:374) at org.springframework.orm.hibernate3.HibernateTemplate.bulkUpdate(HibernateTemplate.java:1146) at org.springframework.orm.hibernate3.HibernateTemplate.bulkUpdate(HibernateTemplate.java:1138) If I add : "DynamicImport-Package : * " in the manifest of antlr my Integration test ends with success. The line that throw the ClassCastException is : Token tok = (Token)tokenObjectClass.newInstance(); in antlr.CharScanner. And tokenObjectClass is created by in antlr.Utils: ClassLoader contextClassLoader = Thread.currentThread().getContextClassLoader(); contextClassLoader.loadClass(name)
    via by Andrei Stefan (c),
  • hibernate HqlToken
    via by 964956,
    • java.lang.ClassCastException: org.hibernate.hql.ast.HqlToken cannot be cast to antlr.Token at antlr.CharScanner.makeToken(CharScanner.java:173) at org.hibernate.hql.ast.HqlLexer.makeToken(HqlLexer.java:62) at org.hibernate.hql.antlr.HqlBaseLexer.mIDENT(HqlBaseLexer.java:599) at org.hibernate.hql.antlr.HqlBaseLexer.nextToken(HqlBaseLexer.java:270) at antlr.TokenBuffer.fill(TokenBuffer.java:69) at antlr.TokenBuffer.LA(TokenBuffer.java:80) at antlr.LLkParser.LA(LLkParser.java:52) at org.hibernate.hql.antlr.HqlBaseParser.statement(HqlBaseParser.java:141) at org.hibernate.hql.ast.QueryTranslatorImpl.parse(QueryTranslatorImpl.java:274) 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:98) 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:1760)

    Users with the same issue

    Unknown visitor1 times, last one,
    Unknown visitor1 times, last one,