I started the migration of a customer's app from 2.x to 3.1.2 and ran into troubles with the standard parser, so I switched to the classic parser and moved on. Now an error message comes up when starting the app with the classic parser that tells me to use the new one.
Using the classic parser, I get the following stack trace:
Code:
2006-02-02 12:49:34,012 INFO [com.perfretail.k2v1.webapp1.web.suppliers.SupplierCatalogPricelistController] - <constructor>
2006-02-02 12:49:34,278 INFO [com.perfretail.k2v1.tahiti.EventBus.TEventQueueTrivial] - <Doing notifyLateArriver on event type DIRECTOR_READY on com.perfretail.k2v1.webapp1.web.cache.CacheEventHandler@76e1db>
2006-02-02 12:49:35,263 ERROR [com.perfretail.k2v1.tahiti.EventBus.TEventWorker] - <Hosed event is com.perfretail.k2v1.tahiti.EventBus.TCommandEvent@38d0a8[type=POS_JOURNAL_MDATA_REQUEST,contextInterface=interface com.perfretail.k2v1.envoys.sales.ISalesRollupEnvoy,contextId=UUID_Bubbas Butts and Brews,stateToken=com.perfretail.k2v1.tahiti.statetoken.StateToken@1799a1e]>
2006-02-02 12:49:35,263 ERROR [com.perfretail.k2v1.tahiti.EventBus.TEventWorker] - <Hosed event is com.perfretail.k2v1.tahiti.EventBus.TResultEvent@58f124[type=INIT_PHASE_1_DONE,contextInterface=<null>,contextId=<null>,stateToken=<null>]>
2006-02-02 12:49:35,278 ERROR [org.springframework.web.context.ContextLoader] - <Context initialization failed>
java.lang.RuntimeException: java.lang.RuntimeException: java.lang.UnsupportedOperationException: Not supported! Use the AST translator...
at com.perfretail.k2v1.tahiti.EventBus.TEventWorker.run(TEventWorker.java:64)
at java.lang.Thread.run(Unknown Source)
at com.perfretail.k2v1.tahiti.EventBus.TEventQueueTrivial.addEvent(TEventQueueTrivial.java:73)
at com.perfretail.k2v1.tahiti.Director.handleAbstractEvent(Director.java:243)
at com.perfretail.k2v1.tahiti.Director.handleEvent(Director.java:228)
at com.perfretail.k2v1.tahiti.Director.onApplicationEvent(Director.java:390)
at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:45)
at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:225)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:323)
at org.springframework.web.context.support.AbstractRefreshableWebApplicationContext.refresh(AbstractRefreshableWebApplicationContext.java:134)
at org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:246)
at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:184)
at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:49)
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:3669)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:4104)
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:759)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:739)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:524)
at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:894)
at org.apache.catalina.startup.HostConfig.deployDirectories(HostConfig.java:857)
at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:475)
at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1102)
at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:311)
at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1020)
at org.apache.catalina.core.StandardHost.start(StandardHost.java:718)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1012)
at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:442)
at org.apache.catalina.core.StandardService.start(StandardService.java:450)
at org.apache.catalina.core.StandardServer.start(StandardServer.java:683)
at org.apache.catalina.startup.Catalina.start(Catalina.java:537)
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.catalina.startup.Bootstrap.start(Bootstrap.java:271)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:409)
Caused by: java.lang.RuntimeException: java.lang.UnsupportedOperationException: Not supported! Use the AST translator...
at com.perfretail.k2v1.tahiti.EventBus.TEventWorker.run(TEventWorker.java:64)
at java.lang.Thread.run(Unknown Source)
at com.perfretail.k2v1.tahiti.EventBus.TEventQueueTrivial.addEvent(TEventQueueTrivial.java:73)
at com.perfretail.k2v1.tahiti.Director.handleAbstractEvent(Director.java:243)
at com.perfretail.k2v1.tahiti.Director.handleCommandEvent(Director.java:234)
at com.perfretail.k2v1.tahiti.statetoken.StateTokenService.onInitPhase1Done(StateTokenService.java:150)
at com.perfretail.k2v1.tahiti.DirectorComponent.onEvent(DirectorComponent.java:180)
at com.perfretail.k2v1.tahiti.EventBus.TEventWorker.run(TEventWorker.java:35)
... 36 more
The hibernate code that generates that message is in org.hibernate.hql.classic.QueryTranslatorImpl:
Code:
public int executeUpdate(QueryParameters queryParameters, SessionImplementor session) throws HibernateException {
throw new UnsupportedOperationException( "Not supported! Use the AST translator...");
}
So it looks like I can't use the classic parser.
The error started up in com.perfretail.k2v1.tahiti.EventBus.TEventQueueTrivial:
Code:
public synchronized void notifyLateArriver(ITEvent event, ITEventListener l) {
logger.info("Doing notifyLateArriver on event type " + event.getType().getTypeName() + " on " + l);
if (useRun) {
(new Thread(new TEventWorker(l, event))).run();
} else {
(new Thread(new TEventWorker(l, event))).start();
}
}
Now, com.perfretail.k2v1.tahiti.EventBus.TEventWorker.run() is here:
Code:
public void run() {
Log logger = LogFactory.getLog(getClass());
try {
listener.onEvent(event);
} catch (Error error) {
if (listener.getErrorHandler() != null && event.getStateToken() != null ) {
try {
listener.getErrorHandler().handleTEventError(event, error);
} catch (Throwable t) {
// eat errors in handler
t.printStackTrace();
}
}
throw error; // always rethrow Error
} catch (Exception e) {
if (listener.getErrorHandler() != null && event.getStateToken() != null) {
boolean rethrow = true;
try {
rethrow = listener.getErrorHandler().handleTEventException(
event, e);
} catch (Throwable t) {
// eat errors in handler
t.printStackTrace();
rethrow = true;
}
if (rethrow) {
throw new RuntimeException(e);
}
// else eat it
} else {
logger.error("Hosed event is "+event.toString());
e.printStackTrace();
throw new RuntimeException(e);
}
}
return;
}
This code ran under hibernate 2.x. If anyone has any idea as to how to make this work under 3.1.2, I would like to hear it.
However, I would rather solve the following namedquery problem that I get when I use the regular, non-classic parser:Code:
2006-02-02 16:05:44,519 ERROR [org.hibernate.hql.PARSER] - <line 2:95: expecting CLOSE, found '('>
2006-02-02 16:05:44,550 ERROR [org.hibernate.hql.PARSER] - <line 2:95: expecting CLOSE, found '('>
2006-02-02 16:05:44,597 ERROR [org.hibernate.hql.PARSER] - <line 2:95: expecting CLOSE, found '('>
2006-02-02 16:05:44,628 ERROR [org.hibernate.hql.PARSER] - <line 19:14: unexpected token: LIMIT>
2006-02-02 16:05:44,628 WARN [org.hibernate.hql.ast.HqlParser] - <processEqualityExpression() : No expression to process!>
2006-02-02 16:05:44,644 ERROR [org.hibernate.hql.PARSER] - <line 2:83: expecting CLOSE, found '('>
2006-02-02 16:05:44,644 ERROR [org.hibernate.hql.PARSER] - <line 2:83: expecting CLOSE, found '('>
2006-02-02 16:05:44,644 ERROR [org.hibernate.hql.PARSER] - <line 7:14: unexpected token: LIMIT>
2006-02-02 16:05:44,644 WARN [org.hibernate.hql.ast.HqlParser] - <processEqualityExpression() : No expression to process!>
2006-02-02 16:05:44,660 ERROR [org.hibernate.hql.PARSER] - <line 2:83: expecting CLOSE, found '('>
2006-02-02 16:05:44,660 ERROR [org.hibernate.hql.PARSER] - <line 2:95: expecting CLOSE, found '('>
2006-02-02 16:05:44,675 ERROR [org.hibernate.hql.PARSER] - <line 2:83: expecting CLOSE, found '('>
2006-02-02 16:05:44,691 ERROR [org.hibernate.impl.SessionFactoryImpl] - <Error in named query: com.perfretail.k2v1.trackers.registerops.operatorsForSelectSites>
org.hibernate.hql.ast.QuerySyntaxException: expecting CLOSE, found '(' near line 2, column 83 [
select distinct item.siteUuid, item.operatorId, count(distinct to_days(from_unixtime(item.timeStamp / 1000)))
from com.perfretail.k2v1.trackers.registerops.RegisterOpsItem as item
where item.chainUuid = :chainUuid and
item.siteUuid in (:siteUuids) and
item.status = :status and
item.timeStamp >= :start and
item.timeStamp < :end
group by item.siteUuid, item.operatorId]
at org.hibernate.hql.ast.ErrorCounter.throwQueryException(ErrorCounter.java:59)
at org.hibernate.hql.ast.QueryTranslatorImpl.parse(QueryTranslatorImpl.java:244)
at org.hibernate.hql.ast.QueryTranslatorImpl.doCompile(QueryTranslatorImpl.java:155)
at org.hibernate.hql.ast.QueryTranslatorImpl.compile(QueryTranslatorImpl.java:109)
at org.hibernate.engine.query.HQLQueryPlan.<init>(HQLQueryPlan.java:75)
at org.hibernate.engine.query.HQLQueryPlan.<init>(HQLQueryPlan.java:54)
at org.hibernate.engine.query.QueryPlanCache.getHQLQueryPlan(QueryPlanCache.java:71)
at org.hibernate.impl.SessionFactoryImpl.checkNamedQueries(SessionFactoryImpl.java:363)
at org.hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryImpl.java:327)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1176)
at org.springframework.orm.hibernate3.LocalSessionFactoryBean.newSessionFactory(LocalSessionFactoryBean.java:800)
The namedquery is here:
Code:
<query
name="com.perfretail.k2v1.trackers.registerops.operatorsForSelectSites"><![CDATA[
select distinct item.siteUuid, item.operatorId, count(distinct to_days(from_unixtime(item.timeStamp / 1000)))
from com.perfretail.k2v1.trackers.registerops.RegisterOpsItem as item
where item.chainUuid = :chainUuid and
item.siteUuid in (:siteUuids) and
item.status = :status and
item.timeStamp >= :start and
item.timeStamp < :end
group by item.siteUuid, item.operatorId]]></query>
So, is there a problem with this query? All I can say is it worked under 2.x.
Ideas?