1 Reply Latest reply on Jul 1, 2011 10:50 AM by Marcus Linke

    HQLToken cannot be cast to Antrl.Token

    Sam W Expert

      Hello,

       

       

      I want to deploy an application (Jaxws with Ejb3 + JPA) a .war file to JBOSS 6.0.0Final.

      But I got this error exception when the deployment is about to finish:

       

       

      [code]

      13:16:02,847 INFO  [org.apache.cxf.service.factory.ReflectionServiceFactoryBean] Creating Service {http://ws.houseware.com.au/}userwsService from class au.com.houseware.ws.userws

      13:16:06,743 INFO  [org.apache.cxf.endpoint.ServerImpl] Setting the server's publish address to be http://localhost:8080/houseware/userws

      13:16:07,487 INFO  [org.jboss.wsf.stack.cxf.deployment.WSDLFilePublisher] WSDL published to: file:/C:/jboss-6.0.0.Final/server/default/data/wsdl/houseware.war/userwsService.wsdl

      13:16:07,521 INFO  [org.apache.cxf.service.factory.ReflectionServiceFactoryBean] Creating Service {http://ws.houseware.com.au/}rolewsService from class au.com.houseware.ws.rolews

      13:16:07,735 INFO  [org.apache.cxf.endpoint.ServerImpl] Setting the server's publish address to be http://localhost:8080/houseware/rolews

      13:16:07,808 INFO  [org.jboss.wsf.stack.cxf.deployment.WSDLFilePublisher] WSDL published to: file:/C:/jboss-6.0.0.Final/server/default/data/wsdl/houseware.war/rolewsService.wsdl

      13:16:07,824 INFO  [org.jboss.wsf.framework.management.DefaultEndpointRegistry] register: jboss.ws:context=houseware,endpoint=userws

      13:16:07,842 INFO  [org.jboss.wsf.framework.management.DefaultEndpointRegistry] register: jboss.ws:context=houseware,endpoint=rolews

      13:16:07,889 INFO  [org.jboss.ejb3.deployers.JBossASKernel] Created KernelDeployment for: houseware.war

      13:16:08,649 INFO  [org.jboss.ejb3.deployers.JBossASKernel] installing bean: jboss.j2ee:jar=houseware.war,name=RoleJpaController,service=EJB3

      13:16:08,649 INFO  [org.jboss.ejb3.deployers.JBossASKernel]   with dependencies:

      13:16:08,649 INFO  [org.jboss.ejb3.deployers.JBossASKernel]   and demands:

      13:16:08,650 INFO  [org.jboss.ejb3.deployers.JBossASKernel]     jboss-switchboard:appName=houseware,module=houseware; Required: Create

      13:16:08,650 INFO  [org.jboss.ejb3.deployers.JBossASKernel]     jboss.ejb:service=EJBTimerService; Required: Described

      13:16:08,650 INFO  [org.jboss.ejb3.deployers.JBossASKernel]   and supplies:

      13:16:08,651 INFO  [org.jboss.ejb3.deployers.JBossASKernel]     jndi:RoleJpaController

      13:16:08,666 INFO  [org.jboss.ejb3.deployers.JBossASKernel] Added bean(jboss.j2ee:jar=houseware.war,name=RoleJpaController,service=EJB3) to KernelDeployment of: houseware.war

      13:16:08,688 INFO  [org.jboss.ejb3.deployers.JBossASKernel] installing bean: jboss.j2ee:jar=houseware.war,name=UserJpaController,service=EJB3

      13:16:08,691 INFO  [org.jboss.ejb3.deployers.JBossASKernel]   with dependencies:

      13:16:08,693 INFO  [org.jboss.ejb3.deployers.JBossASKernel]   and demands:

      13:16:08,695 INFO  [org.jboss.ejb3.deployers.JBossASKernel]     jboss-switchboard:appName=houseware,module=houseware; Required: Create

      13:16:08,696 INFO  [org.jboss.ejb3.deployers.JBossASKernel]     jboss.ejb:service=EJBTimerService; Required: Described

      13:16:08,696 INFO  [org.jboss.ejb3.deployers.JBossASKernel]   and supplies:

      13:16:08,696 INFO  [org.jboss.ejb3.deployers.JBossASKernel]     jndi:UserJpaController

      13:16:08,697 INFO  [org.jboss.ejb3.deployers.JBossASKernel] Added bean(jboss.j2ee:jar=houseware.war,name=UserJpaController,service=EJB3) to KernelDeployment of: houseware.war

      13:16:08,843 INFO  [org.jboss.ejb3.deployers.JBossASKernel] installing bean: jboss.j2ee:jar=houseware.war,name=rolews,service=EJB3

      13:16:08,843 INFO  [org.jboss.ejb3.deployers.JBossASKernel]   with dependencies:

      13:16:08,843 INFO  [org.jboss.ejb3.deployers.JBossASKernel]   and demands:

      13:16:08,843 INFO  [org.jboss.ejb3.deployers.JBossASKernel]     jboss-switchboard:appName=houseware,module=houseware; Required: Create

      13:16:08,844 INFO  [org.jboss.ejb3.deployers.JBossASKernel]     jboss.ejb:service=EJBTimerService; Required: Described

      13:16:08,844 INFO  [org.jboss.ejb3.deployers.JBossASKernel]     jboss-injector:topLevelUnit=houseware.war,unit=houseware.war,bean=rolews; Required: Described

      13:16:08,844 INFO  [org.jboss.ejb3.deployers.JBossASKernel]   and supplies:

      13:16:08,844 INFO  [org.jboss.ejb3.deployers.JBossASKernel]     jndi:rolews

      13:16:08,845 INFO  [org.jboss.ejb3.deployers.JBossASKernel] Added bean(jboss.j2ee:jar=houseware.war,name=rolews,service=EJB3) to KernelDeployment of: houseware.war

      13:16:08,847 INFO  [org.jboss.ejb3.deployers.JBossASKernel] installing bean: jboss.j2ee:jar=houseware.war,name=userws,service=EJB3

      13:16:08,848 INFO  [org.jboss.ejb3.deployers.JBossASKernel]   with dependencies:

      13:16:08,848 INFO  [org.jboss.ejb3.deployers.JBossASKernel]   and demands:

      13:16:08,848 INFO  [org.jboss.ejb3.deployers.JBossASKernel]     jboss-switchboard:appName=houseware,module=houseware; Required: Create

      13:16:08,848 INFO  [org.jboss.ejb3.deployers.JBossASKernel]     jboss.ejb:service=EJBTimerService; Required: Described

      13:16:08,849 INFO  [org.jboss.ejb3.deployers.JBossASKernel]     jboss-injector:topLevelUnit=houseware.war,unit=houseware.war,bean=userws; Required: Described

      13:16:08,849 INFO  [org.jboss.ejb3.deployers.JBossASKernel]   and supplies:

      13:16:08,849 INFO  [org.jboss.ejb3.deployers.JBossASKernel]     jndi:userws

      13:16:08,850 INFO  [org.jboss.ejb3.deployers.JBossASKernel] Added bean(jboss.j2ee:jar=houseware.war,name=userws,service=EJB3) to KernelDeployment of: houseware.war

      13:16:24,862 INFO  [org.jboss.ejb3.session.SessionSpecContainer] Starting jboss.j2ee:jar=houseware.war,name=UserJpaController,service=EJB3

      13:16:24,931 INFO  [org.jboss.ejb3.EJBContainer] STARTED EJB: au.com.houseware.persistence.controller.UserJpaController ejbName: UserJpaController

      13:16:24,949 INFO  [org.jboss.ejb3.proxy.impl.jndiregistrar.JndiSessionRegistrarBase] Binding the following Entries in Global JNDI:

       

       

       

       

      13:16:24,951 WARN  [org.jboss.ejb3.TimerServiceContainer] EJBTHREE-2193: using deprecated TimerServiceFactory for restoring timers

      13:16:25,556 ERROR [org.jboss.kernel.plugins.dependency.AbstractKernelController] Error installing to Start: name=jboss.j2ee:jar=houseware.war,name=UserJpaController,service=EJB3 state=Create: java.lang.ClassCastException: org.hibernate.hql.ast.HqlToken cannot be cast to antlr.Token

              at antlr.CharScanner.makeToken(Unknown Source) [:6.0.0.Final]

              at org.hibernate.hql.ast.HqlLexer.makeToken(HqlLexer.java:62) [:3.6.0.Final]

              at org.hibernate.hql.antlr.HqlBaseLexer.mIDENT(HqlBaseLexer.java:599) [:3.6.0.Final]

              at org.hibernate.hql.antlr.HqlBaseLexer.nextToken(HqlBaseLexer.java:270) [:3.6.0.Final]

              at antlr.TokenBuffer.fill(Unknown Source) [:6.0.0.Final]

              at antlr.TokenBuffer.LA(Unknown Source) [:6.0.0.Final]

              at antlr.LLkParser.LA(Unknown Source) [:6.0.0.Final]

      [/code]

       

       

      Here is my persistence.xml file:

      [code]

      <?xml version="1.0" encoding="UTF-8"?>

      <persistence version="2.0" xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd">

        <persistence-unit name="housewarePU" transaction-type="JTA">

          <jta-data-source>houseware</jta-data-source>

          <properties>

              <property name="hibernate.query.factory_class" value="org.hibernate.hql.classic.ClassicQueryTranslatorFactory" />

          </properties>

        </persistence-unit>

      </persistence>

      [/code]

       

       

      hibernate.cfg.xml file:

      [code]

      <?xml version="1.0" encoding="UTF-8"?>

      <!DOCTYPE hihibernate.query.factory_classbernate-configuration PUBLIC "-//Hibernate/Hibernate Configuration DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">

      <hibernate-configuration>

        <session-factory>

          <property name="hibernate.dialect">org.hibernate.dialect.DerbyDialect</property>

          <property name="hibernate.connection.driver_class">org.apache.derby.jdbc.ClientDriver</property>

          <property name="hibernate.connection.url">jdbc:derby://localhost:1527/sample</property>

          <property name="hibernate.connection.username">app</property>

          <property name="hibernate.connection.password">app</property>

          <property name="hibernate.query.factory_class">org.hibernate.hql.classic.ClassicQueryTranslatorFactory</property>

        </session-factory>

      </hibernate-configuration>

       

       

      [/code]

       

       

      I am new to this, and I might have missed something else.

       

       

      Very appreciate for any suggestion and help.

       

       

      Thanks

      Sam

        • 1. Re: HQLToken cannot be cast to Antrl.Token
          Marcus Linke Newbie

          Hi,

           

          probably you have included some hibernate jars in your EAR that doesn't match with the version that JBOSS uses internally (deployed in $JBOSS_HOME./common/lib). If using the EJB timer / scheduler service within your application then the service needs to load classes from within our EAR, so classloader isolation can't work then. At least that's what i understand it. I ran into the same problem and found no solution so far beside to remove all hibernate libs from EAR and use JBOSS default hibernate version.

           

          Regards