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

Filippo Diotalevi commented on FELIX-1593:
------------------------------------------

I tracked down the problem being in the Logger static field of the Util class. 

This field is initialized when the bundle is first installed with a Logger 
implementation containing the current BundleContext; when the bundle is stopped 
and then restarted, this BundleContext is not valid anymore and therefore the 
Logger raise an exception every time it tries to use it.

Possible solutions:
- reset the Logger field in the Activator.stop() method
- remove the static field and create a Logger instance every time it is 
requested

wdyt?

> Got an exception when restarting FileInstall bundle
> ---------------------------------------------------
>
>                 Key: FELIX-1593
>                 URL: https://issues.apache.org/jira/browse/FELIX-1593
>             Project: Felix
>          Issue Type: Bug
>          Components: File Install
>    Affects Versions: fileinstall-2.0.0
>            Reporter: Agemo Cui
>             Fix For: fileinstall-2.0.1
>
>
> Stopping and then starting FileInstall bundle again when it is active. The 
> following exception will be got.
> Exception in thread "{}" java.lang.IllegalStateException: BundleContext is
>  no longer valid
>         at 
> org.eclipse.osgi.framework.internal.core.BundleContextImpl.checkValid
> (BundleContextImpl.java:1000)
>         at 
> org.eclipse.osgi.framework.internal.core.BundleContextImpl.getService
> Reference(BundleContextImpl.java:601)
>         at 
> org.apache.felix.fileinstall.internal.Util$OsgiLogger.getLogService(U
> til.java:262)
>         at 
> org.apache.felix.fileinstall.internal.Util$OsgiLogger.log(Util.java:2
> 38)
>         at org.apache.felix.fileinstall.internal.Util.log(Util.java:178)
>         at 
> org.apache.felix.fileinstall.internal.DirectoryWatcher.log(DirectoryW
> atcher.java:409)
>         at 
> org.apache.felix.fileinstall.internal.DirectoryWatcher.run(DirectoryW
> atcher.java:139)

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to