简体   繁体   中英

Java Apache FTP Server import libraries

I am getting this error while starting the server.

java.lang.NoSuchMethodError: No virtual method supportedOptions()Ljava/util/Set; in class Ljava/nio/channels/ServerSocketChannel; or its super classes (declaration of 'java.nio.channels.ServerSocketChannel' appears in /system/framework/core-libart.jar)
            at org.apache.mina.transport.socket.nio.NioSocketAcceptor.open(NioSocketAcceptor.java:259)
            at org.apache.mina.transport.socket.nio.NioSocketAcceptor.open(NioSocketAcceptor.java:52)
            at org.apache.mina.core.polling.AbstractPollingIoAcceptor$Acceptor.registerHandles(AbstractPollingIoAcceptor.java:591)
            at org.apache.mina.core.polling.AbstractPollingIoAcceptor$Acceptor.run(AbstractPollingIoAcceptor.java:460)
            at org.apache.mina.util.NamePreservingRunnable.run(NamePreservingRunnable.java:64)
            at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1113)
            at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:588)
            at java.lang.Thread.run(Thread.java:833)

Import Libraries are...

    implementation 'org.apache.mina:mina-core:2.1.6'
    implementation 'org.slf4j:slf4j-api:2.0.6'
    implementation 'org.slf4j:slf4j-simple:2.0.6'
    implementation 'org.apache.ftpserver:ftplet-api:1.2.0'
    implementation 'org.apache.ftpserver:ftpserver-core:1.2.0'

Hello this method is supported since one specific version of the api. II remember well, since api 20, and in jdk this method there is since jdk 1.7. To resolve I have used an earlier version of apache mina, that is compliant with a version earlier of jdk 1.7, because this method wasn't available in jdk before 1.7. Then I have replaced the library with dependencies with the older version and the project started to work and the error not raising again.

Alessio

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM