You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by GitBox <gi...@apache.org> on 2019/05/21 08:29:10 UTC

[GitHub] [pulsar] KannarFr opened a new issue #4321: [pulsar functions] import java class conflicts

KannarFr opened a new issue #4321: [pulsar functions] import java class conflicts
URL: https://github.com/apache/pulsar/issues/4321
 
 
   **Describe the bug**
   Add a dedicated JerseyClient dependency on functions throws conflicts during import.
   
   ```
   java.lang.RuntimeException: java.lang.ClassNotFoundException: org.apache.pulsar.functions.runtime.shaded.org.glassfish.jersey.client.JerseyClientBuilder
           at javax.ws.rs.client.ClientBuilder.newBuilder(ClientBuilder.java:110) ~[java-instance.jar:2.4.0-SNAPSHOT]
           at javax.ws.rs.client.ClientBuilder.newClient(ClientBuilder.java:121) ~[java-instance.jar:2.4.0-SNAPSHOT]
           at com.clevercloud.pulsar.util.PulsarRESTAPIUtils.createTenant(PulsarRESTAPIUtils.java:22) ~[pulsar-functions-0.1.0-SNAPSHOT.jar-unpacked/:?]
           at com.clevercloud.pulsar.function.RouteApplicationsAddonsLogs.lambda$publishToUser$0(RouteApplicationsAddonsLogs.java:83) ~[pulsar-functions-0.1.0-SNAPSHOT.jar-unpacked/:?]
           at java.util.concurrent.CompletableFuture.uniExceptionally(CompletableFuture.java:870) ~[?:1.8.0_192]
           at java.util.concurrent.CompletableFuture.uniExceptionallyStage(CompletableFuture.java:884) ~[?:1.8.0_192]
           at java.util.concurrent.CompletableFuture.exceptionally(CompletableFuture.java:2196) ~[?:1.8.0_192]
           at com.clevercloud.pulsar.function.RouteApplicationsAddonsLogs.publishToUser(RouteApplicationsAddonsLogs.java:77) ~[pulsar-functions-0.1.0-SNAPSHOT.jar-unpacked/:?]
           at com.clevercloud.pulsar.function.RouteApplicationsAddonsLogs.lambda$publishToUser$0(RouteApplicationsAddonsLogs.java:88) ~[pulsar-functions-0.1.0-SNAPSHOT.jar-unpacked/:?]
           at java.util.concurrent.CompletableFuture.uniExceptionally(CompletableFuture.java:870) ~[?:1.8.0_192]
           at java.util.concurrent.CompletableFuture.uniExceptionallyStage(CompletableFuture.java:884) ~[?:1.8.0_192]
           at java.util.concurrent.CompletableFuture.exceptionally(CompletableFuture.java:2196) ~[?:1.8.0_192]
           at com.clevercloud.pulsar.function.RouteApplicationsAddonsLogs.publishToUser(RouteApplicationsAddonsLogs.java:77) ~[pulsar-functions-0.1.0-SNAPSHOT.jar-unpacked/:?]
           at com.clevercloud.pulsar.function.RouteApplicationsAddonsLogs.lambda$publishToUser$0(RouteApplicationsAddonsLogs.java:88) ~[pulsar-functions-0.1.0-SNAPSHOT.jar-unpacked/:?]
           at java.util.concurrent.CompletableFuture.uniExceptionally(CompletableFuture.java:870) ~[?:1.8.0_192]
           at java.util.concurrent.CompletableFuture.uniExceptionallyStage(CompletableFuture.java:884) ~[?:1.8.0_192]
           at java.util.concurrent.CompletableFuture.exceptionally(CompletableFuture.java:2196) ~[?:1.8.0_192]
           at com.clevercloud.pulsar.function.RouteApplicationsAddonsLogs.publishToUser(RouteApplicationsAddonsLogs.java:77) ~[pulsar-functions-0.1.0-SNAPSHOT.jar-unpacked/:?]
           at com.clevercloud.pulsar.function.RouteApplicationsAddonsLogs.lambda$publishToUser$0(RouteApplicationsAddonsLogs.java:88) ~[pulsar-functions-0.1.0-SNAPSHOT.jar-unpacked/:?]
           at java.util.concurrent.CompletableFuture.uniExceptionally(CompletableFuture.java:870) [?:1.8.0_192]
           at java.util.concurrent.CompletableFuture.uniExceptionallyStage(CompletableFuture.java:884) [?:1.8.0_192]
           at java.util.concurrent.CompletableFuture.exceptionally(CompletableFuture.java:2196) [?:1.8.0_192]
           at com.clevercloud.pulsar.function.RouteApplicationsAddonsLogs.publishToUser(RouteApplicationsAddonsLogs.java:77) [pulsar-functions-0.1.0-SNAPSHOT.jar-unpacked/:?]
           at com.clevercloud.pulsar.function.RouteApplicationsAddonsLogs.process(RouteApplicationsAddonsLogs.java:56) [pulsar-functions-0.1.0-SNAPSHOT.jar-unpacked/:?]
           at com.clevercloud.pulsar.function.RouteApplicationsAddonsLogs.process(RouteApplicationsAddonsLogs.java:22) [pulsar-functions-0.1.0-SNAPSHOT.jar-unpacked/:?]
           at org.apache.pulsar.functions.instance.JavaInstance.handleMessage(JavaInstance.java:63) [java-instance.jar:2.4.0-SNAPSHOT]
           at org.apache.pulsar.functions.instance.JavaInstanceRunnable.run(JavaInstanceRunnable.java:257) [java-instance.jar:2.4.0-SNAPSHOT]
           at java.lang.Thread.run(Thread.java:748) [?:1.8.0_192]
   Caused by: java.lang.ClassNotFoundException: org.apache.pulsar.functions.runtime.shaded.org.glassfish.jersey.client.JerseyClientBuilder
           at java.net.URLClassLoader.findClass(URLClassLoader.java:382) ~[?:1.8.0_192]
           at java.lang.ClassLoader.loadClass(ClassLoader.java:424) ~[?:1.8.0_192]
           at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:349) ~[?:1.8.0_192]
           at java.lang.ClassLoader.loadClass(ClassLoader.java:357) ~[?:1.8.0_192]
           at java.lang.Class.forName0(Native Method) ~[?:1.8.0_192]
           at java.lang.Class.forName(Class.java:264) ~[?:1.8.0_192]
           at javax.ws.rs.client.FactoryFinder.newInstance(FactoryFinder.java:111) ~[java-instance.jar:2.4.0-SNAPSHOT]
           at javax.ws.rs.client.FactoryFinder.find(FactoryFinder.java:209) ~[java-instance.jar:2.4.0-SNAPSHOT]
           at javax.ws.rs.client.ClientBuilder.newBuilder(ClientBuilder.java:94) ~[java-instance.jar:2.4.0-SNAPSHOT]
           ... 27 more
   ```
   
   `pom.xml` looks like:
   ```
   <dependency>
     <groupId>org.glassfish.jersey.core</groupId>
     <artifactId>jersey-client</artifactId>
     <version>2.28</version>
   </dependency>
   <dependency>
     <groupId>org.glassfish.jersey.inject</groupId>
     <artifactId>jersey-hk2</artifactId>
     <version>2.28</version>
   </dependency>
   ```
   
   And the imports of the function:
   ```
   import javax.ws.rs.client.ClientBuilder;
   import javax.ws.rs.client.Entity;
   import javax.ws.rs.core.MediaType;
   import javax.ws.rs.core.Response;
   
   import org.apache.commons.codec.binary.Base64;
   
   import org.glassfish.jersey.client.authentication.HttpAuthenticationFeature;
   import org.glassfish.jersey.client.ClientConfig;
   import org.glassfish.jersey.logging.LoggingFeature;
   ```
   
   I think it's about reflections on `javax.ws.rs.client.ClientBuilder` when it needs the jerserbuilder. 
   

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services