slackapi / java-slack-sdk

Slack Developer Kit (including Bolt for Java) for any JVM language
https://tools.slack.dev/java-slack-sdk/
MIT License
577 stars 214 forks source link

Class not found using `FilesUploadV2Request.builder()` #1233

Closed myou11 closed 11 months ago

myou11 commented 11 months ago

Reproducible in:

The Slack SDK version

[INFO] \- com.slack.api:slack-api-client:jar:1.35.0:compile
[INFO]    +- com.slack.api:slack-api-model:jar:1.35.0:compile

Java Runtime version

openjdk version "17.0.9" 2023-10-17 LTS
OpenJDK Runtime Environment Corretto-17.0.9.8.1 (build 17.0.9+8-LTS)
OpenJDK 64-Bit Server VM Corretto-17.0.9.8.1 (build 17.0.9+8-LTS, mixed mode, sharing)

OS info

ProductName:    macOS
ProductVersion: 12.6.1
BuildVersion:   21G217
Darwin Kernel Version 21.6.0: Thu Sep 29 20:13:56 PDT 2022; root:xnu-8020.240.7~1/RELEASE_ARM64_T6000

Steps to reproduce:

I tried to do a file upload of a JSON string using the FilesUploadV2Request builder, but there is a ClassNotFoundException with org.glassfish.grizzly.utils.Charsets. I am using the builder below:

FilesUploadV2Request.builder()
    .content(stringifiedJSON)
    .title("test_file")
    .channel(channelId)
    .initialComment("A comment")
    .build();

Is there something I am missing in the client installation that is causing glassfish.grizzly to not be installed?

It works when I use the V1 FilesUploadRequest.builder(). I only decided to switch due to a message logged mentioning V2.

Expected result:

filesUploadV2 should have the necessary dependencies after installing the slack-api-client through maven

Actual result:

java.lang.ClassNotFoundException: org.glassfish.grizzly.utils.Charsets
    at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:641) ~[na:na]
    at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:188) ~[na:na]
    at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:525) ~[na:na]
    at com.slack.api.methods.impl.FilesUploadV2Helper.readUploadFileBytes(FilesUploadV2Helper.java:130) ~[slack-api-client-1.35.0.jar:1.35.0]
    at com.slack.api.methods.impl.FilesUploadV2Helper.uploadFile(FilesUploadV2Helper.java:43) ~[slack-api-client-1.35.0.jar:1.35.0]
    at com.slack.api.methods.impl.MethodsClientImpl.filesUploadV2(MethodsClientImpl.java:2217) ~[slack-api-client-1.35.0.jar:1.35.0]
seratch commented 11 months ago

Hi @myou11, thanks for reporting this issue and we apologize for the inconvenience caused. We will release a patch release with the necessary fix within the next few hours.

seratch commented 11 months ago

v1.35.1 resolves this issue. Please ugprade to the latest patch version!

myou11 commented 11 months ago

it works! Thank you @seratch!