Description of problem: Resource upgrade is a stage during the Plugin Container startup where the InventoryManager goes through the freshly synced inventory and asks the individual resource components to upgrade their resource key (and possibly other things in the future) to a version compatible with the currently deployed version of the respective plugin. The problem with this approach is that this happens during the InventoryManager initialization when the rest of the container services are not yet initialized and fully started up. So if the resource component's start() method is called during resource upgrade and for example tries to use the EventContext or InventoryContext, the calls to these will most possibly fail because the backing container service managers haven't been initialized (they have been instantiated though). We should consider modifying the startup sequence and/or the resource upgrade workflow for it a) run after the whole PC was initialized and b) before any of the actual subsystems start their work. This is possibly going to require making some methods unavailable during the upgrade phase (throwing exceptions if in invalid state) but bug 855744 could bring a solid model of PCs lifecycle which the plugins could be made aware of and therefore could react accordingly. Version-Release number of selected component (if applicable): 4.6.0-SNAPSHOT How reproducible: always Steps to Reproduce: 1. Install RHQ 3.0.0, inventory an Apache server using it 2. Upgrade to RHQ 4.6.0-SNAPSHOT 3. Do plugins update on the agent prompt or restart the agent 4. Watch the agent.log for errors during resource upgrade Actual results: errors in the agent log notifying about problems during resource upgrade Expected results: no errors Additional info: The agent WILL successfully start up despite the errors