The Altair Community is migrating to a new platform to provide a better experience for you. In preparation for the migration, the Altair Community is on read-only mode from October 28 - November 6, 2024. Technical support via cases will continue to work as is. For any urgent requests from Students/Faculty members, please submit the form linked here
Web Services with Custom Extension
We have been working on a custom Druid extension for our processes and everything works in Studio and when run on a Job Agent in RapidMiner Server. However, if we expose a process as a Web Service, it fails to find some classes. The jar for the extension includes the classes in question, so it seems pretty odd. We can see logs where the code for the extension is executing so it is getting that far at least. We also tried dropping a jar in the libs that resolves this class, but it still doesn't find it.
Sep 20 10:06:50 ****** standalone.sh[31845]: Caused by: java.lang.ClassNotFoundException: org.glassfish.jersey.client.JerseyClientBuilder from [Module "deployment.rapidminer-server-9.3.0.ear:main" from Service Module Loader]
# strings /opt/rapidminer/rapidminer-server/rapidminer-server-home/resources/extensions/rmx_druid-1.0.0-all.jar | grep org.glassfish.jersey.client.JerseyClientBuilder
org/glassfish/jersey/client/JerseyClientBuilder$1.class
org/glassfish/jersey/client/JerseyClientBuilder.class
org/glassfish/jersey/client/JerseyClientBuilder$1.classPK
org/glassfish/jersey/client/JerseyClientBuilder.classPK
Tagged:
0
Best Answer
-
MichaelKnopf Employee-RapidMiner, RapidMiner Certified Analyst, RapidMiner Certified Expert, Member Posts: 31 RM Data Scientist@bmatt, thanks for posting the summary! I only have one thing to add: the relocation of the JAX-RS packages alone wasn't enough, since it does not change the logic of the service lookup performed by ClientBuilder.newBuilder() and ClientBuilder.newClient(). Thus, the need for instantiating the Jersey implementation directly.
6
Answers
Changed:
this.client = ClientBuilder.newClient(this.jerseyConfig);
To:
this.client = new JerseyClientBuilder().withConfig(this.jerseyConfig).build();
Added to build.gradle:
shadowJar {
relocate 'javax.ws.rs', 'shadow.javax.ws.rs'
}