You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@mina.apache.org by "Lyor Goldstein (Jira)" <ji...@apache.org> on 2020/04/07 11:15:00 UTC

[jira] [Comment Edited] (SSHD-975) SshClient subclasses fail in OSGi environment

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

Lyor Goldstein edited comment on SSHD-975 at 4/7/20, 11:14 AM:
---------------------------------------------------------------

In general I am fine with the suggested change (see though my comment on the PR) - I am not so clear though as to why {{getClass().getClassLoader()}}  would yield something different than {{AbstractFactoryManager.class.getClassLoader()}}. Can you provide some more details as to the mechanism involved here that make these class loaders different somehow ?

While on this subject - why are you using NETTY and not the default NIO2 service factory ? Have you tried NIO2 ? Does it exhibit the same behavior ?


was (Author: lgoldstein):
In general I am fine with the suggested change (see my previous comment) - I am not so clear though as to why {{getClass().getClassLoader()}}  would yield something different than {{AbstractFactoryManager.class.getClassLoader()}}. Can you provide some more details as to the mechanism involved here that make these class loaders different somehow ?

While on this subject - why are you using NETTY and not the default NIO2 service factory ? Have you tried NIO2 ? Does it exhibit the same behavior ?

> SshClient subclasses fail in OSGi environment
> ---------------------------------------------
>
>                 Key: SSHD-975
>                 URL: https://issues.apache.org/jira/browse/SSHD-975
>             Project: MINA SSHD
>          Issue Type: Bug
>    Affects Versions: 2.3.0, 2.4.0
>            Reporter: Robert Varga
>            Priority: Major
>          Time Spent: 10m
>  Remaining Estimate: 0h
>
> Attempting to subclass SshClient and use it in OSGi environment can fail with the following:
> {noformat}
> 2020-04-07T07:46:19,968 | WARN  | nioEventLoopGroupCloseable-3-1 | ChannelInitializer               | 64 - io.netty.common - 4.1.45.Final | Failed to initialize a channel. Closing: [id: 0xfedebbf7]
> java.lang.ExceptionInInitializerError: null
> 	at org.opendaylight.netconf.client.SshClientChannelInitializer.initialize(SshClientChannelInitializer.java:43) ~[402:org.opendaylight.netconf.client:1.9.0.SNAPSHOT]
> 	at org.opendaylight.netconf.nettyutil.ReconnectPromise.lambda$connect$0(ReconnectPromise.java:54) ~[420:org.opendaylight.netconf.netty-util:1.9.0.SNAPSHOT]
> 	at org.opendaylight.netconf.nettyutil.AbstractNetconfDispatcher$3.initChannel(AbstractNetconfDispatcher.java:206) ~[420:org.opendaylight.netconf.netty-util:1.9.0.SNAPSHOT]
> 	at org.opendaylight.netconf.nettyutil.AbstractNetconfDispatcher$3.initChannel(AbstractNetconfDispatcher.java:203) ~[420:org.opendaylight.netconf.netty-util:1.9.0.SNAPSHOT]
> 	at io.netty.channel.ChannelInitializer.initChannel(ChannelInitializer.java:129) [67:io.netty.transport:4.1.45.Final]
> 	at io.netty.channel.ChannelInitializer.handlerAdded(ChannelInitializer.java:112) [67:io.netty.transport:4.1.45.Final]
> 	at io.netty.channel.AbstractChannelHandlerContext.callHandlerAdded(AbstractChannelHandlerContext.java:956) [67:io.netty.transport:4.1.45.Final]
> 	at io.netty.channel.DefaultChannelPipeline.callHandlerAdded0(DefaultChannelPipeline.java:609) [67:io.netty.transport:4.1.45.Final]
> 	at io.netty.channel.DefaultChannelPipeline.access$100(DefaultChannelPipeline.java:46) [67:io.netty.transport:4.1.45.Final]
> 	at io.netty.channel.DefaultChannelPipeline$PendingHandlerAddedTask.execute(DefaultChannelPipeline.java:1463) [67:io.netty.transport:4.1.45.Final]
> 	at io.netty.channel.DefaultChannelPipeline.callHandlerAddedForAllHandlers(DefaultChannelPipeline.java:1115) [67:io.netty.transport:4.1.45.Final]
> 	at io.netty.channel.DefaultChannelPipeline.invokeHandlerAddedIfNeeded(DefaultChannelPipeline.java:650) [67:io.netty.transport:4.1.45.Final]
> 	at io.netty.channel.AbstractChannel$AbstractUnsafe.register0(AbstractChannel.java:502) [67:io.netty.transport:4.1.45.Final]
> 	at io.netty.channel.AbstractChannel$AbstractUnsafe.access$200(AbstractChannel.java:417) [67:io.netty.transport:4.1.45.Final]
> 	at io.netty.channel.AbstractChannel$AbstractUnsafe$1.run(AbstractChannel.java:474) [67:io.netty.transport:4.1.45.Final]
> 	at io.netty.util.concurrent.AbstractEventExecutor.safeExecute(AbstractEventExecutor.java:164) [64:io.netty.common:4.1.45.Final]
> 	at io.netty.util.concurrent.SingleThreadEventExecutor.runAllTasks(SingleThreadEventExecutor.java:472) [64:io.netty.common:4.1.45.Final]
> 	at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:500) [67:io.netty.transport:4.1.45.Final]
> 	at io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:989) [64:io.netty.common:4.1.45.Final]
> 	at io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74) [64:io.netty.common:4.1.45.Final]
> 	at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30) [64:io.netty.common:4.1.45.Final]
> 	at java.lang.Thread.run(Thread.java:834) [?:?]
> Caused by: java.lang.IllegalArgumentException: org.apache.sshd.common.forward.PortForwardingEventListener referenced from a method is not visible from class loader
> 	at java.lang.reflect.Proxy$ProxyBuilder.ensureVisible(Proxy.java:858) ~[?:?]
> 	at java.lang.reflect.Proxy$ProxyBuilder.validateProxyInterfaces(Proxy.java:681) ~[?:?]
> 	at java.lang.reflect.Proxy$ProxyBuilder.<init>(Proxy.java:627) ~[?:?]
> 	at java.lang.reflect.Proxy$ProxyBuilder.<init>(Proxy.java:635) ~[?:?]
> 	at java.lang.reflect.Proxy.lambda$getProxyConstructor$0(Proxy.java:415) ~[?:?]
> 	at jdk.internal.loader.AbstractClassLoaderValue$Memoizer.get(AbstractClassLoaderValue.java:329) ~[?:?]
> 	at jdk.internal.loader.AbstractClassLoaderValue.computeIfAbsent(AbstractClassLoaderValue.java:205) ~[?:?]
> 	at java.lang.reflect.Proxy.getProxyConstructor(Proxy.java:413) ~[?:?]
> 	at java.lang.reflect.Proxy.newProxyInstance(Proxy.java:1006) ~[?:?]
> 	at org.apache.sshd.common.util.EventListenerUtils.proxyWrapper(EventListenerUtils.java:193) ~[144:org.apache.sshd.osgi:2.3.0]
> 	at org.apache.sshd.common.helpers.AbstractFactoryManager.<init>(AbstractFactoryManager.java:107) ~[144:org.apache.sshd.osgi:2.3.0]
> 	at org.apache.sshd.client.SshClient.<init>(SshClient.java:189) ~[144:org.apache.sshd.osgi:2.3.0]
> 	at org.opendaylight.netconf.nettyutil.handler.ssh.client.NetconfSshClient.<init>(NetconfSshClient.java:19) ~[420:org.opendaylight.netconf.netty-util:1.9.0.SNAPSHOT]
> 	at org.apache.sshd.common.BaseBuilder.build(BaseBuilder.java:256) ~[144:org.apache.sshd.osgi:2.3.0]
> 	at org.apache.sshd.client.ClientBuilder.build(ClientBuilder.java:183) ~[144:org.apache.sshd.osgi:2.3.0]
> 	at org.apache.sshd.client.ClientBuilder.build(ClientBuilder.java:51) ~[144:org.apache.sshd.osgi:2.3.0]
> 	at org.apache.sshd.common.BaseBuilder.build(BaseBuilder.java:276) ~[144:org.apache.sshd.osgi:2.3.0]
> 	at org.opendaylight.netconf.nettyutil.handler.ssh.client.NetconfClientBuilder.build(NetconfClientBuilder.java:23) ~[420:org.opendaylight.netconf.netty-util:1.9.0.SNAPSHOT]
> 	at org.opendaylight.netconf.nettyutil.handler.ssh.client.AsyncSshHandler.<clinit>(AsyncSshHandler.java:45) ~[420:org.opendaylight.netconf.netty-util:1.9.0.SNAPSHOT]{noformat}
>  
>  



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

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@mina.apache.org
For additional commands, e-mail: dev-help@mina.apache.org