1

When running an app on Tomcat I don't get any error. When running on Oracle (OC4J) 10.1.3 I get the following:

org.hibernate.hql.ast.QuerySyntaxError: unexpected end of subtree [   
SELECT c, cc, pa, ta      
  FROM com.test.CASE c
  LEFT OUTER JOIN c.personadmin pa           
  LEFT OUTER JOIN c.termadmin ta           
  LEFT OUTER JOIN c.caseChannel cc     
 WHERE c.case_id IN ()  
ORDER BY c.case_id, cc.caseChannelCd ]
...
Caused by: <AST>: unexpected end of subtree

Seems like a library issue but I haven't found any inconsisntency (regarding Hibernate) between environments yet.

What might cause this type of error?

Edit:

Here's the source:

    String hql = "   SELECT c, cc, pa, ta " 
               + "     FROM CASE c " 
               + "          LEFT OUTER JOIN c.personadmin pa "
               + "          LEFT OUTER JOIN c.termadmin ta "
               + "          LEFT OUTER JOIN c.caseChannel cc "
               + "    WHERE c.case_id IN (:caseIds) "
               + " ORDER BY c.case_id, cc.caseChannelCd ";

    Query query = getSession().createQuery(hql);
    query.setParameterList("caseIds", caseIdList);
    results = query.list();
jlpp
  • 1,564
  • 5
  • 23
  • 36
  • Cause was that the caseIdList was empty on the Oracle app server and it wasn't on Tomcat. Root cause is still being investigated but it appears to be related to XML library differences between the two affecting a Spring WS service. – jlpp Feb 01 '11 at 17:56
  • In case it helps someone else, the root cause was that I am using JAXB for marshalling/unmarshalling with Spring-WS. The war was missing the package-info.java class that JAXB (xjc) creates along side the beans used in the marshalling process. – jlpp Feb 01 '11 at 18:46
  • One more: package-info.java was not compiled due to a bug in Ant 1.7.1 (Eclipse plugin). See https://issues.apache.org/bugzilla/show_bug.cgi?id=43114 for more information. Fixed by touching p-i.java files and compiling them before all other source. – jlpp Feb 01 '11 at 20:03

1 Answers1

4

It's really strange that this error happens in one container, but not on the other. I'd say the problem is here:

WHERE c.case_id IN ()

Thus, it implies that it would also fail on Tomcat. So, I would first verify if the query you are running is exactly the same in both.

jpkroehling
  • 13,881
  • 1
  • 37
  • 39
  • 1
    This is correct, an empty in clause results in this problem, just had this happen a few months ago. – Kaleb Brasee Feb 01 '11 at 16:06
  • Added the source to show how the IN clause is defined. Does this source look correct? – jlpp Feb 01 '11 at 16:54
  • 1
    Sounds better, and I still think it's not a container-related problem. My guess is that `caseIdList` is empty in OC4J and it's not empty on Tomcat (maybe it's just a coincidence). So, add a debug logging before executing the query, to print the size of this collection, just to make sure you have the same query, with the same parameters, just different servers. – jpkroehling Feb 01 '11 at 17:02