1

ApacheMinaSSHDを使用してSSHサーバーを作成しています。サーバーは正常に起動しますが、サーバーに接続しようとすると、「セッションが利用できません」という例外が発生します。サーバーのコードは次のとおりです。

SshServer sshd = SshServer.setUpDefaultServer();
sshd.setPort(port);

PasswordAuthenticator auth = new PasswordAuthenticator() {
     public boolean authenticate(String string, String string1, ServerSession ss) {
         return true;
     }   
};
sshd.setPasswordAuthenticator(auth);
sshd.setKeyPairProvider(new SimpleGeneratorHostKeyProvider("hostkey.ser"));
sshd.start();

サーバーに接続しようとすると、次のようになります。

134 [com.ssh.Startup.main()] INFO org.apache.sshd.common.util.SecurityUtils - Trying to register BouncyCastle as a JCE provider
454 [com.ssh.Startup.main()] INFO org.apache.sshd.common.util.SecurityUtils - Registration succeeded
3845 [NioProcessor-2] INFO org.apache.sshd.server.session.ServerSession - Session created from /127.0.0.1:50426
3879 [NioProcessor-2] WARN org.apache.mina.core.filterchain.DefaultIoFilterChain - Unexpected exception from exceptionCaught handler.
java.lang.IllegalStateException: No session available
    at org.apache.sshd.common.AbstractSessionIoHandler.exceptionCaught(AbstractSessionIoHandler.java:52)
    at org.apache.mina.core.filterchain.DefaultIoFilterChain$TailFilter.exceptionCaught(DefaultIoFilterChain.java:697)
    at org.apache.mina.core.filterchain.DefaultIoFilterChain.callNextExceptionCaught(DefaultIoFilterChain.java:483)
    at org.apache.mina.core.filterchain.DefaultIoFilterChain.access$1100(DefaultIoFilterChain.java:46)
    at org.apache.mina.core.filterchain.DefaultIoFilterChain$EntryImpl$1.exceptionCaught(DefaultIoFilterChain.java:791)
    at org.apache.mina.core.filterchain.IoFilterAdapter.exceptionCaught(IoFilterAdapter.java:111)
    at org.apache.mina.core.filterchain.DefaultIoFilterChain.callNextExceptionCaught(DefaultIoFilterChain.java:483)
    at org.apache.mina.core.filterchain.DefaultIoFilterChain.fireExceptionCaught(DefaultIoFilterChain.java:471)
    at org.apache.mina.core.filterchain.DefaultIoFilterChain.callNextSessionCreated(DefaultIoFilterChain.java:359)
    at org.apache.mina.core.filterchain.DefaultIoFilterChain.access$700(DefaultIoFilterChain.java:46)
    at org.apache.mina.core.filterchain.DefaultIoFilterChain$EntryImpl$1.sessionCreated(DefaultIoFilterChain.java:771)
    at org.apache.mina.core.filterchain.IoFilterAdapter.sessionCreated(IoFilterAdapter.java:79)
    at org.apache.mina.core.filterchain.DefaultIoFilterChain.callNextSessionCreated(DefaultIoFilterChain.java:357)
    at org.apache.mina.core.filterchain.DefaultIoFilterChain.fireSessionCreated(DefaultIoFilterChain.java:350)
    at org.apache.mina.core.service.IoServiceListenerSupport.fireSessionCreated(IoServiceListenerSupport.java:211)
    at org.apache.mina.core.polling.AbstractPollingIoProcessor.addNow(AbstractPollingIoProcessor.java:521)
    at org.apache.mina.core.polling.AbstractPollingIoProcessor.handleNewSessions(AbstractPollingIoProcessor.java:488)
    at org.apache.mina.core.polling.AbstractPollingIoProcessor.access$400(AbstractPollingIoProcessor.java:67)
    at org.apache.mina.core.polling.AbstractPollingIoProcessor$Processor.run(AbstractPollingIoProcessor.java:1103)
    at org.apache.mina.util.NamePreservingRunnable.run(NamePreservingRunnable.java:64)
    at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
    at java.lang.Thread.run(Thread.java:662)
Caused by: java.lang.NoSuchMethodError: org.slf4j.Logger.isTraceEnabled()Z
    at org.apache.sshd.common.session.AbstractSession.encode(AbstractSession.java:436)
    at org.apache.sshd.common.session.AbstractSession.writePacket(AbstractSession.java:349)
    at org.apache.sshd.common.session.AbstractSession.sendKexInit(AbstractSession.java:693)
    at org.apache.sshd.server.session.ServerSession.sendKexInit(ServerSession.java:336)
    at org.apache.sshd.server.session.ServerSession.<init>(ServerSession.java:92)
    at org.apache.sshd.server.session.SessionFactory.doCreateSession(SessionFactory.java:43)
    at org.apache.sshd.common.session.AbstractSessionFactory.createSession(AbstractSessionFactory.java:38)
    at org.apache.sshd.common.AbstractSessionIoHandler.sessionCreated(AbstractSessionIoHandler.java:37)
    at org.apache.mina.core.filterchain.DefaultIoFilterChain$TailFilter.sessionCreated(DefaultIoFilterChain.java:643)
    at org.apache.mina.core.filterchain.DefaultIoFilterChain.callNextSessionCreated(DefaultIoFilterChain.java:357)
    ... 14 more

サーバーのどこが悪いのか考えてみませんか?すべての助けに感謝します!

4

1 に答える 1

1

クラスパスに互換性のないバージョンのSLF4Jがあるようです。

Caused by: java.lang.NoSuchMethodError: org.slf4j.Logger.isTraceEnabled()Z
于 2012-11-21T13:39:17.707 に答える