cayenne-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Rick Bonnett <>
Subject SQLTemplate problems in 3.1B2
Date Tue, 16 Apr 2013 12:38:22 GMT
I'm trying to use SQLTemplate queries and running into a strange problem. This snippet works
fine if I run it in a plain Java application, but fails if I then use it within a web service
running under Glassfish.
In both cases I am using the same cayenne metadata files. I have also noticed the same issue
when using EJBQL queries.

ServerRuntime cayenneRuntime = new ServerRuntime("cayenne-cayenne-service-template.xml");
ObjectContext context = cayenneRuntime.getContext();

SQLTemplate  sql = new SQLTemplate(Accessorial.class,"SELECT * FROM live.tbl_accessorials");
String pgSql = "SELECT * FROM live.tbl_accessorials";
sql.setTemplate(PostgresAdapter.class.getName(), pgSql);
Collection<Accessorial> accessorials = context.performQuery(sql);

I have tried this both with and without the Postgres specific template - same result either
way. Works fine in a console app, fails running under the web server.

This seems to be the relevant section of the stack trace:

Caused by: java.lang.NoClassDefFoundError: org/apache/velocity/runtime/parser/ParseException
at org.apache.cayenne.access.jdbc.SQLTemplateAction.performAction(
at org.apache.cayenne.access.DataNodeQueryAction.runQuery(
at org.apache.cayenne.access.DataNode.performQueries(
at org.apache.cayenne.access.DataDomainQueryAction.runQuery(
at org.apache.cayenne.access.DataDomainQueryAction.access$000(
at org.apache.cayenne.access.DataDomainQueryAction$2.transform(
at org.apache.cayenne.access.DataDomain.runInTransaction(
at org.apache.cayenne.access.DataDomainQueryAction.runQueryInTransaction(
at org.apache.cayenne.access.DataDomainQueryAction.execute(
at org.apache.cayenne.access.DataDomain.onQueryNoFilters(
at org.apache.cayenne.access.DataDomain$DataDomainQueryFilterChain.onQuery(
at org.apache.cayenne.access.DataDomain.onQuery(
at org.apache.cayenne.util.ObjectContextQueryAction.runQuery(
at org.apache.cayenne.util.ObjectContextQueryAction.executePostCache(
at org.apache.cayenne.util.ObjectContextQueryAction.execute(
at org.apache.cayenne.access.DataContext.onQuery(
at org.apache.cayenne.access.DataContext.performQuery(

Any ideas on what I am missing here?


  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message