Return-Path: Delivered-To: apmail-cayenne-user-archive@www.apache.org Received: (qmail 11857 invoked from network); 20 Jul 2007 20:25:30 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 20 Jul 2007 20:25:30 -0000 Received: (qmail 41976 invoked by uid 500); 20 Jul 2007 20:25:31 -0000 Delivered-To: apmail-cayenne-user-archive@cayenne.apache.org Received: (qmail 41970 invoked by uid 500); 20 Jul 2007 20:25:31 -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 41961 invoked by uid 99); 20 Jul 2007 20:25:31 -0000 Received: from herse.apache.org (HELO herse.apache.org) (140.211.11.133) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 20 Jul 2007 13:25:31 -0700 X-ASF-Spam-Status: No, hits=-0.0 required=10.0 tests=SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (herse.apache.org: domain of ajay.daptardar@gmail.com designates 64.233.162.228 as permitted sender) Received: from [64.233.162.228] (HELO nz-out-0506.google.com) (64.233.162.228) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 20 Jul 2007 13:25:28 -0700 Received: by nz-out-0506.google.com with SMTP id f1so2606788nzc for ; Fri, 20 Jul 2007 13:25:07 -0700 (PDT) DKIM-Signature: a=rsa-sha1; c=relaxed/relaxed; d=gmail.com; s=beta; h=domainkey-signature:received:received:message-id:date:from:to:subject:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=C9xqgSPCsdFv5E5Mfsh9tfbJp1TGjF2mlCex0RGcg6FPpfV4EA0HY8HjBLFuAUfMijpymGTnmD3h/SU+6tIoQClQhfF4P1SYzGDXUumISkiyavvsaMtihzMEFAzDG9exZZv18RI4MIIyb5tVgi6YVglKEEWtDqVCln2OAs7NkX0= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=beta; h=received:message-id:date:from:to:subject:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=ha9Ti9K5bUGj9Z1rDV/dW4+AuHvAsMYkxAVCE6ZkIrHokxWflzzxxxCZDMMfpxKYYxm4Nio4ar4Pzbgu+ebir/GoxsHmt8uYQ3ZoRP4EYC4oPQQGjRhxczTGd+GNOMaX9bZU0pRcGwxaGB2osKSBjRMwaxd7FU2YY7Dl4s88IAw= Received: by 10.143.2.19 with SMTP id e19mr61644wfi.1184963104108; Fri, 20 Jul 2007 13:25:04 -0700 (PDT) Received: by 10.143.4.2 with HTTP; Fri, 20 Jul 2007 13:25:04 -0700 (PDT) Message-ID: Date: Fri, 20 Jul 2007 16:25:04 -0400 From: "Ajay H. Daptardar" To: user@cayenne.apache.org Subject: Re: Usage in Axis2 In-Reply-To: <45C04941-C000-4647-A86F-7173D73D0EB4@objectstyle.org> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <4711027D-3E30-46C0-94A0-DF3CB664A9CD@objectstyle.org> <45C04941-C000-4647-A86F-7173D73D0EB4@objectstyle.org> X-Virus-Checked: Checked by ClamAV on apache.org Hi Andrus, I tried the 3.0M1 build and am still getting the class not found error although manifest as a CayenneRuntimeException caused by ClassNotFoundException. Here is a trace: Caused by: org.apache.cayenne.CayenneRuntimeException: [v.3.0M1 Jul 16 2007 22:17:38] Failed to load class com.app.AnnotationType: com.app.AnnotationType at org.apache.cayenne.map.ObjEntity.getJavaClass(ObjEntity.java:238) at org.apache.cayenne.reflect.PersistentDescriptorFactory.getDescriptor(PersistentDescriptorFactory.java:50) at org.apache.cayenne.reflect.ClassDescriptorMap.createDescriptor(ClassDescriptorMap.java:122) at org.apache.cayenne.reflect.LazyClassDescriptorDecorator.checkDescriptorInitialized(LazyClassDescriptorDecorator.java:49) at org.apache.cayenne.reflect.LazyClassDescriptorDecorator.createObject(LazyClassDescriptorDecorator.java:63) at org.apache.cayenne.access.DataContext.newObject(DataContext.java:752) ... 26 more Caused by: java.lang.ClassNotFoundException: com.app.AnnotationType at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1359) at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1205) at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319) at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Class.java:242) at org.apache.cayenne.util.Util.getJavaClass(Util.java:566) at org.apache.cayenne.map.ObjEntity.getJavaClass(ObjEntity.java:235) ... 31 more The problem is not that Cayenne cannot be found, it occurs when Cayenne tries to load the mapped classes using the web app class loader. What I don't get is that why the web app class loader cannot load the classes. I am guessing that Axis2 creates a class loader for each web service, loads the application classes and the jars in the lib folder (thats why it finds Cayenne jars). But when Cayenne retrieves a class loader (WebappClassLoader), this class loader is probably the one for the Axis2 web service, not the one that Axis2 is using to load web services. Probably there is a way to get the class loader for the particular web service within the Axis2 (webapp) servlet. Best, - Ajay On 7/20/07, Andrus Adamchik wrote: > This felt like a nested ClassLoader issue from the beginning... I am > not familiar with the Axis2 archive details, but is it possible to > put Cayenne jar at the same level as the application classes? > > Alternatively you can try upgrading to 3.0M1 (you can grab an > *unofficial* build from here: http://people.apache.org/~aadamchik/ > release/3.0M1/). 3.0 uses String class names as keys and should > hopefully be free from this problem. Please let me know if that > worked - we will definitely need to fix it if it is still broken in 3.0. > > > // DataMaps can contain all kinds of garbage... > > // TODO (Andrus, 10/18/2005) it would be nice > > to log something > > // here, but since EntityResolver is used on > > the client, log4J is > > // a no-go... > > Good catch. This is also obsolete in 3.0 - we can use commons > logging. Let me clean it up. > > Andrus > > > > > // TODO (Andrus, 10/18/2005) it would be nice > > to log something > > // here, but since EntityResolver is used on > > the client, log4J is > > // a no-go... > > > > > On Jul 20, 2007, at 9:15 PM, Ajay H. Daptardar wrote: > > > Hi Andrus, > > > > The structure of the Axis2 archive (app.aar) is as follows: > > > > META-INF/ > > META-INF/MANIFEST.MF > > META-INF/services.xml > > lib/ > > lib/bcel.jar > > lib/cayenne.jar > > lib/jibx-bind.jar > > lib/jibx-extras.jar > > lib/jibx-genbinding.jar > > lib/jibx-genschema.jar > > lib/jibx-run.jar > > lib/mysql-connector-java-5.0.6-bin.jar > > lib/qdox-1.6.1.jar > > lib/stax-api.jar > > lib/wstx-asl.jar > > lib/xmlpull_1_1_4.jar > > lib/xpp3.jar > > app/ > > > > Cayenne jar is in the application's lib folder not axis'. After > > stepping through the debugger, I found out that even though the > > application can load the Cayenne data context, the entity resolver, > > when it PUTS object entities in the cache, it uses the name of the > > entity and when it tries to GET the object entity, it tries to use the > > oe.getJavaClass() which throws an exception. This is not logged and > > the comment there is: > > > > // DataMaps can contain all kinds of garbage... > > // TODO (Andrus, 10/18/2005) it would be nice > > to log something > > // here, but since EntityResolver is used on > > the client, log4J is > > // a no-go... > > > > the Util.getJavaClass() fails to load the (application) class it > > seems. > > > > Thanks, > > Best, > > - Ajay > > > > > > > > > > > > On 7/19/07, Andrus Adamchik wrote: > >> That is strange... I assume Cayenne jars are in "axis2/WEB-INF/lib", > >> and not in some shared location? > >> > >> Andrus > >> > >> On Jul 18, 2007, at 11:53 PM, Ajay H. Daptardar wrote: > >> > Hello all, > >> > > >> > I am trying to use Cayenne within Axis2. I copied the three > >> > configuration XML files into the classes folder for Axis2: > >> > > >> > /opt/apache-tomcat-6.0.13/webapps/axis2/WEB-INF/classes > >> > > >> > I can create the data context object but during runtime, data > >> > context's entity resolver cannot find the mapped class and I get > >> the > >> > following: > >> > > >> > "Class is not mapped with Cayenne" > >> > > >> > However when I run the same application as standalone, I have no > >> > errors. > >> > > >> > Any help much appreciated. > >> > > >> > Best, > >> > - Ajay > >> > > >> > >> > > > > > > -- > > The mind is everything; what you think, you become. -- Buddha > > > > -- The mind is everything; what you think, you become. -- Buddha