Return-Path: X-Original-To: apmail-cayenne-user-archive@www.apache.org Delivered-To: apmail-cayenne-user-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 9CF0EF70F for ; Tue, 16 Apr 2013 14:00:36 +0000 (UTC) Received: (qmail 39159 invoked by uid 500); 16 Apr 2013 14:00:36 -0000 Delivered-To: apmail-cayenne-user-archive@cayenne.apache.org Received: (qmail 39135 invoked by uid 500); 16 Apr 2013 14:00:36 -0000 Mailing-List: contact user-help@cayenne.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: user@cayenne.apache.org Delivered-To: mailing list user@cayenne.apache.org Received: (qmail 39127 invoked by uid 99); 16 Apr 2013 14:00:36 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 16 Apr 2013 14:00:36 +0000 X-ASF-Spam-Status: No, hits=-0.7 required=5.0 tests=RCVD_IN_DNSWL_LOW,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of mkienenb@gmail.com designates 74.125.82.181 as permitted sender) Received: from [74.125.82.181] (HELO mail-we0-f181.google.com) (74.125.82.181) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 16 Apr 2013 14:00:30 +0000 Received: by mail-we0-f181.google.com with SMTP id r6so386777wey.26 for ; Tue, 16 Apr 2013 07:00:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=x-received:mime-version:in-reply-to:references:from:date:message-id :subject:to:content-type; bh=4CbjUy6G7bVxctCOeK7z77XMRpIqRJboHQxtK5Uka3s=; b=CJ6EwjM40zcAGEXoJEFapI90rudGCfwEYHGiXxk/ENSreQE8msB/xULKU0Z0A3K4mp m7dknmk1fGs7uE4GJlQ0WhPYdlMLkZHA4Aoz/v4brrUqBvuPb4oVYLXy0GopULCPOtOT KDwbHk+ipTmxaByb49nSIg1/L9QXkCU5zkvV0nsLvbBUhM1SGrRR4s6q5176c6a09bhE PPqXesDfQFHVhT+EFTYisOf7YNi/8iihxfN5mA02rpLqWayCCI5sUxHfDwRGEjFr1xMB 5M7dK0BiPojPm+Q5JCAcjuqP9vARegnOcQJCywTdA44Q5jzFByx8evG+IaQMg4IvGmUk Hheg== X-Received: by 10.194.176.195 with SMTP id ck3mr4272530wjc.5.1366120801273; Tue, 16 Apr 2013 07:00:01 -0700 (PDT) MIME-Version: 1.0 Received: by 10.227.160.8 with HTTP; Tue, 16 Apr 2013 06:59:41 -0700 (PDT) In-Reply-To: <6AD8A41A-9174-4EBF-8B58-743011A5679C@mesca.com> References: <6AD8A41A-9174-4EBF-8B58-743011A5679C@mesca.com> From: Mike Kienenberger Date: Tue, 16 Apr 2013 09:59:41 -0400 Message-ID: Subject: Re: SQLTemplate problems in 3.1B2 To: user@cayenne.apache.org Content-Type: text/plain; charset=ISO-8859-1 X-Virus-Checked: Checked by ClamAV on apache.org My first guess would be that you have more than one velocity jar files in the classpath. I guess a second possibility is that you have no velocity jar files in the classpath. We have an in-house findClass.jsp (backed by a ClassPath bean) which we use for problems like this to identify all definitions of a class in the classpath. Unfortunately, I don't have permission to share this. But you could probably come up with something similar: Here's a jsp that looks like it identifies the first definition of a class. http://mcpaint.tistory.com/13 Here's how to show all resources http://www.mkyong.com/java/how-to-print-out-the-current-project-classpath/ You'd probably want to combine the two. Here's something else I came across while trying to find an example of what you needed. Not sure how easy it would be to integrate with your app. http://classpathhelper.sourceforge.net/ On Tue, Apr 16, 2013 at 8:38 AM, Rick Bonnett 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 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 >