You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
import org.sendbird.client.ApiClient;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
@Configuration
public class SendbirdConfig {
@Value("${sendbird.api-token}")
private String apiToken;
@Value("${sendbird.application-id}")
private String applicationId;
@Bean
public ApiClient apiClient() {
try {
ApiClient apiClient = org.sendbird.client.Configuration.getDefaultApiClient() // The error is thrown here.
.addDefaultHeader("Api-Token", apiToken);
apiClient.setBasePath("https://api-" + applicationId + ".sendbird.com");
return apiClient;
} catch (Exception e) {
e.printStackTrace();
throw new RuntimeException(e);
}
}
}
And on the app start, it throws NoClassDefFoundError.
Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.sendbird.client.ApiClient]: Factory method 'apiClient' threw exception with message: javax/ws/rs/core/Configuration
at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:178) ~[spring-beans-6.1.11.jar:6.1.11]
at org.springframework.beans.factory.support.ConstructorResolver.instantiate(ConstructorResolver.java:644) ~[spring-beans-6.1.11.jar:6.1.11]
... 33 common frames omitted
Caused by: java.lang.NoClassDefFoundError: javax/ws/rs/core/Configuration
at org.sendbird.client.Configuration.<clinit>(Configuration.java:18) ~[sendbird-platform-sdk-1.0.25.jar:na]
at com.my-app.my-appapi.appSendbird.config.SendbirdConfig.apiClient(SendbirdConfig.java:20) ~[main/:na]
at com.my-app.my-appapi.appSendbird.config.SendbirdConfig$$SpringCGLIB$$0.CGLIB$apiClient$0(<generated>) ~[main/:na]
at com.my-app.my-appapi.appSendbird.config.SendbirdConfig$$SpringCGLIB$$FastClass$$1.invoke(<generated>) ~[main/:na]
at org.springframework.cglib.proxy.MethodProxy.invokeSuper(MethodProxy.java:258) ~[spring-core-6.1.11.jar:6.1.11]
at org.springframework.context.annotation.ConfigurationClassEnhancer$BeanMethodInterceptor.intercept(ConfigurationClassEnhancer.java:348) ~[spring-context-6.1.11.jar:6.1.11]
at com.my-app.my-appapi.appSendbird.config.SendbirdConfig$$SpringCGLIB$$0.apiClient(<generated>) ~[main/:na]
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:na]
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77) ~[na:na]
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:na]
at java.base/java.lang.reflect.Method.invoke(Method.java:568) ~[na:na]
at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:146) ~[spring-beans-6.1.11.jar:6.1.11]
... 34 common frames omitted
Caused by: java.lang.ClassNotFoundException: javax.ws.rs.core.Configuration
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]
... 46 common frames omitted
It seems like it needs javax/ws/rs/core/Configuration class, so I manually added the dependency into build.gradle
Caused by: java.lang.LinkageError: ClassCastException: attempting to castjar:file:/Users/my-mac/.gradle/caches/modules-2/files-2.1/javax.ws.rs/javax.ws.rs-api/2.1.1/d3466bc9321fe84f268a1adb3b90373fc14b0eb5/javax.ws.rs-api-2.1.1.jar!/javax/ws/rs/client/ClientBuilder.class to jar:file:/Users/my-mac/.gradle/caches/modules-2/files-2.1/javax.ws.rs/javax.ws.rs-api/2.1.1/d3466bc9321fe84f268a1adb3b90373fc14b0eb5/javax.ws.rs-api-2.1.1.jar!/javax/ws/rs/client/ClientBuilder.class
at javax.ws.rs.client.ClientBuilder.newBuilder(ClientBuilder.java:81) ~[javax.ws.rs-api-2.1.1.jar:2.1.1]
at org.sendbird.client.ApiClient.buildHttpClient(ApiClient.java:1108) ~[sendbird-platform-sdk-1.0.25.jar:na]
at org.sendbird.client.ApiClient.<init>(ApiClient.java:125) ~[sendbird-platform-sdk-1.0.25.jar:na]
at org.sendbird.client.ApiClient.<init>(ApiClient.java:115) ~[sendbird-platform-sdk-1.0.25.jar:na]
at org.sendbird.client.Configuration.<clinit>(Configuration.java:18) ~[sendbird-platform-sdk-1.0.25.jar:na]
at com.my-app.my-appapi.appSendbird.config.SendbirdConfig.apiClient(SendbirdConfig.java:20) ~[main/:na]
at com.my-app.my-appapi.appSendbird.config.SendbirdConfig$$SpringCGLIB$$0.CGLIB$apiClient$0(<generated>) ~[main/:na]
at com.my-app.my-appapi.appSendbird.config.SendbirdConfig$$SpringCGLIB$$FastClass$$1.invoke(<generated>) ~[main/:na]
at org.springframework.cglib.proxy.MethodProxy.invokeSuper(MethodProxy.java:258) ~[spring-core-6.1.11.jar:6.1.11]
at org.springframework.context.annotation.ConfigurationClassEnhancer$BeanMethodInterceptor.intercept(ConfigurationClassEnhancer.java:348) ~[spring-context-6.1.11.jar:6.1.11]
at com.my-app.my-appapi.appSendbird.config.SendbirdConfig$$SpringCGLIB$$0.apiClient(<generated>) ~[main/:na]
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:na]
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77) ~[na:na]
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:na]
at java.base/java.lang.reflect.Method.invoke(Method.java:568) ~[na:na]
at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:146) ~[spring-beans-6.1.11.jar:6.1.11]
... 34 common frames omitted
I tried some other latest version of the rs-api dependency, but none of them works.
Should I add the dependency manually?
The text was updated successfully, but these errors were encountered:
They say javax. namespace is not supported for SpringBoot 3, which is my project version sadly.
So I made a fatJar using shadowJar to relocate 'jakarta.ws.rs' namespace into 'javax.ws.rs'.
which means some files have to remain in jakarta namespace.
I don't think that I can manually set all the class namespaces one by one, so just gonna call the rest apis manually.
Please comment for any help.
This is the sendbird-related parts of build.gradle
And this is the configuration.
And on the app start, it throws NoClassDefFoundError.
It seems like it needs javax/ws/rs/core/Configuration class, so I manually added the dependency into build.gradle
And then, the error has changed to LinkageError.
I tried some other latest version of the rs-api dependency, but none of them works.
Should I add the dependency manually?
The text was updated successfully, but these errors were encountered: