SSHJ和Maven阴影插件 [英] SSHJ and the Maven shade plugin

查看:228
本文介绍了SSHJ和Maven阴影插件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在Eclipse中测试SSHJ,一切看起来都不错.但是,当我使用Maven阴影插件打包SSHJ时,出现以下错误:

Testing SSHJ in Eclipse and everything looks good. But When I use the Maven shade plugin to package SSHJ I get the following error:

Exception in thread "main" net.schmizz.sshj.userauth.UserAuthException: Exhausted available authentication methods
at net.schmizz.sshj.SSHClient.auth(SSHClient.java:217)
at net.schmizz.sshj.SSHClient.authPublickey(SSHClient.java:316)
at net.schmizz.sshj.SSHClient.authPublickey(SSHClient.java:365)
at net.schmizz.sshj.SSHClient.authPublickey(SSHClient.java:295)
at no.f12.SshRepository.executeTaskOnHost(SshRepository.java:23)
at no.f12.SshService.serviceCommand(SshService.java:22)
at no.f12.App.main(App.java:29)

添加

Security.addProvider(new org.bouncycastle.jce.provider.BouncyCastleProvider());

将错误消息更改为:

Exception in thread "main" net.schmizz.sshj.transport.TransportException: Unable to reach a settlement: [] and [aes128-ctr, aes192-ctr, aes256-ctr, arcfour256, arcfour128, aes128-gcm@openssh.com, aes256-gcm@openssh.com, aes128-cbc, 3des-cbc, blowfish-cbc, cast128-cbc, aes192-cbc, aes256-cbc, arcfour, rijndael-cbc@lysator.liu.se]
at net.schmizz.sshj.transport.Proposal.firstMatch(Proposal.java:165)
at net.schmizz.sshj.transport.Proposal.negotiate(Proposal.java:147)
at net.schmizz.sshj.transport.KeyExchanger.gotKexInit(KeyExchanger.java:239)
at net.schmizz.sshj.transport.KeyExchanger.handle(KeyExchanger.java:364)
at net.schmizz.sshj.transport.TransportImpl.handle(TransportImpl.java:478)
at net.schmizz.sshj.transport.Decoder.decode(Decoder.java:127)
at net.schmizz.sshj.transport.Decoder.received(Decoder.java:195)
at net.schmizz.sshj.transport.Reader.run(Reader.java:72)

有人知道如何解决这个问题吗?

Any idea how to get around this?

我为什么要使用阴影的一些背景知识...我试图弄清楚一点,即Java的使用和小型utils的分发非常简单.因此,我使用以下代码创建了一个真正的可执行jar: https://github.com/brianm /really-executable-jars-maven-plugin .这使我可以创建一个可执行文件,以分发并添加到用户路径.有点像Go如何拥有一个具有所有依赖项的二进制文件.

A bit of background to why I want to use shade... I am trying to get to a point where usage of Java and distribution of small utils is dead simple. So I create a really executable jar using this: https://github.com/brianm/really-executable-jars-maven-plugin . That enables me to create one, executable file to distribute and add to the path of the user. A bit like how Go has one binary file with all dependencies.

推荐答案

另一种可行的方法是将bouncycastle添加到JRE扩展库中.

Another approach that might work is to add bouncycastle to the JRE extension library.

例如,将"bcprov-jdk15on-1.49.jar"放入主机上的"$ JAVA_HOME/jre/lib/ext/"文件夹中.

E.g put 'bcprov-jdk15on-1.49.jar' in folder '$JAVA_HOME/jre/lib/ext/' on the host.

这篇关于SSHJ和Maven阴影插件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆