Return-Path: X-Original-To: apmail-openjpa-dev-archive@www.apache.org Delivered-To: apmail-openjpa-dev-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 70A4910BFE for ; Wed, 25 Sep 2013 16:41:25 +0000 (UTC) Received: (qmail 81765 invoked by uid 500); 25 Sep 2013 16:41:25 -0000 Delivered-To: apmail-openjpa-dev-archive@openjpa.apache.org Received: (qmail 81678 invoked by uid 500); 25 Sep 2013 16:41:24 -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 81388 invoked by uid 99); 25 Sep 2013 16:41:23 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 25 Sep 2013 16:41:23 +0000 X-ASF-Spam-Status: No, hits=1.5 required=5.0 tests=HTML_MESSAGE,RCVD_IN_DNSWL_LOW,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of kwsutter@gmail.com designates 209.85.215.41 as permitted sender) Received: from [209.85.215.41] (HELO mail-la0-f41.google.com) (209.85.215.41) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 25 Sep 2013 16:41:18 +0000 Received: by mail-la0-f41.google.com with SMTP id ec20so5275688lab.0 for ; Wed, 25 Sep 2013 09:40:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-type; bh=DnqOPV2WpVpr7R3wTUYaN3P2p58uaK/t89TUTwfnrNk=; b=hFjl9lPviz1D4nuYzRU35ik6JjUZApDkXKy21XASkC4qTi2ivRgqa1AJ9m5BiZsfBI 5Gm/y5GDduNc+0pyTD7qi+a01iOZ1y/WPbPjZI+7LuLv3RHxs9QLVyNNCDGCbyKeVTw9 nHs4uzSvbyXprGsZQdV1Luk3MMwcQD5zuwAp2zCeTqVA4uXXyeZGc4mG2QDpDVVXzdsU 89MyFIM0VqsPjfF5nRW4ecSKqPPCV9saKfQGzqCqZ8BlgLhM88SATccL8lVVWJjKOdkQ tLlJUDhFVcB6TxdiwTgX/dDr/asv02BelFUASAFgC3DKWfMWeDt0te3O2rI9dhOBFMc7 riDg== X-Received: by 10.112.11.20 with SMTP id m20mr113115lbb.56.1380127256074; Wed, 25 Sep 2013 09:40:56 -0700 (PDT) MIME-Version: 1.0 Received: by 10.112.97.227 with HTTP; Wed, 25 Sep 2013 09:40:36 -0700 (PDT) In-Reply-To: References: From: Kevin Sutter Date: Wed, 25 Sep 2013 11:40:36 -0500 Message-ID: Subject: Re: Entitiy not enhanced To: users@openjpa.apache.org Cc: dev@openjpa.apache.org Content-Type: multipart/alternative; boundary=001a1133eb74d7df9604e737ea96 X-Virus-Checked: Checked by ClamAV on apache.org --001a1133eb74d7df9604e737ea96 Content-Type: text/plain; charset=ISO-8859-1 Hi, I've replied privately to Divya on this topic, but I wanted to let everyone else know that is following this thread... The -javaagent and the use of the jdk tools to automatically hook in a javaagent does have some potential limitations (as documented in the OpenJPA manual). These approaches for enhancing the entities should be thought of for development and test environments. OpenJPA does the best it can to hook into the classloading mechanism via these approaches, but the Java hooks are not fool-proof. We can still miss some entity classes depending on what gets loaded and when by the Java runtime. To ensure that your entity classes are properly enhanced in "all cases" is to either use build-time enhancement, or to use the application server container classloader hook as defined by the Java EE specs. I said "all cases" in quotes because it seems that Divya has uncovered a condition with the OSGi container in the WebSphere environment where an entity class may be getting loaded without going through the enhancement process. This is considered a bug and will be pursued as such -- that is, it is not a limitation of the enhancement processing. Another useful link for enhancement processing is on our wiki: http://openjpa.apache.org/entity-enhancement.html Hope this helps, Kevin On Wed, Sep 25, 2013 at 10:38 AM, Leonardo K. Shikida wrote: > Hi > > I could not make the runtime enhancement work for me too, so I am manually > enhancing during build time with a simple script. > > public static void main(String[] args) { > > Collection files = FileUtils.listFiles(new > File(baseClassDir), null, true); > for(File file:files){ > String[] a = new String[3]; > a[0] = "-d"; > a[1] = baseClassDir; > a[2] = file.getAbsolutePath(); > org.apache.openjpa.enhance.PCEnhancer.main(a); > } > } > > I've also noticed some strange behaviour using java 7, specifically, both > IBM and Oracle JVM 7 didn't enhance the source code, but only Oracle > crashed my tomEE+ server when that happened ;-) > > Just in case... > > good luck > > Leo > > > [] > > Leo > > > On Wed, Sep 25, 2013 at 12:15 PM, Divya K Konoor >wrote: > > > > > > > Hi, > > > > I tried by manually adding the java agent in my jvm options -javaagent:/ > > apache-openjpa-2.2.2/lib/openjpa-all-2.2.2.jar following examples 5.2 and > > 5.3 under section 2.3 at > > > > > http://openjpa.apache.org/builds/2.1.1/apache-openjpa/docs/ref_guide_pc_enhance.html#ref_guide_pc_enhance_build > > . > > > > But even that hasn't helped .I still get the entity not enhanced > problem. > > > > Regards > > Divya > > > > > > > > From: Divya K Konoor/India/IBM > > To: users-help@openjpa.apache.org, dev-help@openjpa.apache.org, > > Date: 09/25/2013 07:19 PM > > Subject: Entitiy not enhanced > > > > > > Hi, > > > > I use a container (Webshphere liberty that internally uses openjpa). I > have > > multiple OSGi persistence bundles .Each has its own persistence unit ; > all > > of these talk to the same database.The JPA entities bundled within each > > persistence bundle is defined under the tag of the > > persistence.xml. Some of these entities have relationship or dependency > on > > the entities bundled with another persistence bundle in which case the > > dependent entities are added in the tag of the former's > > persistence.xml > > > > I see the following error message when I start my liberty server: > > > > This configuration disallows runtime optimization, but the following > listed > > types were not enhanced at build time or at class load time with a > > javaagent: " > > > > [err] > > org.apache.openjpa.persistence.ArgumentException: The type "class > > com.xxx.ProbeConfiguration" has not been enhanced. > > [err] at org.apache.openjpa.meta.ClassMetaData.resolveMeta > > (ClassMetaData.java:1827) > > [err] at org.apache.openjpa.meta.ClassMetaData.resolve > > (ClassMetaData.java:1801) > > [err] at org.apache.openjpa.meta.MetaDataRepository.processBuffer > > (MetaDataRepository.java:826) > > [err] at org.apache.openjpa.meta.MetaDataRepository.resolveMeta > > (MetaDataRepository.java:723) > > [err] at org.apache.openjpa.meta.MetaDataRepository.resolve > > (MetaDataRepository.java:647) > > [err] at > > org.apache.openjpa.meta.MetaDataRepository.getMetaDataInternal > > (MetaDataRepository.java:415) > > [err] at org.apache.openjpa.meta.MetaDataRepository.getMetaData > > (MetaDataRepository.java:388) > > [err] at org.apache.openjpa.meta.MetaDataRepository.resolveAll > > (MetaDataRepository.java:1990) > > [err] at > > org.apache.openjpa.meta.MetaDataRepository.getQueryMetaDataInternal > > (MetaDataRepository.java:1968) > > [err] at org.apache.openjpa.meta.MetaDataRepository.getQueryMetaData > > (MetaDataRepository.java:1955) > > [err] at > > org.apache.openjpa.persistence.EntityManagerImpl.createNamedQuery > > (EntityManagerImpl.java:102 > > > > There is a brief mention of this here (but it doesn't explain why): > > > > > > > http://pic.dhe.ibm.com/infocenter/wasinfo/v6r1/index.jsp?topic=%2Fcom.ibm.websphere.ejbfep.multiplatform.doc%2Finfo%2Fae%2Fae%2Ftejb_jpatroubleshoot.html > > > > I was under the impression that openjpa does runtime enhancement on all > JPA > > entities that have not been enhanced. The above log statement seems to > > indicate that one or more JPA entities have not been enhanced during > > runtime.I saw a brief mention about this at > > > > > http://openjpa.apache.org/builds/2.1.1/apache-openjpa/docs/ref_guide_pc_enhance.html#ref_guide_pc_enhance_dynamic > > > > "If a javaagent is not provided via the command line and OpenJPA is > running > > on the Sun 1.6 SDK or IBM 1.6 JDK (SR8+), OpenJPA will attempt to > > dynamically load the Enhancer that was mentioned in the previous section. > > This support is provided as an ease of use feature and it is not > > recommended for use in a production system. Using this method of > > enhancement has the following caveats: > > The dynamic runtime enhancer is plugged into the JVM during creation of > the > > EntityManagerFactory. Any Entity classes that are loaded before the > > EntityManagerFactory is created will not be enhanced. " > > > > > > I also noticed the following in the logs: > > > > openjpa.DynamicEnhancementAgent: false . > > > > I was expecting it to me openjpa.DynamicEnhancementAgent: true . > > > > I manually added the following jvm option > > -Dopenjpa.DynamicEnhancementAgent=true after which the logs show > > openjpa.DynamicEnhancementAgent: true but I hit the same entitiy not > > enhanced issue. > > > > Apart from build time enhancement , is there anything that can be done to > > ensure that all JPA entities are enhanced during runtime. > > > > Thanks > > Divya > > > > > --001a1133eb74d7df9604e737ea96--