Return-Path: Delivered-To: apmail-openjpa-dev-archive@www.apache.org Received: (qmail 18408 invoked from network); 30 Oct 2007 15:45:16 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 30 Oct 2007 15:45:16 -0000 Received: (qmail 14504 invoked by uid 500); 30 Oct 2007 15:44:02 -0000 Delivered-To: apmail-openjpa-dev-archive@openjpa.apache.org Received: (qmail 14486 invoked by uid 500); 30 Oct 2007 15:44:02 -0000 Mailing-List: contact dev-help@openjpa.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@openjpa.apache.org Delivered-To: mailing list dev@openjpa.apache.org Received: (qmail 14475 invoked by uid 99); 30 Oct 2007 15:44:02 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 30 Oct 2007 08:44:02 -0700 X-ASF-Spam-Status: No, hits=-100.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO brutus.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 30 Oct 2007 15:44:24 +0000 Received: from brutus (localhost [127.0.0.1]) by brutus.apache.org (Postfix) with ESMTP id 9D1C67141F1 for ; Tue, 30 Oct 2007 08:43:50 -0700 (PDT) Message-ID: <11744835.1193759030633.JavaMail.jira@brutus> Date: Tue, 30 Oct 2007 08:43:50 -0700 (PDT) From: "Albert Lee (JIRA)" To: dev@openjpa.apache.org Subject: [jira] Updated: (OPENJPA-377) RuntimeUnenhancedClasses support can go into a "half baked" state In-Reply-To: <23474141.1190220852678.JavaMail.jira@brutus> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked by ClamAV on apache.org [ https://issues.apache.org/jira/browse/OPENJPA-377?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Albert Lee updated OPENJPA-377: ------------------------------- Fix Version/s: (was: 1.0.1) 1.0.2 Defer to next release. > RuntimeUnenhancedClasses support can go into a "half baked" state > ----------------------------------------------------------------- > > Key: OPENJPA-377 > URL: https://issues.apache.org/jira/browse/OPENJPA-377 > Project: OpenJPA > Issue Type: Bug > Components: kernel > Affects Versions: 1.0.0 > Reporter: Kevin Sutter > Fix For: 1.0.2, 1.1.0 > > > As we continue to push OpenJPA through it's paces in an application server environment, I've hit a problem with the new dynamic unenhanced classes support that I haven't been able to figure out yet. Maybe by writing this JIRA issue, it will ring a bell with Patrick or one of the other developers. > Here's an example of the callstack that we get. In this case, the container classloader transformer doesn't process the Entity for some reason. (I realize that this the root cause of the problems, but I don't think we fail like we do.) Since the Entity has not been enhanced, we fall into the dynamic unenhanced classes support. We determine that we're persistence capable, but something wasn't quite "baked" yet since we hit this exception: > > org.apache.openjpa.persistence.PersistenceException: !(x instanceof Integer) > [9/14/07 11:31:52:040 EST] 00000031 SystemOut O > > org.apache.openjpa.persistence.PersistenceException: !(x instanceof Integer) > at java.lang.Throwable.(Throwable.java:196) > at java.lang.RuntimeException.(RuntimeException.java:43) > at org.apache.openjpa.util.OpenJPAException.(OpenJPAException.java:77) > at org.apache.openjpa.util.OpenJPAException.(OpenJPAException.java:70) > at org.apache.openjpa.util.GeneralException.(GeneralException.java:43) > at org.apache.openjpa.kernel.BrokerImpl.persist(BrokerImpl.java:2410) > at org.apache.openjpa.kernel.BrokerImpl.persist(BrokerImpl.java:2224) > at org.apache.openjpa.kernel.DelegatingBroker.persist(DelegatingBroker.java:1005) > at org.apache.openjpa.persistence.EntityManagerImpl.persist(EntityManagerImpl.java:541) > : > : > Caused by: java.lang.ClassCastException: !(x instanceof Integer) > at java.lang.Throwable.(Throwable.java:196) > at java.lang.RuntimeException.(RuntimeException.java:43) > at java.lang.ClassCastException.(ClassCastException.java:39) > at org.apache.openjpa.util.ApplicationIds.fromPKValues(ApplicationIds.java:151) > at org.apache.openjpa.enhance.ReflectingPersistenceCapable.pcNewObjectIdInstance(Ref > lectingPersistenceCapable.java:257) > at org.apache.openjpa.util.ApplicationIds.create(ApplicationIds.java:384) > at org.apache.openjpa.kernel.BrokerImpl.persist(BrokerImpl.java:2378) > ... 20 more > (I also run across this same type of problem in a Java SE environment when running within Eclipse. But, at the time, I got around the problem by just running the PCEnhancer tool beforehand. And, since this was not the main problem I was driving, I forgot about it. I'm just stating this to indicate that this not just a Container classloader issue.) > In both cases, it does seem like it's related to creating or using ApplicationIds. But, I haven't dug down deeper yet. > On a related note, I have two other questions related to this scenario: > o When we are running in a Container environment, should the RuntimeUnenhancedClasses support be turned off? Since the Container is supposed to be intercepting these Entities and passing them through the Transformer interface, should the RuntimeUnenhancedClasses support be turned off so that we can more easily detect when this is not working as expected? > o I think the "unsupported" option for the openjpa.RuntimeUnenhancedClasses property is hiding a more meaningful message. For example, if I run with "warn" option, I get the warning message (runtime-optimization-disabled) and a null is returned. In this scenario, the processing continues and then I get this message: > > org.apache.openjpa.persistence.ArgumentException: Attempt to cast instance "..." to > PersistenceCapable failed. Ensure that it has been enhanced. > But, if I run with the "unsupported" option, then the only message I get is the (runtime-optimization-disabled) exception. Although it still indicates an error exists, it's not as clear as the "PersistenceCapable" message. Not sure if we should re-think the "warn" vs "unsupported" argument, or maybe just an update to the message text for (runtime-optimization-disabled). > Anyway, the main problem is the ClassCastException. > Thanks, > Kevin -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.