Return-Path: Delivered-To: apmail-incubator-open-jpa-dev-archive@locus.apache.org Received: (qmail 59689 invoked from network); 26 Mar 2007 20:56:43 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 26 Mar 2007 20:56:43 -0000 Received: (qmail 8931 invoked by uid 500); 26 Mar 2007 20:56:50 -0000 Delivered-To: apmail-incubator-open-jpa-dev-archive@incubator.apache.org Received: (qmail 8908 invoked by uid 500); 26 Mar 2007 20:56:50 -0000 Mailing-List: contact open-jpa-dev-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: open-jpa-dev@incubator.apache.org Delivered-To: mailing list open-jpa-dev@incubator.apache.org Received: (qmail 8899 invoked by uid 99); 26 Mar 2007 20:56:50 -0000 Received: from herse.apache.org (HELO herse.apache.org) (140.211.11.133) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 26 Mar 2007 13:56:50 -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 awhite@bea.com designates 66.248.192.22 as permitted sender) Received: from [66.248.192.22] (HELO usremg02.bea.com) (66.248.192.22) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 26 Mar 2007 13:56:40 -0700 Received: from usremr01.bea.com (usremr01.bea.com [10.160.29.91]) by usremg02.bea.com (Switch-3.2.2/Switch-3.2.2) with ESMTP id l2QKuIhA024529 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=FAIL) for ; Mon, 26 Mar 2007 13:56:18 -0700 Received: from [10.0.1.9] ([10.43.242.9]) by usremr01.bea.com (Switch-3.2.2/Switch-3.2.2) with ESMTP id l2QKuGhK018513 for ; Mon, 26 Mar 2007 13:56:17 -0700 Mime-Version: 1.0 (Apple Message framework v752.3) In-Reply-To: <9655900.post@talk.nabble.com> References: <9565638.post@talk.nabble.com> <9582982.post@talk.nabble.com> <67C2503A-408A-440A-83AE-79DC2CB97BAB@bea.com> <9604668.post@talk.nabble.com> <7DB4FA38-21AC-4DF0-BE04-2FD51D8C5059@bea.com> <9655900.post@talk.nabble.com> Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed Message-Id: <222BE199-7026-4186-9BCF-3D1DCB4B8ED3@bea.com> Content-Transfer-Encoding: 7bit From: Abe White Subject: Re: Shared classloader and subclasses Date: Mon, 26 Mar 2007 15:56:10 -0500 To: open-jpa-dev@incubator.apache.org X-Mailer: Apple Mail (2.752.3) X-PMX-Version: 4.7.1.128075, Antispam-Engine: 2.5.0.283055, Antispam-Data: 2007.2.21.161433 X-Virus-Checked: Checked by ClamAV on apache.org I've committed an equivalent patch to 0.9.7 in SVN revision 522623. Can you confirm whether this fixes your problem and, if so, close any CR you might have opened on this? > This works for me :) Here's a patch for 0.9.6 source. I've gone for > the > simplest solution, but it might be improved by looping over pcNames > instead > of _registered (?). > > http://www.nabble.com/file/7398/openjpa-diff openjpa-diff > > Index: MetaDataRepository.java > =================================================================== > --- MetaDataRepository.java > (.../tags/0.9.6/openjpa-kernel/src/main/java/org/apache/openjpa/meta) > (revision 3) > +++ MetaDataRepository.java > (.../branches/0.9.6-ninthavenue/openjpa-kernel/src/main/java/org/ > apache/openjpa/meta) > (working copy) > @@ -302,7 +302,7 @@ > return null; > > // check cache > - processRegisteredClasses(); > + processRegisteredClasses(envLoader); > List classList = (List) _aliases.get(alias); > > // multiple classes may have been defined with the same > alias: we > @@ -928,7 +928,7 @@ > } > > // check cache > - processRegisteredClasses(); > + processRegisteredClasses(envLoader); > Class cls = (Class) _oids.get(oid.getClass()); > if (cls != null) > return getMetaData(cls, envLoader, mustExist); > @@ -944,7 +944,7 @@ > // if still not match, register any classes that look > similar to > the > // oid class and check again > resolveIdentityClass(oid); > - if (processRegisteredClasses().length > 0) { > + if (processRegisteredClasses(envLoader).length > 0) { > cls = (Class) _oids.get(oid.getClass()); > if (cls != null) > return getMetaData(cls, envLoader, mustExist); > @@ -1262,7 +1262,7 @@ > * Parses the metadata for all registered classes. > */ > private void loadRegisteredClassMetaData(ClassLoader envLoader) { > - Class[] reg = processRegisteredClasses(); > + Class[] reg = processRegisteredClasses(envLoader); > for (int i = 0; i < reg.length; i++) { > try { > getMetaData(reg[i], envLoader, false); > @@ -1276,7 +1276,7 @@ > /** > * Updates our datastructures with the latest registered classes. > */ > - Class[] processRegisteredClasses() { > + Class[] processRegisteredClasses(ClassLoader envLoader) { > if (_registered.isEmpty()) > return EMPTY_CLASSES; > > @@ -1289,9 +1289,18 @@ > } > > Collection failed = null; > + Collection pcNames = getPersistentTypeNames(false, > envLoader); > for (int i = 0; i < reg.length; i++) { > try { > - processRegisteredClass(reg[i]); > + > + /* > + * Only process classes known to this > MetaDataRepository, > + * since _registered contains all classes loaded by > + * PCRegistry. > + */ > + if (pcNames.contains(reg[i].getName())) { > + processRegisteredClass(reg[i]); > + } > } catch (Throwable t) { > if (!_conf.getRetryClassRegistration()) > throw new > MetaDataException(_loc.get("error-registered", > Index: ClassMetaData.java > =================================================================== > --- ClassMetaData.java > (.../tags/0.9.6/openjpa-kernel/src/main/java/org/apache/openjpa/meta) > (revision 4) > +++ ClassMetaData.java > (.../branches/0.9.6-ninthavenue/openjpa-kernel/src/main/java/org/ > apache/openjpa/meta) > (working copy) > @@ -309,7 +309,7 @@ > if (_owner != null) > return _repos.EMPTY_CLASSES; > > - _repos.processRegisteredClasses(); > + _repos.processRegisteredClasses(getEnvClassLoader()); > if (_subs == null) { > Collection subs = _repos.getPCSubclasses(_type); > _subs = (Class[]) subs.toArray(new Class[subs.size()]); > > -- > View this message in context: http://www.nabble.com/Shared- > classloader-and-subclasses-tf3431312.html#a9655900 > Sent from the open-jpa-dev mailing list archive at Nabble.com. > _______________________________________________________________________ Notice: This email message, together with any attachments, may contain information of BEA Systems, Inc., its subsidiaries and affiliated entities, that may be confidential, proprietary, copyrighted and/or legally privileged, and is intended solely for the use of the individual or entity named in this message. If you are not the intended recipient, and have received this message in error, please immediately return this by email and then delete it.