У меня есть пользовательский поставщик файловой системы в моем приложении, который я определил в src\main\resources\META-INF\services
внутри файла java.nio.file.spi.FileSystemProvider
как com.test.sc.chariot.sshd.filesystem.TestFileSystemProvider
. Когда я пытаюсь запустить свое приложение как приложение Java, оно работает абсолютно нормально, тогда как, если я пытаюсь запустить свое приложение через исполняемый файл jar, оно запускается, но когда я бью свою файловую систему через SFTP-клиент, это выдает мне ошибку, как показано ниже
2020-03-06 17:11:06,960 [NioProcessor-2] WARN org.apache.sshd.server.session.ServerSessionImpl - exceptionCaught(ServerSessionImpl[user1@/127.0.0.1:55119])[state=Opened] RuntimeSshException: null
2020-03-06 17:11:06,960 [NioProcessor-2] DEBUG org.apache.sshd.server.session.ServerSessionImpl - exceptionCaught(ServerSessionImpl[user1@/127.0.0.1:55119])[state=Opened] details
org.apache.sshd.common.RuntimeSshException
at org.apache.sshd.common.session.helpers.AbstractSession.handleMessage(AbstractSession.java:576)
at org.apache.sshd.common.session.helpers.AbstractSession.decode(AbstractSession.java:1542)
at org.apache.sshd.common.session.helpers.AbstractSession.messageReceived(AbstractSession.java:520)
at org.apache.sshd.common.session.helpers.AbstractSessionIoHandler.messageReceived(AbstractSessionIoHandler.java:63)
at org.apache.sshd.common.io.mina.MinaService.messageReceived(MinaService.java:153)
at org.apache.mina.core.filterchain.DefaultIoFilterChain$TailFilter.messageReceived(DefaultIoFilterChain.java:858)
at org.apache.mina.core.filterchain.DefaultIoFilterChain.callNextMessageReceived(DefaultIoFilterChain.java:542)
at org.apache.mina.core.filterchain.DefaultIoFilterChain.access$1300(DefaultIoFilterChain.java:48)
at org.apache.mina.core.filterchain.DefaultIoFilterChain$EntryImpl$1.messageReceived(DefaultIoFilterChain.java:947)
at org.apache.mina.core.filterchain.IoFilterAdapter.messageReceived(IoFilterAdapter.java:109)
at org.apache.mina.core.filterchain.DefaultIoFilterChain.callNextMessageReceived(DefaultIoFilterChain.java:542)
at org.apache.mina.core.filterchain.DefaultIoFilterChain.fireMessageReceived(DefaultIoFilterChain.java:535)
at org.apache.mina.core.polling.AbstractPollingIoProcessor.read(AbstractPollingIoProcessor.java:703)
at org.apache.mina.core.polling.AbstractPollingIoProcessor.process(AbstractPollingIoProcessor.java:659)
at org.apache.mina.core.polling.AbstractPollingIoProcessor.process(AbstractPollingIoProcessor.java:648)
at org.apache.mina.core.polling.AbstractPollingIoProcessor.access$600(AbstractPollingIoProcessor.java:68)
at org.apache.mina.core.polling.AbstractPollingIoProcessor$Processor.run(AbstractPollingIoProcessor.java:1120)
at org.apache.mina.util.NamePreservingRunnable.run(NamePreservingRunnable.java:64)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Caused by: java.util.ServiceConfigurationError: java.nio.file.spi.FileSystemProvider: Provider com.test.sc.chariot.sshd.filesystem.testFileSystemProvider not found
at java.util.ServiceLoader.fail(Unknown Source)
at java.util.ServiceLoader.access$300(Unknown Source)
at java.util.ServiceLoader$LazyIterator.nextService(Unknown Source)
at java.util.ServiceLoader$LazyIterator.next(Unknown Source)
at java.util.ServiceLoader$1.next(Unknown Source)
at java.nio.file.spi.FileSystemProvider.loadInstalledProviders(Unknown Source)
at java.nio.file.spi.FileSystemProvider.access$000(Unknown Source)
at java.nio.file.spi.FileSystemProvider$1.run(Unknown Source)
at java.nio.file.spi.FileSystemProvider$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.nio.file.spi.FileSystemProvider.installedProviders(Unknown Source)
at java.nio.file.Paths.get(Unknown Source)
at com.test.sc.chariot.sshd.filesystem.testVirtualFileSystemFactory.getUserHomeDir(testVirtualFileSystemFactory.java:69)
at org.apache.sshd.common.file.virtualfs.VirtualFileSystemFactory.computeRootDir(VirtualFileSystemFactory.java:81)
at org.apache.sshd.common.file.virtualfs.VirtualFileSystemFactory.createFileSystem(VirtualFileSystemFactory.java:71)
at org.apache.sshd.server.channel.ChannelSession.prepareCommand(ChannelSession.java:650)
at org.apache.sshd.server.channel.ChannelSession.prepareChannelCommand(ChannelSession.java:585)
at org.apache.sshd.server.channel.ChannelSession.handleSubsystem(ChannelSession.java:581)
at org.apache.sshd.server.channel.ChannelSession.handleInternalRequest(ChannelSession.java:316)
at org.apache.sshd.common.channel.AbstractChannel.handleUnknownChannelRequest(AbstractChannel.java:307)
at org.apache.sshd.common.channel.AbstractChannel.handleChannelRequest(AbstractChannel.java:294)
at org.apache.sshd.common.channel.AbstractChannel.handleRequest(AbstractChannel.java:254)
at org.apache.sshd.common.session.helpers.AbstractConnectionService.channelRequest(AbstractConnectionService.java:528)
at org.apache.sshd.common.session.helpers.AbstractConnectionService.process(AbstractConnectionService.java:339)
at org.apache.sshd.common.session.helpers.AbstractSession.doHandleMessage(AbstractSession.java:626)
at org.apache.sshd.common.session.helpers.AbstractSession.handleMessage(AbstractSession.java:559)
... 20 more
2020-03-06 17:11:06,966 [NioProcessor-2] DEBUG org.apache.sshd.common.session.helpers.SessionTimeoutListener - sessionException(ServerSessionImpl[user1@/127.0.0.1:55119]) RuntimeSshException: null
Мой пом. xml выглядит как
<groupId>com.test.sc.chariot</groupId>
<artifactId>ssh-server</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>jar</packaging>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.2.1.RELEASE</version>
</parent>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter</artifactId>
<version>2.0.6.RELEASE</version>
<exclusions>
<exclusion>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<version>2.0.6.RELEASE</version>
</dependency>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>8</source>
<target>8</target>
</configuration>
</plugin>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<version>2.6</version>
<configuration>
<tarLongFileMode>posix</tarLongFileMode>
<tarLongFileMode>posix</tarLongFileMode>
<descriptors>
<descriptor>assembly/distribution.xml</descriptor>
</descriptors>
</configuration>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
, а manifest.mf выглядит как
Manifest-Version: 1.0
Archiver-Version: Plexus Archiver
Built-By: jarnaiz
Created-By: Apache Maven 3.1.1
Build-Jdk: 1.8.0_71
Main-Class: com.test.sc.chariot.sshd.server.ServerApplication
Любая идея, как включить этот пользовательский провайдер файлов в исполняемый файл.