You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@karaf.apache.org by Benson Margulies <be...@basistech.com> on 2016/09/14 18:54:15 UTC

Invalid Bundle Context errors with 4.0.6, unpredictably

Folks,

One of my pax-exam tests _sometimes_ fails with the backtrace below;
to be more precise, it hangs after showing this backtrace on the
console.

It seems as if this only happens when all of my ITs run; if I tell
failsafe to just run one, it seems never to happen.

Any ideas?

TIA


2016-09-14 14:46:52,074 | WARN  | pool-6-thread-1  | Activator
               | 6 - org.apache.karaf.features.core - 4.0.6 | Error
starting activator
java.lang.IllegalStateException: Invalid BundleContext.
        at org.apache.felix.framework.BundleContextImpl.checkValidity(BundleContextImpl.java:511)[org.apache.felix.framework-5.4.0.jar:]
        at org.apache.felix.framework.BundleContextImpl.registerService(BundleContextImpl.java:328)[org.apache.felix.framework-5.4.0.jar:]
        at org.apache.karaf.util.tracker.BaseActivator.registerMBean(BaseActivator.java:293)[6:org.apache.karaf.features.core:4.0.6]
        at org.apache.karaf.features.internal.osgi.Activator.doStart(Activator.java:265)[6:org.apache.karaf.features.core:4.0.6]
        at org.apache.karaf.util.tracker.BaseActivator.run(BaseActivator.java:236)[6:org.apache.karaf.features.core:4.0.6]
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)[:1.8.0_60]
        at java.util.concurrent.FutureTask.run(FutureTask.java:266)[:1.8.0_60]
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)[:1.8.0_60]
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)[:1.8.0_60]
        at java.lang.Thread.run(Thread.java:745)[:1.8.0_60]

Re: Invalid Bundle Context errors with 4.0.6, unpredictably

Posted by Freeman Fang <fr...@gmail.com>.
FWIW, for the upcoming pax-exam 4.10, we offer a chance to rerun the test if the testcase implements a retry TestRule, so that when the test failed first time with such bundle refresh problem,  there’s another chance to rerun it with a refreshed Karaf container. PAXEXAM-795[1] tracked this.

[1]https://ops4j1.jira.com/browse/PAXEXAM-795
-------------
Freeman(Yue) Fang

Red Hat, Inc. 
FuseSource is now part of Red Hat



> On Sep 15, 2016, at 3:35 AM, Guillaume Nodet <gn...@apache.org> wrote:
> 
> Such an error is caused by the bundle being stopped / refreshed / updated, so the reason should appear in the log.
> 
> 2016-09-14 21:10 GMT+02:00 Benson Margulies <benson@basistech.com <ma...@basistech.com>>:
> I don't know of any reason for a refresh. The structure is always that
> I have a Karaf assembly; the test launches it and then tests web
> services that it publishes. No test involves any updating or deploying
> features or bundles.
> 
> 
> On Wed, Sep 14, 2016 at 2:59 PM, Guillaume Nodet <gnodet@apache.org <ma...@apache.org>> wrote:
> > If your test deploys certain bundles such as eventadmin, it can cause
> > pax-logging-api to be refreshed, which in turn cause almost all bundles to
> > be refreshed, which can cause such problems.
> > If that's the case, you should consider deploying eventamin at the startup
> > stage somehow to avoid the refreshes..
> >
> > 2016-09-14 20:54 GMT+02:00 Benson Margulies <benson@basistech.com <ma...@basistech.com>>:
> >>
> >> Folks,
> >>
> >> One of my pax-exam tests _sometimes_ fails with the backtrace below;
> >> to be more precise, it hangs after showing this backtrace on the
> >> console.
> >>
> >> It seems as if this only happens when all of my ITs run; if I tell
> >> failsafe to just run one, it seems never to happen.
> >>
> >> Any ideas?
> >>
> >> TIA
> >>
> >>
> >> 2016-09-14 14:46:52,074 | WARN  | pool-6-thread-1  | Activator
> >>                | 6 - org.apache.karaf.features.core - 4.0.6 | Error
> >> starting activator
> >> java.lang.IllegalStateException: Invalid BundleContext.
> >>         at
> >> org.apache.felix.framework.BundleContextImpl.checkValidity(BundleContextImpl.java:511)[org.apache.felix.framework-5.4.0.jar:]
> >>         at
> >> org.apache.felix.framework.BundleContextImpl.registerService(BundleContextImpl.java:328)[org.apache.felix.framework-5.4.0.jar:]
> >>         at
> >> org.apache.karaf.util.tracker.BaseActivator.registerMBean(BaseActivator.java:293)[6:org.apache.karaf.features.core:4.0.6]
> >>         at
> >> org.apache.karaf.features.internal.osgi.Activator.doStart(Activator.java:265)[6:org.apache.karaf.features.core:4.0.6]
> >>         at
> >> org.apache.karaf.util.tracker.BaseActivator.run(BaseActivator.java:236)[6:org.apache.karaf.features.core:4.0.6]
> >>         at
> >> java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)[:1.8.0_60]
> >>         at
> >> java.util.concurrent.FutureTask.run(FutureTask.java:266)[:1.8.0_60]
> >>         at
> >> java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)[:1.8.0_60]
> >>         at
> >> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)[:1.8.0_60]
> >>         at java.lang.Thread.run(Thread.java:745)[:1.8.0_60]
> >
> >
> >
> >
> > --
> > ------------------------
> > Guillaume Nodet
> > ------------------------
> > Red Hat, Open Source Integration
> >
> > Email: gnodet@redhat.com <ma...@redhat.com>
> > Web: http://fusesource.com <http://fusesource.com/>
> > Blog: http://gnodet.blogspot.com/ <http://gnodet.blogspot.com/>
> >
> 
> 
> 
> -- 
> ------------------------
> Guillaume Nodet
> ------------------------
> Red Hat, Open Source Integration
> 
> Email: gnodet@redhat.com <ma...@redhat.com>
> Web: http://fusesource.com <http://fusesource.com/>
> Blog: http://gnodet.blogspot.com/ <http://gnodet.blogspot.com/>
> 


Re: Invalid Bundle Context errors with 4.0.6, unpredictably

Posted by Guillaume Nodet <gn...@apache.org>.
Such an error is caused by the bundle being stopped / refreshed / updated,
so the reason should appear in the log.

2016-09-14 21:10 GMT+02:00 Benson Margulies <be...@basistech.com>:

> I don't know of any reason for a refresh. The structure is always that
> I have a Karaf assembly; the test launches it and then tests web
> services that it publishes. No test involves any updating or deploying
> features or bundles.
>
>
> On Wed, Sep 14, 2016 at 2:59 PM, Guillaume Nodet <gn...@apache.org>
> wrote:
> > If your test deploys certain bundles such as eventadmin, it can cause
> > pax-logging-api to be refreshed, which in turn cause almost all bundles
> to
> > be refreshed, which can cause such problems.
> > If that's the case, you should consider deploying eventamin at the
> startup
> > stage somehow to avoid the refreshes..
> >
> > 2016-09-14 20:54 GMT+02:00 Benson Margulies <be...@basistech.com>:
> >>
> >> Folks,
> >>
> >> One of my pax-exam tests _sometimes_ fails with the backtrace below;
> >> to be more precise, it hangs after showing this backtrace on the
> >> console.
> >>
> >> It seems as if this only happens when all of my ITs run; if I tell
> >> failsafe to just run one, it seems never to happen.
> >>
> >> Any ideas?
> >>
> >> TIA
> >>
> >>
> >> 2016-09-14 14:46:52,074 | WARN  | pool-6-thread-1  | Activator
> >>                | 6 - org.apache.karaf.features.core - 4.0.6 | Error
> >> starting activator
> >> java.lang.IllegalStateException: Invalid BundleContext.
> >>         at
> >> org.apache.felix.framework.BundleContextImpl.checkValidity(
> BundleContextImpl.java:511)[org.apache.felix.framework-5.4.0.jar:]
> >>         at
> >> org.apache.felix.framework.BundleContextImpl.registerService(
> BundleContextImpl.java:328)[org.apache.felix.framework-5.4.0.jar:]
> >>         at
> >> org.apache.karaf.util.tracker.BaseActivator.registerMBean(
> BaseActivator.java:293)[6:org.apache.karaf.features.core:4.0.6]
> >>         at
> >> org.apache.karaf.features.internal.osgi.Activator.
> doStart(Activator.java:265)[6:org.apache.karaf.features.core:4.0.6]
> >>         at
> >> org.apache.karaf.util.tracker.BaseActivator.run(
> BaseActivator.java:236)[6:org.apache.karaf.features.core:4.0.6]
> >>         at
> >> java.util.concurrent.Executors$RunnableAdapter.
> call(Executors.java:511)[:1.8.0_60]
> >>         at
> >> java.util.concurrent.FutureTask.run(FutureTask.java:266)[:1.8.0_60]
> >>         at
> >> java.util.concurrent.ThreadPoolExecutor.runWorker(
> ThreadPoolExecutor.java:1142)[:1.8.0_60]
> >>         at
> >> java.util.concurrent.ThreadPoolExecutor$Worker.run(
> ThreadPoolExecutor.java:617)[:1.8.0_60]
> >>         at java.lang.Thread.run(Thread.java:745)[:1.8.0_60]
> >
> >
> >
> >
> > --
> > ------------------------
> > Guillaume Nodet
> > ------------------------
> > Red Hat, Open Source Integration
> >
> > Email: gnodet@redhat.com
> > Web: http://fusesource.com
> > Blog: http://gnodet.blogspot.com/
> >
>



-- 
------------------------
Guillaume Nodet
------------------------
Red Hat, Open Source Integration

Email: gnodet@redhat.com
Web: http://fusesource.com
Blog: http://gnodet.blogspot.com/

Re: Invalid Bundle Context errors with 4.0.6, unpredictably

Posted by Benson Margulies <be...@basistech.com>.
I don't know of any reason for a refresh. The structure is always that
I have a Karaf assembly; the test launches it and then tests web
services that it publishes. No test involves any updating or deploying
features or bundles.


On Wed, Sep 14, 2016 at 2:59 PM, Guillaume Nodet <gn...@apache.org> wrote:
> If your test deploys certain bundles such as eventadmin, it can cause
> pax-logging-api to be refreshed, which in turn cause almost all bundles to
> be refreshed, which can cause such problems.
> If that's the case, you should consider deploying eventamin at the startup
> stage somehow to avoid the refreshes..
>
> 2016-09-14 20:54 GMT+02:00 Benson Margulies <be...@basistech.com>:
>>
>> Folks,
>>
>> One of my pax-exam tests _sometimes_ fails with the backtrace below;
>> to be more precise, it hangs after showing this backtrace on the
>> console.
>>
>> It seems as if this only happens when all of my ITs run; if I tell
>> failsafe to just run one, it seems never to happen.
>>
>> Any ideas?
>>
>> TIA
>>
>>
>> 2016-09-14 14:46:52,074 | WARN  | pool-6-thread-1  | Activator
>>                | 6 - org.apache.karaf.features.core - 4.0.6 | Error
>> starting activator
>> java.lang.IllegalStateException: Invalid BundleContext.
>>         at
>> org.apache.felix.framework.BundleContextImpl.checkValidity(BundleContextImpl.java:511)[org.apache.felix.framework-5.4.0.jar:]
>>         at
>> org.apache.felix.framework.BundleContextImpl.registerService(BundleContextImpl.java:328)[org.apache.felix.framework-5.4.0.jar:]
>>         at
>> org.apache.karaf.util.tracker.BaseActivator.registerMBean(BaseActivator.java:293)[6:org.apache.karaf.features.core:4.0.6]
>>         at
>> org.apache.karaf.features.internal.osgi.Activator.doStart(Activator.java:265)[6:org.apache.karaf.features.core:4.0.6]
>>         at
>> org.apache.karaf.util.tracker.BaseActivator.run(BaseActivator.java:236)[6:org.apache.karaf.features.core:4.0.6]
>>         at
>> java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)[:1.8.0_60]
>>         at
>> java.util.concurrent.FutureTask.run(FutureTask.java:266)[:1.8.0_60]
>>         at
>> java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)[:1.8.0_60]
>>         at
>> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)[:1.8.0_60]
>>         at java.lang.Thread.run(Thread.java:745)[:1.8.0_60]
>
>
>
>
> --
> ------------------------
> Guillaume Nodet
> ------------------------
> Red Hat, Open Source Integration
>
> Email: gnodet@redhat.com
> Web: http://fusesource.com
> Blog: http://gnodet.blogspot.com/
>

Re: Invalid Bundle Context errors with 4.0.6, unpredictably

Posted by Guillaume Nodet <gn...@apache.org>.
If your test deploys certain bundles such as eventadmin, it can cause
pax-logging-api to be refreshed, which in turn cause almost all bundles to
be refreshed, which can cause such problems.
If that's the case, you should consider deploying eventamin at the startup
stage somehow to avoid the refreshes..

2016-09-14 20:54 GMT+02:00 Benson Margulies <be...@basistech.com>:

> Folks,
>
> One of my pax-exam tests _sometimes_ fails with the backtrace below;
> to be more precise, it hangs after showing this backtrace on the
> console.
>
> It seems as if this only happens when all of my ITs run; if I tell
> failsafe to just run one, it seems never to happen.
>
> Any ideas?
>
> TIA
>
>
> 2016-09-14 14:46:52,074 | WARN  | pool-6-thread-1  | Activator
>                | 6 - org.apache.karaf.features.core - 4.0.6 | Error
> starting activator
> java.lang.IllegalStateException: Invalid BundleContext.
>         at org.apache.felix.framework.BundleContextImpl.checkValidity(
> BundleContextImpl.java:511)[org.apache.felix.framework-5.4.0.jar:]
>         at org.apache.felix.framework.BundleContextImpl.registerService(
> BundleContextImpl.java:328)[org.apache.felix.framework-5.4.0.jar:]
>         at org.apache.karaf.util.tracker.BaseActivator.registerMBean(
> BaseActivator.java:293)[6:org.apache.karaf.features.core:4.0.6]
>         at org.apache.karaf.features.internal.osgi.Activator.
> doStart(Activator.java:265)[6:org.apache.karaf.features.core:4.0.6]
>         at org.apache.karaf.util.tracker.BaseActivator.run(
> BaseActivator.java:236)[6:org.apache.karaf.features.core:4.0.6]
>         at java.util.concurrent.Executors$RunnableAdapter.
> call(Executors.java:511)[:1.8.0_60]
>         at java.util.concurrent.FutureTask.run(FutureTask.
> java:266)[:1.8.0_60]
>         at java.util.concurrent.ThreadPoolExecutor.runWorker(
> ThreadPoolExecutor.java:1142)[:1.8.0_60]
>         at java.util.concurrent.ThreadPoolExecutor$Worker.run(
> ThreadPoolExecutor.java:617)[:1.8.0_60]
>         at java.lang.Thread.run(Thread.java:745)[:1.8.0_60]
>



-- 
------------------------
Guillaume Nodet
------------------------
Red Hat, Open Source Integration

Email: gnodet@redhat.com
Web: http://fusesource.com
Blog: http://gnodet.blogspot.com/

Re: Invalid Bundle Context errors with 4.0.6, unpredictably

Posted by Jean-Baptiste Onofré <jb...@nanthrax.net>.
Hi Benson

Don't you have any refresh in test ? Most the time invalid bundle context is caused by a refresh. So the "initial" bundle context is no more valid.

Regards
JB



On Sep 14, 2016, 20:54, at 20:54, Benson Margulies <be...@basistech.com> wrote:
>Folks,
>
>One of my pax-exam tests _sometimes_ fails with the backtrace below;
>to be more precise, it hangs after showing this backtrace on the
>console.
>
>It seems as if this only happens when all of my ITs run; if I tell
>failsafe to just run one, it seems never to happen.
>
>Any ideas?
>
>TIA
>
>
>2016-09-14 14:46:52,074 | WARN  | pool-6-thread-1  | Activator
>               | 6 - org.apache.karaf.features.core - 4.0.6 | Error
>starting activator
>java.lang.IllegalStateException: Invalid BundleContext.
>at
>org.apache.felix.framework.BundleContextImpl.checkValidity(BundleContextImpl.java:511)[org.apache.felix.framework-5.4.0.jar:]
>at
>org.apache.felix.framework.BundleContextImpl.registerService(BundleContextImpl.java:328)[org.apache.felix.framework-5.4.0.jar:]
>at
>org.apache.karaf.util.tracker.BaseActivator.registerMBean(BaseActivator.java:293)[6:org.apache.karaf.features.core:4.0.6]
>at
>org.apache.karaf.features.internal.osgi.Activator.doStart(Activator.java:265)[6:org.apache.karaf.features.core:4.0.6]
>at
>org.apache.karaf.util.tracker.BaseActivator.run(BaseActivator.java:236)[6:org.apache.karaf.features.core:4.0.6]
>at
>java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)[:1.8.0_60]
> at java.util.concurrent.FutureTask.run(FutureTask.java:266)[:1.8.0_60]
>at
>java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)[:1.8.0_60]
>at
>java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)[:1.8.0_60]
>        at java.lang.Thread.run(Thread.java:745)[:1.8.0_60]