[ 
https://issues.apache.org/jira/browse/KUDU-3768?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18076913#comment-18076913
 ] 

ASF subversion and git services commented on KUDU-3768:
-------------------------------------------------------

Commit 80f39681e127423fa66f8c177be6c05697ac70dd in kudu's branch 
refs/heads/master from Abhishek Chennaka
[ https://gitbox.apache.org/repos/asf?p=kudu.git;h=80f39681e ]

KUDU-3768 Fix service file overwriting in kudu-subprocess JAR

This patch addresses a build issue in the kudu-subprocess module where
Service Provider Interface (SPI) registration files in META-INF/services
were being overwritten during the creation of the Shadow (fat) JAR.

Testing:
- Verified the kudu-subprocess.jar contains StringProvider in its
  MessageBodyReader service file.
- Confirmed the kudu-subprocess no longer throw the below error log:

Mar 31, 2026 8:05:51 PM com.sun.jersey.api.client.ClientResponse getEntity
SEVERE: A message body reader for Java class java.lang.String, and Java type 
class java.lang.String, and MIME media type application/octet-stream was not 
found
Mar 31, 2026 8:05:51 PM com.sun.jersey.api.client.ClientResponse getEntity
SEVERE: The registered message body readers compatible with the MIME media type 
are:
*/* ->
  com.sun.jersey.json.impl.provider.entity.JSONJAXBElementProvider$General
  com.sun.jersey.json.impl.provider.entity.JSONArrayProvider$General
  com.sun.jersey.json.impl.provider.entity.JSONObjectProvider$General
  com.sun.jersey.json.impl.provider.entity.JSONRootElementProvider$General
  com.sun.jersey.json.impl.provider.entity.JSONListElementProvider$General

The generated jar diffrences:
java %  jar tvf /tmp/kudu-subprocess-new/kudu-subprocess-1.19.0-SNAPSHOT.jar|  
wc -l
   54917
java %  jar tvf /tmp/kudu-subprocess-old/kudu-subprocess-1.19.0-SNAPSHOT.jar|  
wc -l
   54920
java % stat /tmp/kudu-subprocess-new/kudu-subprocess-1.19.0-SNAPSHOT.jar
16777234 10323361 -rw-r--r-- 1 abhishekchennaka wheel 0 92210113 "Apr 26 
13:42:14 2026" "Apr 26 13:42:14 2026" "Apr 26 13:42:14 2026" "Apr 26 13:42:14 
2026" 4096 180104 0 /tmp/kudu-subprocess-new/kudu-subprocess-1.19.0-SNAPSHOT.jar
java % stat /tmp/kudu-subprocess-old/kudu-subprocess-1.19.0-SNAPSHOT.jar
16777234 10328175 -rw-r--r-- 1 abhishekchennaka wheel 0 92208129 "Apr 26 
13:47:05 2026" "Apr 26 13:47:05 2026" "Apr 26 13:47:05 2026" "Apr 26 13:47:05 
2026" 4096 180096 0 /tmp/kudu-subprocess-old/kudu-subprocess-1.19.0-SNAPSHOT.jar

The three missing files in the new jar are below (empty placeholder files):
0 Sun Apr 26 13:42:46 PDT 2026 META-INF/services/
0 Wed May 24 15:46:46 PDT 2017 
META-INF/services/com.sun.jersey.server.impl.model.method.dispatch.ResourceMethodDispatchProvider
0 Wed May 24 15:46:46 PDT 2017 
META-INF/services/com.sun.jersey.spi.container.ContainerResponseFilter

The MessageBodyReader now contains the combined list (jersey-core, jersey-json, 
jersey-client, and others), hence the size difference:
java %  jar tvf /tmp/kudu-subprocess-new/kudu-subprocess-1.19.0-SNAPSHOT.jar|  
grep "META-INF/services/javax.ws.rs.ext.MessageBodyReader"
  5584 Thu Apr 23 23:25:32 PDT 2026 
META-INF/services/javax.ws.rs.ext.MessageBodyReader
java %  jar tvf /tmp/kudu-subprocess-old/kudu-subprocess-1.19.0-SNAPSHOT.jar|  
grep "META-INF/services/javax.ws.rs.ext.MessageBodyReader"
   821 Sat Feb 24 20:49:36 PST 2024 
META-INF/services/javax.ws.rs.ext.MessageBodyReader

Change-Id: I2677acee77a42b63cb697329fd2e1a424415d52c
Reviewed-on: http://gerrit.cloudera.org:8080/24241
Reviewed-by: Zoltan Chovan <[email protected]>
Reviewed-by: Ashwani Raina <[email protected]>
Tested-by: Alexey Serbin <[email protected]>
Reviewed-by: Alexey Serbin <[email protected]>


> Fix SPI Service File Overwriting in kudu-subprocess Shadow JAR
> --------------------------------------------------------------
>
>                 Key: KUDU-3768
>                 URL: https://issues.apache.org/jira/browse/KUDU-3768
>             Project: Kudu
>          Issue Type: Bug
>            Reporter: Abhishek Chennaka
>            Assignee: Abhishek Chennaka
>            Priority: Major
>
> The {{kudu-subprocess}} module's build configuration does not handle Service 
> Provider Interface (SPI) merging correctly after the last gradle upgrade. 
> When multiple dependencies (specifically {{jersey-core}} and 
> {{{}jersey-json{}}}) provide the same registration file at 
> {{{}META-INF/services/javax.ws.rs.ext.MessageBodyReader{}}}, the Shadow 
> plugin's default behavior is to overwrite the file rather than append to it.
> *Root Cause:* In the current build, {{{}jersey-json{}}}'s service file 
> overwrites {{{}jersey-core{}}}'s. As a result, the 
> {{com.sun.jersey.core.impl.provider.entity.StringProvider}} registration is 
> lost. 
> *Symptoms:* When Kudu attempts to refresh policies or roles via the Ranger 
> plugin, the Java subprocess logs the following error and fails to update its 
> policy cache:
> {code:java}
>  com.sun.jersey.api.client.ClientHandlerException: A message body reader for 
> Java class java.lang.String, and Java type class java.lang.String, and MIME 
> media type application/json was not found
>     at 
> com.sun.jersey.api.client.ClientResponse.getEntity(ClientResponse.java:630)
>     ...
> SEVERE: The registered message body readers compatible with the MIME media 
> type are:
> application/json -> 
> com.sun.jersey.json.impl.provider.entity.JSONJAXBElementProvider$App ...
> (Note: StringProvider is missing from this list)
> {code}
> This could prevent the Kudu Master from ever receiving authorized policies 
> from Ranger, leading to {{Not Authorized}} errors (403) for legitimate user 
> requests.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to