brooklyn-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "ASF GitHub Bot (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (BROOKLYN-409) Rebind fails in karaf, with app referencing classes in catalog item's bundle
Date Fri, 16 Dec 2016 15:31:58 GMT

    [ https://issues.apache.org/jira/browse/BROOKLYN-409?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15754709#comment-15754709
] 

ASF GitHub Bot commented on BROOKLYN-409:
-----------------------------------------

Github user neykov commented on a diff in the pull request:

    https://github.com/apache/brooklyn-server/pull/489#discussion_r92830356
  
    --- Diff: camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/catalog/CatalogOsgiVersionMoreEntityRebindTest.java
---
    @@ -0,0 +1,91 @@
    +/*
    + * Licensed to the Apache Software Foundation (ASF) under one
    + * or more contributor license agreements.  See the NOTICE file
    + * distributed with this work for additional information
    + * regarding copyright ownership.  The ASF licenses this file
    + * to you under the Apache License, Version 2.0 (the
    + * "License"); you may not use this file except in compliance
    + * with the License.  You may obtain a copy of the License at
    + *
    + *     http://www.apache.org/licenses/LICENSE-2.0
    + *
    + * Unless required by applicable law or agreed to in writing,
    + * software distributed under the License is distributed on an
    + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
    + * KIND, either express or implied.  See the License for the
    + * specific language governing permissions and limitations
    + * under the License.
    + */
    +package org.apache.brooklyn.camp.brooklyn.catalog;
    +
    +import static org.testng.Assert.assertEquals;
    +
    +import org.apache.brooklyn.api.entity.Entity;
    +import org.apache.brooklyn.api.policy.Policy;
    +import org.apache.brooklyn.camp.brooklyn.AbstractYamlRebindTest;
    +import org.apache.brooklyn.core.entity.StartableApplication;
    +import org.apache.brooklyn.core.mgmt.osgi.OsgiVersionMoreEntityTest;
    +import org.apache.brooklyn.core.test.entity.TestEntity;
    +import org.apache.brooklyn.entity.stock.BasicApplication;
    +import org.apache.brooklyn.test.support.TestResourceUnavailableException;
    +import org.apache.brooklyn.util.osgi.OsgiTestResources;
    +import org.slf4j.Logger;
    +import org.slf4j.LoggerFactory;
    +import org.testng.annotations.Test;
    +
    +import com.google.common.base.Joiner;
    +import com.google.common.collect.Iterables;
    +
    +/** Many of the same tests as per {@link OsgiVersionMoreEntityTest} but using YAML for
catalog and entities, so catalog item ID is set automatically */
    +public class CatalogOsgiVersionMoreEntityRebindTest extends AbstractYamlRebindTest {
    +    
    +    @SuppressWarnings("unused")
    +    private static final Logger log = LoggerFactory.getLogger(CatalogOsgiVersionMoreEntityRebindTest.class);
    +
    +    @Override
    +    protected boolean useOsgi() {
    +        return true;
    +    }
    +
    +    // See https://issues.apache.org/jira/browse/BROOKLYN-409
    +    @Test
    +    public void testPolicyInBundleReferencedByStockCatalogItem() throws Exception {
    +        TestResourceUnavailableException.throwIfResourceUnavailable(getClass(), OsgiTestResources.BROOKLYN_TEST_OSGI_ENTITIES_COM_EXAMPLE_PATH);
    +        
    +        String policyType = OsgiTestResources.BROOKLYN_TEST_OSGI_ENTITIES_COM_EXAMPLE_POLICY;
    +        
    +        String yaml1 = Joiner.on("\n").join(
    +                "brooklyn.catalog:",
    +                "  id: wrapped-entity",
    +                "  version: 1.0",
    +                "  item:",
    +                "    services:",
    +                "    - type: " + TestEntity.class.getName());
    +        addCatalogItems(yaml1);
    --- End diff --
    
    `addCatalogItems` supports `String... catalogYaml` - no need to join them above.


> Rebind fails in karaf, with app referencing classes in catalog item's bundle
> ----------------------------------------------------------------------------
>
>                 Key: BROOKLYN-409
>                 URL: https://issues.apache.org/jira/browse/BROOKLYN-409
>             Project: Brooklyn
>          Issue Type: Bug
>            Reporter: Aled Sage
>            Assignee: Aled Sage
>             Fix For: 0.10.0
>
>
> Using Brooklyn 0.10.0-SNAPSHOT, running in karaf...
> A customer deployed an app, which uses entity and policy classes defined in an OSGi bundle
(supplied via brooklyn.libraries). A simplified version of the catalog item is something like
that below (where {{com.example.apps.MyTopLevelApp}} and {{com.example.policies.MyPolicy}}
are Java classes in my-bundle.jar):
> {noformat}
> brooklyn.catalog:
>   brooklyn.libraries:
>   - file:///path/to/my-bundle.jar
>   id: com.example.MyApp
>   itemType: template
>   version: 1.3
>   description: My App
>   displayName: My App
>   item:
>     services:
>     - type: com.example.apps.MyTopLevelApp
>       brooklyn.config: 
>         childSpec:
>           $brooklyn:entitySpec:
>             type: org.apache.brooklyn.entity.software.base.VanillaSoftwareProcess
>             name: Sshable
>             brooklyn.config:
>               checkRunning.command: echo true
>               customize.command: echo true
>               launch.command: echo true
>             brooklyn.policies:
>             - type: com.example.policies.MyPolicy
> {noformat}
> This deploys fine. However, when one stops and restarts Brooklyn (so rebinding to persisted
state) it gives the exception below:
> {noformat}
> 2016-12-14 09:30:47,157 WARN  116 o.a.b.c.m.r.RebindExceptionHandlerImpl [nager-msT0tE2K-0]
Rebind: continuing after problem creating POLICY isk2552l4k of type com.example.policies.MyPolicy
> java.lang.IllegalStateException: Unable to load com.example.policies.MyPolicy from []:
Invalid class: com.example.policies.MyPolicy: ClassNotFoundException: com.example.policies.MyPolicy
>         at org.apache.brooklyn.util.guava.IllegalStateExceptionSupplier.get(IllegalStateExceptionSupplier.java:40)[139:org.apache.brooklyn.utils-common:0.10.0.20161205_1210]
>         at org.apache.brooklyn.util.guava.IllegalStateExceptionSupplier.get(IllegalStateExceptionSupplier.java:26)[139:org.apache.brooklyn.utils-common:0.10.0.20161205_1210]
>         at org.apache.brooklyn.util.guava.Maybe$Absent.getException(Maybe.java:337)[139:org.apache.brooklyn.utils-common:0.10.0.20161205_1210]
>         at org.apache.brooklyn.util.guava.Maybe$Absent.get(Maybe.java:331)[139:org.apache.brooklyn.utils-common:0.10.0.20161205_1210]
>         at org.apache.brooklyn.core.mgmt.classloading.AbstractBrooklynClassLoadingContext.loadClass(AbstractBrooklynClassLoadingContext.java:55)[116:org.apache.brooklyn.core:0.10.0.20161205_1210]
>         at org.apache.brooklyn.core.mgmt.rebind.RebindIteration$BrooklynObjectInstantiator.load(RebindIteration.java:953)[116:org.apache.brooklyn.core:0.10.0.20161205_1210]
>         at org.apache.brooklyn.core.mgmt.rebind.RebindIteration$BrooklynObjectInstantiator.newPolicy(RebindIteration.java:1039)[116:org.apache.brooklyn.core:0.10.0.20161205_1210]
>         at org.apache.brooklyn.core.mgmt.rebind.RebindIteration.instantiateAdjuncts(RebindIteration.java:482)[116:org.apache.brooklyn.core:0.10.0.20161205_1210]
>         at org.apache.brooklyn.core.mgmt.rebind.RebindIteration.doRun(RebindIteration.java:242)[116:org.apache.brooklyn.core:0.10.0.20161205_1210]
>         at org.apache.brooklyn.core.mgmt.rebind.InitialFullRebindIteration.doRun(InitialFullRebindIteration.java:69)[116:org.apache.brooklyn.core:0.10.0.20161205_1210]
>         at org.apache.brooklyn.core.mgmt.rebind.RebindIteration.run(RebindIteration.java:266)[116:org.apache.brooklyn.core:0.10.0.20161205_1210]
>         at org.apache.brooklyn.core.mgmt.rebind.RebindManagerImpl.rebindImpl(RebindManagerImpl.java:558)[116:org.apache.brooklyn.core:0.10.0.20161205_1210]
>         at org.apache.brooklyn.core.mgmt.rebind.RebindManagerImpl$3.call(RebindManagerImpl.java:508)[116:org.apache.brooklyn.core:0.10.0.20161205_1210]
>         at org.apache.brooklyn.core.mgmt.rebind.RebindManagerImpl$3.call(RebindManagerImpl.java:506)[116:org.apache.brooklyn.core:0.10.0.20161205_1210]
>         at org.apache.brooklyn.util.core.task.BasicExecutionManager$SubmissionCallable.call(BasicExecutionManager.java:522)[116:org.apache.brooklyn.core:0.10.0.20161205_1210]
>         at java.util.concurrent.FutureTask.run(FutureTask.java:262)[:1.7.0_71]
>         at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)[:1.7.0_71]
>         at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)[:1.7.0_71]
>         at java.lang.Thread.run(Thread.java:745)[:1.7.0_71]
> Caused by: org.apache.brooklyn.util.exceptions.PropagatedRuntimeException: Unable to
load com.example.policies.MyPolicy from []: Invalid class: com.example.policies.MyPolicy:
ClassNotFoundException: com.example.policies.MyPolicy
>         at org.apache.brooklyn.util.exceptions.Exceptions.create(Exceptions.java:432)[139:org.apache.brooklyn.utils-common:0.10.0.20161205_1210]
>         at org.apache.brooklyn.core.mgmt.classloading.BrooklynClassLoadingContextSequential.tryLoadClass(BrooklynClassLoadingContextSequential.java:88)[116:org.apache.brooklyn.core:0.10.0.20161205_1210]
>         at org.apache.brooklyn.core.mgmt.classloading.AbstractBrooklynClassLoadingContext.tryLoadClass(AbstractBrooklynClassLoadingContext.java:61)[116:org.apache.brooklyn.core:0.10.0.20161205_1210]
>         ... 15 more
> Caused by: java.lang.IllegalStateException: Invalid class: com.example.policies.MyPolicy
>         at org.apache.brooklyn.util.guava.IllegalStateExceptionSupplier.get(IllegalStateExceptionSupplier.java:40)[139:org.apache.brooklyn.utils-common:0.10.0.20161205_1210]
>         at org.apache.brooklyn.util.guava.IllegalStateExceptionSupplier.get(IllegalStateExceptionSupplier.java:26)[139:org.apache.brooklyn.utils-common:0.10.0.20161205_1210]
>         at org.apache.brooklyn.util.guava.Maybe$Absent.getException(Maybe.java:337)[139:org.apache.brooklyn.utils-common:0.10.0.20161205_1210]
>         at org.apache.brooklyn.util.guava.Maybe.getException(Maybe.java:465)[139:org.apache.brooklyn.utils-common:0.10.0.20161205_1210]
>         at org.apache.brooklyn.core.mgmt.classloading.BrooklynClassLoadingContextSequential.tryLoadClass(BrooklynClassLoadingContextSequential.java:85)[116:org.apache.brooklyn.core:0.10.0.20161205_1210]
>         ... 16 more
> Caused by: java.lang.ClassNotFoundException: com.example.policies.MyPolicy
>         at java.net.URLClassLoader$1.run(URLClassLoader.java:366)[:1.7.0_71]
>         at java.net.URLClassLoader$1.run(URLClassLoader.java:355)[:1.7.0_71]
>         at java.security.AccessController.doPrivileged(Native Method)[:1.7.0_71]
>         at java.net.URLClassLoader.findClass(URLClassLoader.java:354)[:1.7.0_71]
>         at java.lang.ClassLoader.loadClass(ClassLoader.java:425)[:1.7.0_71]
>         at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)[:1.7.0_71]
>         at java.lang.ClassLoader.loadClass(ClassLoader.java:358)[:1.7.0_71]
>         at org.apache.brooklyn.util.javalang.AggregateClassLoader.findClass(AggregateClassLoader.java:135)[139:org.apache.brooklyn.utils-common:0.10.0.20161205_1210]
>         at java.lang.ClassLoader.loadClass(ClassLoader.java:425)[:1.7.0_71]
>         at java.lang.ClassLoader.loadClass(ClassLoader.java:358)[:1.7.0_71]
>         at org.apache.brooklyn.core.mgmt.classloading.JavaBrooklynClassLoadingContext.tryLoadClass0(JavaBrooklynClassLoadingContext.java:101)[116:org.apache.brooklyn.core:0.10.0.20161205_1210]
>         at org.apache.brooklyn.core.mgmt.classloading.JavaBrooklynClassLoadingContext.tryLoadClass(JavaBrooklynClassLoadingContext.java:84)[116:org.apache.brooklyn.core:0.10.0.20161205_1210]
>         at org.apache.brooklyn.core.mgmt.classloading.BrooklynClassLoadingContextSequential.tryLoadClass(BrooklynClassLoadingContextSequential.java:81)[116:org.apache.brooklyn.core:0.10.0.20161205_1210]
>         ... 16 more
> {noformat}
> Brooklyn does start up, but the policy no longer exists on the entity.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Mime
View raw message