Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Integration with Apache Mina not working #856

Open
rashmimaharana opened this issue Nov 6, 2024 · 2 comments
Open

Integration with Apache Mina not working #856

rashmimaharana opened this issue Nov 6, 2024 · 2 comments
Labels
bug Something isn't working needs triage The issue needs to be triaged, before work can commence

Comments

@rashmimaharana
Copy link

rashmimaharana commented Nov 6, 2024

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

  1. Setup Apache Mina sshd server with version 2.12.1.
  2. Integrate with org.carlspring.cloud.aws:s3fs-nio:1.0.5.
  3. Create a FileSystemFactory like below and integrate with Apache Mina 2.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:

@rashmimaharana rashmimaharana added bug Something isn't working needs triage The issue needs to be triaged, before work can commence labels Nov 6, 2024
@carlspring
Copy link
Owner

Hi @rashmimaharana @SergiyBojko,

Your bug reports seems to be related.

Would you guys be able to provide JUnit test cases for them? Perhaps something with TestContainers?

We would be really happy to receive pull requests with fixes for this as we have limited resources at the moment.

@steve-todorov
Copy link
Collaborator

@rashmimaharana We haven't had a chance to look into this yet. Can you try the code you have with the 1.0.6-SNAPSHOT version which is published in Maven Central Snapshots? There was a bug related to the properties not being passed from the Files.newFileSystem down to the S3FileSystem which could have been related to the problem you are seeing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working needs triage The issue needs to be triaged, before work can commence
Projects
None yet
Development

No branches or pull requests

3 participants