我有一个基于Apache Mina用Java编写的网络操作的应用服务器.最近我在日志文件中遇到了一个奇怪的行为.我注意到日志文件中充满了@ ^ @ ^ @ ^ @ ^ @ ^ @ ^ @ ^ @ ^ @ ^ @ ^ @ ^ @ ^ ....字符.我的意思是那些意想不到的字符是大量的,因此日志文件在几个小时内获得数百GB!我对这个问题一无所知,谷歌几乎不可能.可能是什么原因?那些角色对任何人都熟悉吗?
如果需要,我可以提供有关应用程序的更多详细信
提前致谢.
MINA和netty之间有一个非常丰富的比较,在这里 我想知道你的偏好,当平台是Android!
当我读到一些关于在android中使用netty的bug报告时,我感到很困惑.
连接到主机的Android模拟器的数量可以增长到很多.
所以问题很简单: 哪一个更好用:netty还是MINA?
BTW,还有其他建议的框架吗?
我非常重视你的意见和答案.谢谢
我计划在Android和iOS上制作即时消息应用程序,您可以使用该应用程序与其他人聊天,以及一些自定义功能.
我将使用XMPP协议,并为其创建自定义扩展.我计划在Amazon Web Services(AWS)上运行Java应用程序,以便它可以扩展.
在研究了服务器选项后,我决定使用Apache Vysper.
但是,我以前从未使用过正确的Java应用程序,并且从未使用过XMPP,AWS或Vysper - 因此我非常依赖于良好的文档:-)
Apache Vysper项目非常新,因此文档有点稀疏.我想知道我是否遗漏了一些东西,我是否应该使用一般的MINA文档?我不知道其他地方有其他资源吗?
"Apache Vysper可以独立运行或嵌入到另一个应用程序中."
说实话,在解决使用什么来制作Java应用程序方面,我就像迷失了一样.您知道AWS Java SDK是否具备使应用程序在AWS上使用所需的一切?然后将Vysper集成到这个中是一件简单的事情吗?或者我是否需要使用诸如Spring框架之类的东西来创建Java应用程序?
感谢您抽出宝贵时间来帮助我.如果你知道任何可以澄清情况的事情,我会非常感激:-) - 抱歉有点无用,但是,嘿,我们都必须从正确的地方开始;)
对我来说这看起来很奇怪.我可以在同一个端口上运行多个TCP服务器.
我使用Apache MINA库和以下代码:
IoAcceptor acceptor = new NioSocketAcceptor();
acceptor.bind(new InetSocketAddress(80));
Run Code Online (Sandbox Code Playgroud)
端口80已被其他程序使用.但我没有得到异常"地址已经在使用中".使用netstat,我可以看到以下内容:
C:\>netstat -oan |find /i "LIST"
TCP 0.0.0.0:80 0.0.0.0:0 LISTENING 2220
TCP 0.0.0.0:80 0.0.0.0:0 LISTENING 904
TCP 0.0.0.0:135 0.0.0.0:0 LISTENING 840
Run Code Online (Sandbox Code Playgroud)
有人可以解释我这样的行为吗?
操作系统:Windows 7.
谢谢.
我希望使用Apache MINA在Java中设置SFTP服务器.
它似乎开始正常,但当我尝试使用OpenSSH客户端连接到它时,我得到:
$ ssh localhost -p 2222
Unable to negotiate with ::1: no matching host key type found. Their offer: ssh-dss
$ ssh -V
OpenSSH_7.1p1, OpenSSL 1.0.2d 9 Jul 2015
Run Code Online (Sandbox Code Playgroud)
Java应用程序日志:
! java.lang.IllegalStateException: Unable to negotiate key exchange for server host key algorithms (client: ecdsa-sha2-nistp256-cert-v01@openssh.com,ecdsa-sha2-nistp384-cert-v01@openssh.com,ecdsa-sha2-nistp521-cert-v01@openssh.com,ssh-ed25519-cert-v01@openssh.com,ssh-rsa-cert-v01@openssh.com,ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521,ssh-ed25519,ssh-rsa / server: ssh-dss)
! at org.apache.sshd.common.session.AbstractSession.negotiate(AbstractSession.java:1279) ~[sshd-core-1.0.0.jar:1.0.0]
Run Code Online (Sandbox Code Playgroud)
我的Maven依赖项是:
<dependency>
<groupId>org.apache.sshd</groupId>
<artifactId>sshd-sftp</artifactId>
<version>0.11.0</version>
</dependency>
<dependency>
<groupId>org.apache.sshd</groupId>
<artifactId>sshd-core</artifactId>
<version>1.0.0</version>
</dependency>
Run Code Online (Sandbox Code Playgroud)
我的应用启动代码看起来像(从/sf/answers/628216081/复制)
import org.apache.sshd.common.NamedFactory;
import org.apache.sshd.server.Command;
import org.apache.sshd.server.SshServer;
import org.apache.sshd.server.auth.UserAuth;
import org.apache.sshd.server.auth.UserAuthNoneFactory;
import org.apache.sshd.server.command.ScpCommandFactory;
import …Run Code Online (Sandbox Code Playgroud) 我想使用 apache sshd 项目http://mina.apache.org/sshd-project/连接网络交换机:
public void connect(){
try
{
client = SshClient.setUpDefaultClient();
client.start();
session=client.connect(account, host, port).getSession();
session.addPasswordIdentity(password);
session.auth().verify();
}
catch (Exception e)
{
System.out.println(e.getMessage());
}
}
Run Code Online (Sandbox Code Playgroud)
但出现错误:
使用 apache sshd ssh 客户端出现错误“未检测到/配置”IoServiceFactoryFactory
如何解决?谢谢
我在文档中找不到 apache sshd 项目是否支持 ssh 协议 1.5?此设备使用 ssh 2.0,但我的其他设备使用 ssh 1.5,谢谢
我已经使用过Mina和Netty,但现在我在市场上推出了一款可以在Android中使用的轻量级库.我比标准的io实现更喜欢Nio或AsyncIo.
更新1
缺乏回复确实让我觉得我应该编写自己的库.现在我正在使用原始NIO而且它不是很有趣.
如今,Mina似乎正在将他们的*.bundle文件部署为文件,这至少是烦人的,至多是彻头彻尾的邪恶.
如果我依赖Maven中的Mina,就像这样:
<dependency>
<groupId>org.apache.mina</groupId>
<artifactId>mina-core</artifactId>
<version>${mina.version}</version>
<type>jar</type>
</dependency>
<dependency>
<groupId>org.apache.mina</groupId>
<artifactId>mina-integration-beans</artifactId>
<version>${mina.version}</version>
<type>jar</type>
</dependency>
<dependency>
<groupId>org.apache.mina</groupId>
<artifactId>mina-integration-jmx</artifactId>
<version>${mina.version}</version>
<type>jar</type>
</dependency>
Run Code Online (Sandbox Code Playgroud)
...然后我收到以下错误:
Multiple annotations found at this line:
- Missing artifact org.apache.mina:mina-integration-ognl:bundle:2.0.4
- Missing artifact org.apache.mina:mina-core:bundle:2.0.4
- Missing artifact org.apache.mina:mina-integration-beans:bundle:2.0.4
Run Code Online (Sandbox Code Playgroud)
我不确定为什么它仍在寻找*.bundle文件而不是*.jar文件.为什么不寻找并找到JAR文件?
这尤其令人沮丧,因为我有依赖于这个项目的项目,如果没有Mina JAR,它们都会失败.无论古老的Java JAR发生了什么?
我正在使用Apache Mina SSHD来实现测试SFTPServer.我已经能够为简单的密码验证工作,但是我无法为PublicKey身份验证配置东西.我有一个实现了PublickeyAuthenticator接口,如下所示,
public class SimpleKeyAuthenticator implements PublickeyAuthenticator {
@Override
public boolean authenticate(String username, PublicKey key, ServerSession session) {
System.out.println("In authenticate");
return false;
}
}
Run Code Online (Sandbox Code Playgroud)
我的服务器实现如下,
...
sshd = SshServer.setUpDefaultServer();
sshd.setPort(2222);
//sshd.setPort(config.getSFTPPort());
//sshd.setKeyPairProvider(new
sshd.setKeyPairProvider(new PEMGeneratorHostKeyProvider("hostkey.pem"));
//sshd.setKeyPairProvider(new SimpleGeneratorHostKeyProvider());
sshd.setPublickeyAuthenticator(new SimpleKeyAuthenticator());
sshd.setFileSystemFactory(new SimpleFileSystemFactory());
List<NamedFactory<UserAuth>> userAuthFactories = new ArrayList<NamedFactory<UserAuth>>();
userAuthFactories.add(new UserAuthNone.Factory());
sshd.setUserAuthFactories(userAuthFactories);
sshd.setCommandFactory(new ScpCommandFactory());
List<NamedFactory<Command>> namedFactoryList = new ArrayList<NamedFactory<Command>>();
namedFactoryList.add(new SftpSubsystem.Factory());
sshd.setSubsystemFactories(namedFactoryList);
sshd.setSessionFactory(new SimpleSessionFactory(handler));
try {
sshd.start();
} catch (Exception e) {
e.printStackTrace();
}
Run Code Online (Sandbox Code Playgroud)
但是,当我尝试使用我的SFTP客户端获取文件时,一切正常.我希望authenticate方法失败,因为它总是返回false.我已经尝试将KeyPairProvider设置为使用PEMGeneratorHostKeyProvider和SimpleGeneratorHostKeyProvider.我还设置了PublicKeyAuthenticator来使用我的SimpleKeyAuthenticator类.注意,当我查看控制台输出时,我从未看到"In authenticate",因此我知道Authenticate永远不会被调用.有人可以指点我错过的东西吗?任何帮助表示赞赏.
问候,马克
我试图获取服务器的公钥.这是我试过的:
val serverKey = sshClient.connect("dyn mem", "localhost", "2222")
.verify()
.getSession()
.getKex()
.getServerKey()
Run Code Online (Sandbox Code Playgroud)
问题是得到的结果getServerKey()是null ...
如何使用Apache SSHD客户端获取SSH服务器的公钥.