Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 3DD28200BE7 for ; Tue, 20 Dec 2016 13:56:00 +0100 (CET) Received: by cust-asf.ponee.io (Postfix) id 3C79D160B33; Tue, 20 Dec 2016 12:56:00 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 63A2A160B29 for ; Tue, 20 Dec 2016 13:55:59 +0100 (CET) Received: (qmail 43014 invoked by uid 500); 20 Dec 2016 12:55:58 -0000 Mailing-List: contact dev-help@brooklyn.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@brooklyn.apache.org Delivered-To: mailing list dev@brooklyn.apache.org Received: (qmail 42834 invoked by uid 99); 20 Dec 2016 12:55:58 -0000 Received: from arcas.apache.org (HELO arcas) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 20 Dec 2016 12:55:58 +0000 Received: from arcas.apache.org (localhost [127.0.0.1]) by arcas (Postfix) with ESMTP id 62BB72C1F54 for ; Tue, 20 Dec 2016 12:55:58 +0000 (UTC) Date: Tue, 20 Dec 2016 12:55:58 +0000 (UTC) From: "ASF GitHub Bot (JIRA)" To: dev@brooklyn.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Commented] (BROOKLYN-410) Rebind fails in karaf, with app creating location from class in bundle MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 archived-at: Tue, 20 Dec 2016 12:56:00 -0000 [ https://issues.apache.org/jira/browse/BROOKLYN-410?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15764150#comment-15764150 ] ASF GitHub Bot commented on BROOKLYN-410: ----------------------------------------- Github user neykov commented on a diff in the pull request: https://github.com/apache/brooklyn-server/pull/490#discussion_r93231467 --- Diff: core/src/main/java/org/apache/brooklyn/core/mgmt/rebind/RebindIteration.java --- @@ -988,7 +988,7 @@ protected void setCatalogItemId(BrooklynObject item, String catalogItemId) { } catch (Exception e) { Exceptions.propagateIfFatal(e); } - return new ClassLoaderUtils(reflections.getClassLoader()).loadClass(jType); + return new ClassLoaderUtils(reflections.getClassLoader(), managementContext).loadClass(jType); --- End diff -- Got it. > Rebind fails in karaf, with app creating location from class in bundle > ---------------------------------------------------------------------- > > Key: BROOKLYN-410 > URL: https://issues.apache.org/jira/browse/BROOKLYN-410 > Project: Brooklyn > Issue Type: Bug > Reporter: Aled Sage > > With brooklyn 0.10.0-SNAPSHOT... > A customer has an advanced/unusual Java-based app that programmatically adds a location to an entity. They are switching to using karaf. > The app deploys successfully. However, on rebind it fails because it fails to instantiate the location (fails to load the class for the location). > I reproduced this with a simpler test case - output shown below: > {noformat} > 2016-12-14 13:49:16,912 WARN Rebind: continuing after problem creating LOCATION pjt0hzet8u of type com.acme.autobrick:com.acme.location.MyLocation > org.apache.brooklyn.util.exceptions.PropagatedRuntimeException: > at org.apache.brooklyn.util.exceptions.Exceptions.propagate(Exceptions.java:129) ~[classes/:na] > Caused by: java.lang.ClassNotFoundException: Class com.acme.autobrick:com.acme.location.MyLocation not found on the application class path, nor in the bundle white list. > at org.apache.brooklyn.util.core.ClassLoaderUtils.loadClass(ClassLoaderUtils.java:155) ~[classes/:na] > ... > org.apache.brooklyn.util.exceptions.PropagatedRuntimeException: Failure rebinding: problem creating LOCATION pjt0hzet8u of type com.acme.autobrick:com.acme.location.MyLocation: ClassNotFoundException: Class com.acme.autobrick:com.acme.location.MyLocation not found on the application class path, nor in the bundle white list. > at org.apache.brooklyn.util.exceptions.Exceptions.propagate(Exceptions.java:129) > at org.apache.brooklyn.core.mgmt.rebind.RebindManagerImpl.rebind(RebindManagerImpl.java:513) > at org.apache.brooklyn.core.mgmt.rebind.RebindTestUtils.rebindAll(RebindTestUtils.java:457) > at org.apache.brooklyn.core.mgmt.rebind.RebindTestUtils.rebind(RebindTestUtils.java:334) > at org.apache.brooklyn.core.mgmt.rebind.RebindTestFixture.rebind(RebindTestFixture.java:303) > at org.apache.brooklyn.camp.brooklyn.AbstractYamlRebindTest.rebind(AbstractYamlRebindTest.java:87) > at org.apache.brooklyn.core.mgmt.rebind.RebindTestFixture.rebind(RebindTestFixture.java:238) > at org.apache.brooklyn.camp.brooklyn.catalog.CatalogOsgiVersionMoreEntityRebindTest.testFoo(CatalogOsgiVersionMoreEntityRebindTest.java:143) > at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) > at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) > at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) > at java.lang.reflect.Method.invoke(Method.java:606) > at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:86) > at org.testng.internal.Invoker.invokeMethod(Invoker.java:643) > at org.testng.internal.Invoker.invokeTestMethod(Invoker.java:820) > at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:1128) > at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:129) > at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:112) > at org.testng.TestRunner.privateRun(TestRunner.java:782) > at org.testng.TestRunner.run(TestRunner.java:632) > at org.testng.SuiteRunner.runTest(SuiteRunner.java:366) > at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:361) > at org.testng.SuiteRunner.privateRun(SuiteRunner.java:319) > at org.testng.SuiteRunner.run(SuiteRunner.java:268) > at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52) > at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:86) > at org.testng.TestNG.runSuitesSequentially(TestNG.java:1244) > at org.testng.TestNG.runSuitesLocally(TestNG.java:1169) > at org.testng.TestNG.run(TestNG.java:1064) > at org.testng.remote.AbstractRemoteTestNG.run(AbstractRemoteTestNG.java:132) > at org.testng.remote.RemoteTestNG.initAndRun(RemoteTestNG.java:236) > at org.testng.remote.RemoteTestNG.main(RemoteTestNG.java:81) > Caused by: java.util.concurrent.ExecutionException: org.apache.brooklyn.util.exceptions.PropagatedRuntimeException: Failure rebinding: problem creating LOCATION pjt0hzet8u of type com.acme.autobrick:com.acme.location.MyLocation: ClassNotFoundException: Class com.acme.autobrick:com.acme.location.MyLocation not found on the application class path, nor in the bundle white list. > at java.util.concurrent.FutureTask.report(FutureTask.java:122) > at java.util.concurrent.FutureTask.get(FutureTask.java:188) > at com.google.common.util.concurrent.ForwardingFuture.get(ForwardingFuture.java:63) > at org.apache.brooklyn.util.core.task.BasicTask.get(BasicTask.java:361) > at org.apache.brooklyn.core.mgmt.rebind.RebindManagerImpl.rebind(RebindManagerImpl.java:511) > ... 30 more > Caused by: org.apache.brooklyn.util.exceptions.PropagatedRuntimeException: Failure rebinding: problem creating LOCATION pjt0hzet8u of type com.acme.autobrick:com.acme.location.MyLocation: ClassNotFoundException: Class com.acme.autobrick:com.acme.location.MyLocation not found on the application class path, nor in the bundle white list. > at org.apache.brooklyn.util.exceptions.Exceptions.create(Exceptions.java:432) > at org.apache.brooklyn.core.mgmt.rebind.RebindExceptionHandlerImpl.onDoneImpl(RebindExceptionHandlerImpl.java:497) > at org.apache.brooklyn.core.mgmt.rebind.RebindExceptionHandlerImpl.onDone(RebindExceptionHandlerImpl.java:413) > at org.apache.brooklyn.core.mgmt.rebind.RebindIteration.run(RebindIteration.java:268) > at org.apache.brooklyn.core.mgmt.rebind.RebindManagerImpl.rebindImpl(RebindManagerImpl.java:558) > at org.apache.brooklyn.core.mgmt.rebind.RebindManagerImpl$3.call(RebindManagerImpl.java:508) > at org.apache.brooklyn.core.mgmt.rebind.RebindManagerImpl$3.call(RebindManagerImpl.java:506) > at org.apache.brooklyn.util.core.task.BasicExecutionManager$SubmissionCallable.call(BasicExecutionManager.java:522) > at java.util.concurrent.FutureTask.run(FutureTask.java:262) > at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) > at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) > at java.lang.Thread.run(Thread.java:745) > Caused by: java.lang.IllegalStateException: problem creating LOCATION pjt0hzet8u of type com.acme.autobrick:com.acme.location.MyLocation > at org.apache.brooklyn.core.mgmt.rebind.RebindExceptionHandlerImpl.onCreateFailed(RebindExceptionHandlerImpl.java:265) > at org.apache.brooklyn.core.mgmt.rebind.RebindIteration.instantiateLocationsAndEntities(RebindIteration.java:441) > at org.apache.brooklyn.core.mgmt.rebind.RebindIteration.doRun(RebindIteration.java:240) > at org.apache.brooklyn.core.mgmt.rebind.InitialFullRebindIteration.doRun(InitialFullRebindIteration.java:69) > at org.apache.brooklyn.core.mgmt.rebind.RebindIteration.run(RebindIteration.java:266) > ... 8 more > Caused by: org.apache.brooklyn.util.exceptions.PropagatedRuntimeException: ClassNotFoundException: Class com.acme.autobrick:com.acme.location.MyLocation not found on the application class path, nor in the bundle white list. > at org.apache.brooklyn.util.exceptions.Exceptions.propagate(Exceptions.java:129) > at org.apache.brooklyn.core.mgmt.rebind.RebindIteration$BrooklynObjectInstantiator.loadClass(RebindIteration.java:999) > at org.apache.brooklyn.core.mgmt.rebind.RebindIteration$BrooklynObjectInstantiator.newLocation(RebindIteration.java:1007) > at org.apache.brooklyn.core.mgmt.rebind.RebindIteration.instantiateLocationsAndEntities(RebindIteration.java:438) > ... 11 more > Caused by: java.lang.ClassNotFoundException: Class com.acme.autobrick:com.acme.location.MyLocation not found on the application class path, nor in the bundle white list. > at org.apache.brooklyn.util.core.ClassLoaderUtils.loadClass(ClassLoaderUtils.java:155) > at org.apache.brooklyn.core.mgmt.rebind.RebindIteration$BrooklynObjectInstantiator.loadClass(RebindIteration.java:991) > at org.apache.brooklyn.core.mgmt.rebind.RebindIteration$BrooklynObjectInstantiator.loadClass(RebindIteration.java:997) > ... 13 more > {noformat} > Looking at the persisted state for the location, it looks good: {{com.acme.autobrick:com.acme.location.MyLocation}} and {{with-private-location:1.0}}. > Looking at the code path in the stacktrace above, the loading of locations differs from entities. That calls {{RebindIteration.BrooklynObjectInstantiator.load()}}, which tries to use the catalog id. However, for locations it calls straight to {{RebindIteration.BrooklynObjectInstantiator.loadClass()}}, which does not respect the catalog id. -- This message was sent by Atlassian JIRA (v6.3.4#6332)