Return-Path: X-Original-To: apmail-felix-users-archive@minotaur.apache.org Delivered-To: apmail-felix-users-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id C8FAFC227 for ; Thu, 9 Aug 2012 17:10:40 +0000 (UTC) Received: (qmail 25559 invoked by uid 500); 9 Aug 2012 17:10:40 -0000 Delivered-To: apmail-felix-users-archive@felix.apache.org Received: (qmail 25520 invoked by uid 500); 9 Aug 2012 17:10:40 -0000 Mailing-List: contact users-help@felix.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: users@felix.apache.org Delivered-To: mailing list users@felix.apache.org Received: (qmail 25511 invoked by uid 99); 9 Aug 2012 17:10:40 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 09 Aug 2012 17:10:40 +0000 X-ASF-Spam-Status: No, hits=0.3 required=5.0 tests=FRT_ADOBE2,RCVD_IN_DNSWL_LOW,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of heavy@ungoverned.org designates 209.85.161.177 as permitted sender) Received: from [209.85.161.177] (HELO mail-gg0-f177.google.com) (209.85.161.177) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 09 Aug 2012 17:10:32 +0000 Received: by ggnm2 with SMTP id m2so882631ggn.22 for ; Thu, 09 Aug 2012 10:10:12 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=content-type:mime-version:subject:from:in-reply-to:date :content-transfer-encoding:message-id:references:to:x-mailer :x-gm-message-state; bh=Ybil4qxAcyzqVQyyhCLl7nqEpK7iSEbiyFdo4ZDRZkM=; b=argRjOjEfRnVCdForJf9qH2US7lNPbvNtFqS7tXeyXvcGKvuG5MlirO72qjb8puxLk exCY9Ahxacriuy8H5d6tnXFU3XwlcV/OoQmRxt4SYv6kRE5/oqx1mr+qgEbbe/qS9Vhm z++ADFJjCWXB6nOJCPM3ylGy1SAnDB5POQKSJj1FwkKu/M+iMMTajTWFG+/yDwIQ5otb Wj9AMb5weZIKFRp11v5irapy43LwYRV8453xtwL/wY7wg8jnrpCIiSySzc8x1TugKirC dVTsUSgO5kqLUcXhtNQ3x6oiaEXVndwKaOUdeYbRMdTy3kHlqNQWaSziNw8bCF/cBgr6 ju8Q== Received: by 10.50.188.130 with SMTP id ga2mr1899423igc.32.1344532211284; Thu, 09 Aug 2012 10:10:11 -0700 (PDT) Received: from [192.168.1.70] (adsl-99-62-222-230.dsl.sgnwmi.sbcglobal.net. [99.62.222.230]) by mx.google.com with ESMTPS id 10sm2428080igf.11.2012.08.09.10.10.07 (version=TLSv1/SSLv3 cipher=OTHER); Thu, 09 Aug 2012 10:10:10 -0700 (PDT) Content-Type: text/plain; charset=windows-1252 Mime-Version: 1.0 (Mac OS X Mail 6.0 \(1485\)) Subject: Re: NoClassDefFoundError after update, caused by NPE in BundleRevisionImpl.calculateContentPath ? From: "Richard S. Hall" In-Reply-To: Date: Thu, 9 Aug 2012 13:10:06 -0400 Content-Transfer-Encoding: quoted-printable Message-Id: <0D78C027-05A4-4E84-A90E-63173DBADAA1@ungoverned.org> References: <84BB2898-DCEE-4550-B826-468339BFCD86@ungoverned.org> To: users@felix.apache.org X-Mailer: Apple Mail (2.1485) X-Gm-Message-State: ALoCoQl5EMfIXYUG8TIIPNkkI5yIvso8Ol8zv0LZUXXN7N/xEKAFcUIsifWVMfSo+yYwR5ZlQNpH Dan, I looked at your example and was able to recreate the issue. After = debugging it a little bit, it seems to be a fairly standard issue when = dealing with threads and OSGi: You must make sure that all threads created by a bundle have stopped = executing by the time the bundle's activator stop() method has returned. This can be complicated if you are using libraries that use threads and = don't give you a way to shut them all down. There is no way around this. = The start() method signals a bundle that it is ok to use resources and = the stop() method signals that the bundle must stop using all resources. The NPE results because some thread is still trying to load classes on a = bundle wiring that has been discarded. -> richard p.s. Unrelated, I also noticed that your threads continually ask for the = bliss keystore resource when I'm just sitting idle at the update screen. = Not sure if that is intended or not. On Aug 9, 2012, at 10:48 , Richard S. Hall wrote: > On Aug 9, 2012, at 10:44 , Dan Gravell = wrote: >=20 >> I understand why you want it simplified but I don't think I can - = part of >> the reason I think this is occurring is because it's a pretty complex = beast >> with threads and bundles all over the place. >>=20 >> I will send you some download instructions and instructions to run... = what >> OS are you on? Is a plain folder structure in a ZIP easiest? >=20 > Mac OS X. >=20 > ZIP is fine. >=20 > -> richard >=20 >>=20 >> Dan >>=20 >> On Thu, Aug 9, 2012 at 2:58 PM, Richard S. Hall = wrote: >>=20 >>> Perhaps you can give me some way to download it and recreate = it=85that's >>> probably the quickest way. Of course, try to simplify it if you can=85= >>>=20 >>> -> richard >>>=20 >>> On Aug 9, 2012, at 06:29 , Dan Gravell = >>> wrote: >>>=20 >>>> Sorry: forgot to include my code... I am performing a refresh >>>> (see blockingRefreshBundles()). Before this code runs I am using = OBR to >>>> resolve a set of requirements. I then perform the update via the >>> resolver. >>>> 'startedBundles' are the bundles that were started at the time the = update >>>> runs: >>>>=20 >>>> for (Bundle bundle : startedBundles) { >>>> try { >>>> if(!FelixObrUtils.isFragment(bundle)) >>>> = sysBundle.getBundleContext().getBundle(bundle.getBundleId()).stop(); >>>> } catch (BundleException e) { >>>> LOG.error("Failed to stop " + bundle.getSymbolicName(), e); >>>> } >>>> } >>>> resolver.deploy(0); >>>> blockingRefreshBundles(null, sysBundle.getBundleContext()); >>>> for (Bundle bundle : startedBundles) { >>>> try { >>>> if(!FelixObrUtils.isFragment(bundle)) >>>> = sysBundle.getBundleContext().getBundle(bundle.getBundleId()).start(); >>>> } catch (BundleException e) { >>>> LOG.error("Failed to restart " + bundle.getSymbolicName(), e); >>>> } >>>> } >>>>=20 >>>> protected void blockingRefreshBundles(Collection >>> restartedBundles, >>>> final BundleContext bundleContext) { >>>> final FrameworkWiring frameworkWiring =3D >>>> bundleContext.getBundle(0).adapt(FrameworkWiring.class); >>>> if(null!=3DframeworkWiring) { >>>> final CountDownLatch latch =3D new CountDownLatch(1); >>>> frameworkWiring.refreshBundles(restartedBundles, new = FrameworkListener() >>> { >>>> @Override >>>> public void frameworkEvent(FrameworkEvent arg0) { >>>> if(arg0.getType()=3D=3DFrameworkEvent.PACKAGES_REFRESHED) = latch.countDown(); >>>> } >>>> }); >>>> try { >>>> latch.await(); >>>> } catch (InterruptedException e) { >>>> LOG.error("Interrupted while waiting for packages to refresh. Will >>> continue >>>> anyway"); >>>> } >>>> } else { >>>> LOG.warn("Couldn't adapt system bundle to framework wiring so will = not >>>> refresh bundles"); >>>> } >>>> } >>>>=20 >>>> Just a thought - might there be a problem in re-using the old = references >>> to >>>> 'startedBundles'? Following the update, should I refresh these = instances? >>>>=20 >>>> Dan >>>>=20 >>>> On Thu, Aug 9, 2012 at 11:19 AM, Felix Meschberger = >>> wrote: >>>>=20 >>>>> Hi >>>>>=20 >>>>> I would assume you need to call PackageAdmin.refreshPackages() = after >>>>> updating the bundles, such that all providers and consumers get to = know >>> the >>>>> latest updates. >>>>>=20 >>>>> If you just to Bundle.update the call to = PackageAdmin.refreshPackages >>> must >>>>> also be done explicitly. If you are using installation tools such = as >>> File >>>>> Install this call would be done automatically by the installation = tool >>>>> along with updating the bundles. >>>>>=20 >>>>> Regards >>>>> Felix >>>>>=20 >>>>> Am 09.08.2012 um 11:59 schrieb Dan Gravell: >>>>>=20 >>>>>> Hi all. I'm getting some NoClassDefFoundErrors and other >>>>> exceptions/errors >>>>>> after updating some bundles. The bundles work fine before. = Restarting >>>>> Felix >>>>>> clears the problem (no more NCDFE) and the newly updating bundles = work >>>>> fine >>>>>> once again. >>>>>>=20 >>>>>> I'd like to be able to support updating while running, if = possible. >>>>>>=20 >>>>>> Here's a sample stacktrace: >>>>>>=20 >>>>>> 2012-08-09 10:44:56,095 [ERROR] Error while executing >>>>>> AutomaticFixerCoverArtCommand (AggregatedPolic >>>>>> yCommand.java:65, thread policy pool 0) >>>>>> java.lang.ExceptionInInitializerError >>>>>> at >>>>>>=20 >>>>>=20 >>> = com.elsten.bliss.music.policy.coverartpolicy.CoverArtUtils.dimensionsOf(Co= verArtUtils.java >>>>>> :163) >>>>>> at >>>>>>=20 >>>>>=20 >>> = com.elsten.bliss.music.policy.coverartpolicy.CoverArtUtils.openImageDimens= ion(CoverArtUtil >>>>>> s.java:187) >>>>>> [...] >>>>>> Caused by: java.lang.NullPointerException >>>>>> at >>>>>>=20 >>>>>=20 >>> = org.apache.felix.framework.BundleRevisionImpl.getResourcesLocal(BundleRevi= sionImpl.java:510) >>>>>> at >>>>>>=20 >>>>>=20 >>> = org.apache.felix.framework.BundleWiringImpl.findResourcesByDelegation(Bund= leWiringImpl.java:1127) >>>>>> at >>>>>>=20 >>>>>=20 >>> = org.apache.felix.framework.BundleWiringImpl.getResourcesByDelegation(Bundl= eWiringImpl.java:1037) >>>>>> at >>>>>>=20 >>>>>=20 >>> = org.apache.felix.framework.BundleWiringImpl$BundleClassLoaderJava5.getReso= urces(BundleWiringImpl.java:1778) >>>>>> at >>>>>>=20 >>>>>=20 >>> = org.eclipse.jetty.osgi.boot.internal.webapp.OSGiWebappClassLoader.getResou= rces(OSGiWebappClassLoader.java:115) >>>>>> at >>>>>> = java.util.ServiceLoader$LazyIterator.hasNext(ServiceLoader.java:340) >>>>>> at java.util.ServiceLoader$1.hasNext(ServiceLoader.java:432) >>>>>> at >>>>>>=20 >>>>>=20 >>> = javax.imageio.spi.IIORegistry.registerApplicationClasspathSpis(IIORegistry= .java:206) >>>>>> at javax.imageio.spi.IIORegistry.(IIORegistry.java:138) >>>>>> at >>>>>> = javax.imageio.spi.IIORegistry.getDefaultInstance(IIORegistry.java:159) >>>>>> at javax.imageio.ImageIO.(ImageIO.java:64) >>>>>>=20 >>>>>> 2012-08-09 10:44:57,061 [ERROR] Error while executing >>>>>> AutomaticFixerCoverArtCommand (AggregatedPolicyCommand.java:65, = thread >>>>>> policy pool 1) >>>>>> java.lang.NoClassDefFoundError: Could not initialize class >>>>>> javax.imageio.ImageIO >>>>>> at >>>>>>=20 >>>>>=20 >>> = com.elsten.bliss.music.policy.coverartpolicy.CoverArtUtils.dimensionsOf(Co= verArtUtils.java:163) >>>>>> at >>>>>>=20 >>>>>=20 >>> = com.elsten.bliss.music.policy.coverartpolicy.CoverArtUtils.openImageDimens= ion(CoverArtUtils.java:187) >>>>>> [... no caused by trace here...] >>>>>>=20 >>>>>> Immediately before that I get something I only see once I enable = Felix >>>>>> debug logging: >>>>>>=20 >>>>>> ERROR: Bundle com.elsten.bliss.ui [34] Unable to get module class = path. >>>>>> (java.lang.NullPointerExcepti >>>>>> on) >>>>>> java.lang.NullPointerException >>>>>> at >>>>>>=20 >>>>>=20 >>> = org.apache.felix.framework.BundleRevisionImpl.calculateContentPath(BundleR= evisionImpl.java >>>>>> :410) >>>>>> at >>>>>>=20 >>>>>=20 >>> = org.apache.felix.framework.BundleRevisionImpl.initializeContentPath(Bundle= RevisionImpl.jav >>>>>> a:347) >>>>>> at >>>>>>=20 >>>>>=20 >>> = org.apache.felix.framework.BundleRevisionImpl.getContentPath(BundleRevisio= nImpl.java:333) >>>>>> at >>>>>>=20 >>>>>=20 >>> = org.apache.felix.framework.BundleRevisionImpl.getResourcesLocal(BundleRevi= sionImpl.java:49 >>>>>> 3) >>>>>> at >>>>>>=20 >>>>>=20 >>> = org.apache.felix.framework.BundleWiringImpl.findResourcesByDelegation(Bund= leWiringImpl.jav >>>>>> a:1127) >>>>>> at >>>>>>=20 >>>>>=20 >>> = org.apache.felix.framework.BundleWiringImpl.getResourcesByDelegation(Bundl= eWiringImpl.java >>>>>> :1037) >>>>>> at >>>>>>=20 >>>>>=20 >>> = org.apache.felix.framework.BundleWiringImpl$BundleClassLoaderJava5.getReso= urces(BundleWiri >>>>>> ngImpl.java:1778) >>>>>> at >>>>>>=20 >>>>>=20 >>> = org.eclipse.jetty.osgi.boot.internal.webapp.OSGiWebappClassLoader.getResou= rces(OSGiWebappC >>>>>> lassLoader.java:115) >>>>>> at >>>>>> = java.util.ServiceLoader$LazyIterator.hasNext(ServiceLoader.java:340) >>>>>> at java.util.ServiceLoader$1.hasNext(ServiceLoader.java:432) >>>>>> at >>>>>>=20 >>>>>=20 >>> = javax.imageio.spi.IIORegistry.registerApplicationClasspathSpis(IIORegistry= .java:206) >>>>>> at javax.imageio.spi.IIORegistry.(IIORegistry.java:138) >>>>>> at >>>>>> = javax.imageio.spi.IIORegistry.getDefaultInstance(IIORegistry.java:159) >>>>>> at javax.imageio.ImageIO.(ImageIO.java:64) >>>>>> at >>>>>>=20 >>>>>=20 >>> = com.elsten.bliss.music.policy.coverartpolicy.CoverArtUtils.dimensionsOf(Co= verArtUtils.java >>>>>> :163) >>>>>> at >>>>>>=20 >>>>>=20 >>> = com.elsten.bliss.music.policy.coverartpolicy.CoverArtUtils.openImageDimens= ion(CoverArtUtil >>>>>> s.java:187) >>>>>>=20 >>>>>> There are many of these NCDFEs but only one of those NPEs in >>>>>> BundleRevisionImpl. Once those have been thrown, "all hell seems = to >>> break >>>>>> loose" and I start getting NCDFEs for other classes including my = own. >>>>> Does >>>>>> the original exception cause these downstream ones or are they >>> unrelated? >>>>>>=20 >>>>>> During the update the Import-Package statements for = javax.imageio.* >>>>> remain >>>>>> stable. >>>>>>=20 >>>>>> Let me know if more contextual logs are useful. I can provide the >>> actual >>>>>> code that's running if it helps (it's large though). >>>>>>=20 >>>>>> Dan >>>>>=20 >>>>>=20 >>>>> = --------------------------------------------------------------------- >>>>> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org >>>>> For additional commands, e-mail: users-help@felix.apache.org >>>>>=20 >>>>>=20 >>>=20 >>>=20 >>> = --------------------------------------------------------------------- >>> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org >>> For additional commands, e-mail: users-help@felix.apache.org >>>=20 >>>=20 >=20 --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscribe@felix.apache.org For additional commands, e-mail: users-help@felix.apache.org