You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@felix.apache.org by "Konrad Windszus (Jira)" <ji...@apache.org> on 2019/12/05 13:07:00 UTC

[jira] [Commented] (FELIX-5204) IllegalStateException when using custom URL handlers for bundles

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

Konrad Windszus commented on FELIX-5204:
----------------------------------------

Another use case for that property is using a custom JCE  provider (https://docs.oracle.com/cd/E19830-01/819-4712/ablsc/index.html) because Java is internally validating it via https://github.com/openjdk/jdk/blob/7bf82983443025248a22949b22e5ce9f16744b60/src/java.base/share/classes/javax/crypto/JceSecurity.java.template#L261.

> IllegalStateException when using custom URL handlers for bundles
> ----------------------------------------------------------------
>
>                 Key: FELIX-5204
>                 URL: https://issues.apache.org/jira/browse/FELIX-5204
>             Project: Felix
>          Issue Type: Bug
>          Components: Framework
>    Affects Versions: framework-5.4.0
>            Reporter: Guillaume Nodet
>            Assignee: Guillaume Nodet
>            Priority: Major
>             Fix For: framework-5.6.0
>
>
> The following exception can happen after having restarted the whole framework.
> {code}
> java.lang.IllegalStateException: Stream handler unavailable.
> 	at org.apache.felix.framework.URLHandlersStreamHandlerProxy.getDefaultPort(URLHandlersStreamHandlerProxy.java:180)
> 	at java.net.URLStreamHandler.sameFile(URLStreamHandler.java:407)
> 	at org.osgi.service.url.AbstractURLStreamHandlerService.sameFile(AbstractURLStreamHandlerService.java:131)
> 	at java.net.URLStreamHandler.equals(URLStreamHandler.java:333)
> 	at org.osgi.service.url.AbstractURLStreamHandlerService.equals(AbstractURLStreamHandlerService.java:81)
> 	at org.apache.felix.framework.URLHandlersStreamHandlerProxy.equals(URLHandlersStreamHandlerProxy.java:163)
> 	at java.net.URL.equals(URL.java:870)
> 	at java.util.concurrent.ConcurrentHashMap.get(ConcurrentHashMap.java:940)
> 	at javax.crypto.JceSecurityManager.getCryptoPermission(JceSecurityManager.java:124)
> 	at javax.crypto.Cipher.getConfiguredPermission(Cipher.java:2587)
> 	at javax.crypto.Cipher.initCryptoPermission(Cipher.java:700)
> 	at javax.crypto.Cipher.chooseProvider(Cipher.java:863)
> 	at javax.crypto.Cipher.init(Cipher.java:1396)
> 	at javax.crypto.Cipher.init(Cipher.java:1327)
> 	at org.apache.sshd.common.cipher.BaseCipher.init(BaseCipher.java:60)
> 	at org.apache.karaf.shell.ssh.SshUtils.buildCiphers(SshUtils.java:89)
> 	at org.apache.karaf.shell.ssh.Activator.createSshServer(Activator.java:183)
> 	at org.apache.karaf.shell.ssh.Activator.doStart(Activator.java:111)
> 	at org.apache.karaf.util.tracker.BaseActivator.run(BaseActivator.java:233)
> 	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
> 	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
> 	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
> 	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
> 	at java.lang.Thread.run(Thread.java:745)
> {code}
> The problems seems to be that the ProtectionDomain of the classes loaded from bundles do use the URL handler as their code source.  This means that any access to those URL will throw IllegalStateException after the framework has been shutdown.
> The protection domain should use the url the jar from the filesystem for the code source url instead.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)