Closed
Description
Hi @carlspring
Bug Description
I have been trying to integrate this file system with Apache Mina sshd 2.12.1
. But its failing. Here is the code snippet that I configured.
If I pass the bucket name as plain with out any /
, its throwing error as this.fileStore
is null
and when i passed the bucket with /mybucket/
, it's connecting but giving error as below. I am using org.carlspring.cloud.aws:s3fs-nio:1.0.5
.
Steps To Reproduce
- Setup Apache Mina sshd server with version
2.12.1
. - Integrate with
org.carlspring.cloud.aws:s3fs-nio:1.0.5
. - Create a
FileSystemFactory
like below and integrate with Apache Mina2.12.1
.
sshd.setFileSystemFactory(createFileSystemFactory("mybucket"));
public FileSystemFactory createFileSystemFactory(String bucketName) throws IOException {
Map<String, ?> env = ImmutableMap.<String, Object>builder().put(ACCESS_KEY, "AKIAX***")
.put(SECRET_KEY, "hnBpn****")
.put(REGION,"us-east-1")
.build();
FileSystem fileSystem = FileSystems.newFileSystem(URI.create("s3:///"),
env,
Thread.currentThread()
.getContextClassLoader());
Path bucketPath = fileSystem.getPath(bucketName);
return new VirtualFileSystemFactory(bucketPath);
}
Expected Behavior
Should be able to connect to s3 bucket and list files
Environment
s3fs-nio
version: s3fs-nio:1.0,5- OS: Windows
- JDK: 17
full output of mvn -version (or java -version) Apache Maven 3.9.5 (57804ffe001d7215b5e7bcb531cf83df38f93546) Maven home: C:\Users\rrmahar\Documents\binary\apache-maven-3.9.5 Java version: 17.0.11, vendor: Azul Systems, Inc., runtime: C:\Program Files\Zulu\zulu-17 Default locale: en_IN, platform encoding: Cp1252 OS name: "windows 11", version: "10.0", arch: "amd64", family: "windows" java -version openjdk version "17.0.11" 2024-04-16 LTS OpenJDK Runtime Environment Zulu17.50+20-SA (build 17.0.11+9-LTS) OpenJDK 64-Bit Server VM Zulu17.50+20-SA (build 17.0.11+9-LTS, mixed mode, sharing)
Screenshots
Additional context
Exception 1
-nio2-thread-9] o.a.s.server.session.ServerSessionImpl : exceptionCaught(ServerSessionImpl[rrmahar@/[0:0:0:0:0:0:0:1]:50619])[state=Opened] NullPointerException: Cannot invoke "org.carlspring.cloud.storage.s3fs.S3FileStore.name()" because "this.fileStore" is null
Exception 2
-nio2-thread-6] o.a.s.server.session.ServerSessionImpl : exceptionCaught(ServerSessionImpl[rrmahar@/[0:0:0:0:0:0:0:1]:50662])[state=Opened] UnsupportedOperationException: Not a directory: s3://AKIAXMZ***@s3.amazonaws.com/mybucket/
Proposed Solution
Known Workarounds
Useful Links
Task Relationships
This bug:
- Is caused by:
- Relates to:
- Depends on: