Hi Rick, First thing to check is that you have velocity-1.6.3.jar in your .war under WEB-INF/lib/
If you do, then we need to look for a conflicting velocity.jar under Glassfish and discuss what we can do about it. Andrus On Apr 16, 2013, at 8:38 AM, Rick Bonnett <[email protected]> wrote: > 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(SQLTemplateAction.java:102) > at > org.apache.cayenne.access.DataNodeQueryAction.runQuery(DataNodeQueryAction.java:87) > at org.apache.cayenne.access.DataNode.performQueries(DataNode.java:280) > at > org.apache.cayenne.access.DataDomainQueryAction.runQuery(DataDomainQueryAction.java:442) > at > org.apache.cayenne.access.DataDomainQueryAction.access$000(DataDomainQueryAction.java:70) > at > org.apache.cayenne.access.DataDomainQueryAction$2.transform(DataDomainQueryAction.java:415) > at org.apache.cayenne.access.DataDomain.runInTransaction(DataDomain.java:877) > at > org.apache.cayenne.access.DataDomainQueryAction.runQueryInTransaction(DataDomainQueryAction.java:412) > at > org.apache.cayenne.access.DataDomainQueryAction.execute(DataDomainQueryAction.java:122) > at org.apache.cayenne.access.DataDomain.onQueryNoFilters(DataDomain.java:758) > at > org.apache.cayenne.access.DataDomain$DataDomainQueryFilterChain.onQuery(DataDomain.java:1009) > at org.apache.cayenne.access.DataDomain.onQuery(DataDomain.java:748) > at > org.apache.cayenne.util.ObjectContextQueryAction.runQuery(ObjectContextQueryAction.java:350) > at > org.apache.cayenne.util.ObjectContextQueryAction.executePostCache(ObjectContextQueryAction.java:106) > at > org.apache.cayenne.util.ObjectContextQueryAction.execute(ObjectContextQueryAction.java:93) > at org.apache.cayenne.access.DataContext.onQuery(DataContext.java:989) > at org.apache.cayenne.access.DataContext.performQuery(DataContext.java:978) > at > com.mesca.services.AccessorialService.allAccessorialRows(AccessorialService.java:83) > > Any ideas on what I am missing here? > > Thanks > Rick >
