It sounds like OBR is somehow getting updated too.

-> richard

On 10/18/09 11:37, Henrik Niehaus wrote:
Hi *,

I'm struggling with an obr problem. I always get an
java.lang.IllegalStateException: Invalid BundleContext when I call
Resolver.deploy the first time.

The start situation looks like this:
->  ps
START LEVEL 1
    ID   State         Level  Name
[   0] [Active     ] [    0] System Bundle (1.8.1)
[   1] [Active     ] [    1] audioformats (0.15)
[   2] [Active     ] [    1] commons-codec-1.3 (0)
[   3] [Active     ] [    1] Core (2.3)
[   4] [Active     ] [    1] Apache Felix Bundle Repository (1.4.0)
[   5] [Active     ] [    1] Apache Felix Log Service (1.0.0)
[   6] [Active     ] [    1] Apache Felix Shell Service (1.2.0)
[   7] [Active     ] [    1] Apache Felix Shell TUI (1.2.0)
[   8] [Active     ] [    1] OSGi R4 Compendium Bundle (4.1.0)
[   9] [Active     ] [    1] LogListener (0.0.1)
[  10] [Active     ] [    1] slf4j-api (1.5.0)
[  11] [Resolved   ] [    1] slf4j-jdk14 (1.5.0)
[  12] [Active     ] [    1] FileTag (0.9.0)
[  13] [Active     ] [    1] Mp3 (0.9.1)
[  14] [Active     ] [    1] CoverGrabber (0.12.0)
[  15] [Active     ] [    1] Ogg (0.7.0)
[  16] [Installed  ] [    1] MusicBrainz (0.9.0)
[  17] [Active     ] [    1] LastFM (0.1.0)
[  18] [Active     ] [    1] Filename (0.8.0)


Then I try to install a bundle with obr (shortened code):
             ServiceReference sr =
ctx.getServiceReference(RepositoryAdmin.class.getName());
             RepositoryAdmin adm = (RepositoryAdmin) ctx.getService(sr);
             Resolver resolver = adm.resolver();

             for (Object object : resources) {
                 Resource res = (Resource) object;
                 resolver.add(res);
             }

             logger.debug("OBR state {}", sr.getBundle().getState());
             if (resolver.resolve()) {
                 resolver.deploy(true);
             } else {
                 logger.error(I18N.translate("error.load_list"));
             }


On the first run I get:
Exception in thread "AWT-EventQueue-0" java.lang.IllegalStateException:
Invalid BundleContext.
         at
org.apache.felix.framework.BundleContextImpl.checkValidity(BundleContextImpl.java:393)
         at
org.apache.felix.framework.BundleContextImpl.getServiceReference(BundleContextImpl.java:257)
         at org.apache.felix.bundlerepository.Logger._log(Logger.java:101)
         at org.apache.felix.bundlerepository.Logger.log(Logger.java:81)
         at
org.apache.felix.bundlerepository.ResolverImpl.deploy(ResolverImpl.java:565)
         at
net.sf.jmp3renamer.gui.PluginManager.actionPerformed(PluginManager.java:320)
         at
javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1995)
         at
javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2318)
         at
javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:387)
         at
javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:242)
         at
javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:236)
         at java.awt.Component.processMouseEvent(Component.java:6263)
         at javax.swing.JComponent.processMouseEvent(JComponent.java:3267)
         at java.awt.Component.processEvent(Component.java:6028)
         at java.awt.Container.processEvent(Container.java:2041)
         at java.awt.Component.dispatchEventImpl(Component.java:4630)
         at java.awt.Container.dispatchEventImpl(Container.java:2099)
         at java.awt.Component.dispatchEvent(Component.java:4460)
         at
java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4574)
         at
java.awt.LightweightDispatcher.processMouseEvent(Container.java:4238)
         at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4168)
         at java.awt.Container.dispatchEventImpl(Container.java:2085)
         at java.awt.Window.dispatchEventImpl(Window.java:2475)
         at java.awt.Component.dispatchEvent(Component.java:4460)
         at java.awt.EventQueue.dispatchEvent(EventQueue.java:599)
         at
java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:269)
         at
java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:184)
         at
java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:174)
         at
java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:169)
         at
java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:161)
         at java.awt.EventDispatchThread.run(EventDispatchThread.java:122)

After this exception, the obr bundle is set to INSTALLED. If I then
start the obr bundle again, everything works as expected and the bundle
with its' dependencies are downloaded and started. Can anyone help me
with this problem?

Cheers
Henrik

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to