lhotari commented on issue #11819: URL: https://github.com/apache/pulsar/issues/11819#issuecomment-2897991838
> We used to use the unshaded Pulsar clients because of this issue but we had to stop doing so once we upgraded to Spring 3.x because there was a conflict with the Jersey HTTP client upgrade that came with Spring upgrade. This is when we forked the Pulsar client and unshaded the Avro from the client. > > I tried it again to see if the issue had been resolved. However, it still seems to be there. The error is a bit obscure and confusing. > > ``` > SpringPulsarOriginalConflictApplicationTests > contextLoads() FAILED > java.lang.LinkageError: ClassCastException: attempting to castjar:file:/home/runner/.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:/home/runner/.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) > at org.apache.pulsar.client.admin.internal.PulsarAdminImpl.<init>(PulsarAdminImpl.java:142) > at org.apache.pulsar.client.admin.internal.PulsarAdminBuilderImpl.build(PulsarAdminBuilderImpl.java:45) > at net.sympower.spring_pulsar_original_conflict.SpringPulsarOriginalConflictApplicationTests.contextLoads(SpringPulsarOriginalConflictApplicationTests.kt:19) > ``` > > Based on some googling and seeing that there are javax/jakarta `.withConfig(httpConfig)` for `ClientBuilder` when I browse `PulsarAdminImpl` with my IDE, I guess that it is still the same problem. > > I created [a repository to demonstrate this issue](https://github.com/tonisojandu-sympower/spring-pulsar-original-conflict) and [here is the error itself](https://github.com/tonisojandu-sympower/spring-pulsar-original-conflict/actions/runs/13051328059/job/36412066651#step:4:2247). > @tonisojandu-sympower I debugged the above issue. It's due to Glassfish version conflict. The resolution to the problem could be to use the unshaded Pulsar client and use the shaded Pulsar Admin client. I tested with your repository after making these changes: ```patch - - /* - To solve: - -java.lang.NoClassDefFoundError: javax/ws/rs/core/Configuration - at org.apache.pulsar.client.admin.internal.PulsarAdminBuilderImpl.build(PulsarAdminBuilderImpl.java:45) - at net.sympower.spring_pulsar_original_conflict.SpringPulsarOriginalConflictApplicationTests.contextLoads(SpringPulsarOriginalConflictApplicationTests.kt:19) - at java.base/java.lang.reflect.Method.invoke(Method.java:568) - at java.base/java.util.ArrayList.forEach(ArrayList.java:1511) - at java.base/java.util.ArrayList.forEach(ArrayList.java:1511) -Caused by: java.lang.ClassNotFoundException: javax.ws.rs.core.Configuration - at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:641) - at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:188) - at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:525) - ... 5 more - */ - implementation("javax.ws.rs:javax.ws.rs-api:2.1.1") } kotlin { @@ -77,9 +57,6 @@ configurations { } else if (requested.name == "pulsar-client" || requested.name == "pulsar-client-all") { // replace pulsar-client and pulsar-client-all with pulsar-client-original useTarget("${requested.group}:pulsar-client-original:${ext["pulsar.version"]}") - } else if (requested.name == "pulsar-client-admin") { - // replace pulsar-client-admin with pulsar-client-admin-original - useTarget("${requested.group}:pulsar-client-admin-original:${ext["pulsar.version"]}") } } } ``` Do you have a chance to test if this would resolve your issue? -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
