tangjianyi5174 2012-02-10 11:08
浏览 546
已采纳

apache ftpserver 使用 ssl启动时报错,求解决

[code="java"]public class FtpServerTest {
public static void main(String[] args) {
try {
FtpServerFactory serverFactory= new FtpServerFactory();
ListenerFactory factory=new ListenerFactory();
factory.setPort(21);
SslConfigurationFactory ssl = new SslConfigurationFactory();
File keystoreFile=new File("D:\up\ftpserver.jks");
ssl.setKeystoreFile(keystoreFile);
ssl.setKeyPassword("password");
SslConfiguration sc=ssl.createSslConfiguration();
factory.setSslConfiguration(sc);
factory.setServerAddress("127.0.0.1");
factory.setImplicitSsl(true);
serverFactory.addListener("default", factory.createListener());
//serverFactory.setUserManager(ftpService.userManager());
FtpServer server = serverFactory.createServer();

        server.start();
    } catch (Exception e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }
}

}
启动时一直报错
log4j:WARN No appenders could be found for logger (org.apache.ftpserver.ssl.SslConfigurationFactory).
log4j:WARN Please initialize the log4j system properly.
org.apache.ftpserver.FtpServerConfigurationException: DefaultSsl.configure()
at org.apache.ftpserver.ssl.SslConfigurationFactory.createSslConfiguration(SslConfigurationFactory.java:364)
at FtpServerTest.main(FtpServerTest.java:22)
Caused by: java.lang.NullPointerException
at org.apache.ftpserver.ssl.SslConfigurationFactory.loadStore(SslConfigurationFactory.java:305)
at org.apache.ftpserver.ssl.SslConfigurationFactory.createSslConfiguration(SslConfigurationFactory.java:326)
... 1 more

[/code]

  • 写回答

2条回答 默认 最新

  • myali88 2012-02-10 11:33
    关注

    [quote]
    [code="java"]
    KeyStore store = KeyStore.getInstance(storeType);
    store.load(fin, storePass.toCharArray());
    这里报异常
    [/code]
    [/quote]
    具体是哪个对象空了,我想也应该能调试出来的。

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 笔记本上移动热点开关状态查询
  • ¥85 类鸟群Boids——仿真鸟群避障的相关问题
  • ¥15 CFEDEM自带算例错误,如何解决?
  • ¥15 有没有会使用flac3d软件的家人
  • ¥20 360摄像头无法解绑使用,请教解绑当前账号绑定问题,
  • ¥15 docker实践项目
  • ¥15 利用pthon计算薄膜结构的光导纳
  • ¥15 海康hlss视频流怎么播放
  • ¥15 Paddleocr:out of memory error on GPU
  • ¥30 51单片机C语言数码管驱动单片机为AT89C52