You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@felix.apache.org by "Marcel Hanser (Issue Comment Edited) (JIRA)" <ji...@apache.org> on 2012/03/11 20:42:39 UTC

[jira] [Issue Comment Edited] (FELIX-3387) Inconsistent container state if uninstalling bundles in the a bundle activators start method during framework startup.

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

Marcel Hanser edited comment on FELIX-3387 at 3/11/12 7:41 PM:
---------------------------------------------------------------

The second attachement includes the described scenario, the first the eclipse projects to create the two bundles :)
                
      was (Author: marcelh):
    The first attachement includes the described scenario, the second the eclipse projects to create the two bundles.
                  
> Inconsistent container state if uninstalling bundles in the a bundle activators start method during framework startup.
> ----------------------------------------------------------------------------------------------------------------------
>
>                 Key: FELIX-3387
>                 URL: https://issues.apache.org/jira/browse/FELIX-3387
>             Project: Felix
>          Issue Type: Bug
>          Components: Framework
>    Affects Versions: framework-4.0.2
>         Environment: JRE 1.6
>            Reporter: Marcel Hanser
>         Attachments: eclipse_projects.zip, felix-framework-4.0.2.zip
>
>
> If uninstalling a bundle in the BundleActivator#start() method like in the small snipplet below, and the container is in his starting phase the container will never leave this state. In this state its not possible to start any bundle or to shutdown the container with the gogo shell. The pretty same issue occurs if the bundle is cached and it uninstalls a also cached bundle. 
> To reproduce:
> 1) Download current Felix 4.0.2 distribution.
> 2) create two bundles, 
>    a) one with the Activator below.
>    b) one with the symbolicname "usual.bundle.usual.bundle".
> 4) put them into e.g. the "extra_bundles" folder
> 5) add
> felix.auto.start.1=file:extra_bundles/test-0.0.1-SNAPSHOT.jar \
> file:extra_bundles/usual.bundle-0.0.1-SNAPSHOT.jar
> to the config.properties
> 6) execute java -jar bin/felix.jar
> You will see
> C:\Users\...\Desktop\felix-framework-4.0.2>java -jar bin/felix.jar
> uninstalling bundle: usual.bundle.usual.bundle [7]
> ____________________________
> Welcome to Apache Felix Gogo
> g! lb
> START LEVEL 1
>    ID|State      |Level|Name
>     0|Starting   |    0|System Bundle (4.0.2)
>     1|Active     |    1|Apache Felix Bundle Repository (1.6.6)
>     2|Active     |    1|Apache Felix Gogo Command (0.12.0)
>     3|Active     |    1|Apache Felix Gogo Runtime (0.10.0)
>     4|Active     |    1|Apache Felix Gogo Shell (0.10.0)
>     5|Active     |    1|test (0.0.1.SNAPSHOT)
> g!
>  in your command shell.
> {code}
> package test;
> import org.osgi.framework.Bundle;
> import org.osgi.framework.BundleActivator;
> import org.osgi.framework.BundleContext;
> public class TestActivator implements BundleActivator {
> 	private static final String SYMYBOLIC_NAME_OF_USUAL_BUNDLE = "usual.bundle.usual.bundle";
> 	public void start(BundleContext context) throws Exception {
> 		for (Bundle currentBundle : context.getBundles()) {
> 			if (SYMYBOLIC_NAME_OF_USUAL_BUNDLE.equals(currentBundle
> 					.getSymbolicName())) {
> 				System.out.println("uninstalling bundle: " + currentBundle);
> 				currentBundle.uninstall();
> 			}
> 		}
> 	}
> 	public void stop(BundleContext context) throws Exception {
> 	}
> }
> {code}

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira