shfshihuafeng commented on code in PR #3056: URL: https://github.com/apache/drill/pull/3056#discussion_r3696919575
########## drill-ranger/drill-ranger-plugin/src/main/java/org/glassfish/jersey/media/multipart/MultiPartFeatureAutodiscoverable.java: ########## @@ -0,0 +1,61 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.glassfish.jersey.media.multipart; Review Comment: @pjfanning **Background: Upgrading Ranger to Jersey 2.35 and the Necessity of ClassLoader Isolation** Ranger 2.8.0 默认 uses Jersey 1.x (com.sun.jersey.*), whose package name doesn't overlap with Drill's Jersey 3.1.9 (org.glassfish.jersey.*) — no isolation needed. We upgraded to RangerAdminJersey2RESTClient (Jersey 2.35) to drop the EOL Jersey 1.x and its jersey-bundle fat jar. But Jersey 2.x moved its implementation to org.glassfish.jersey.* — the same package name as Drill's 3.1.9, with a different API namespace (javax.ws.rs.* vs jakarta.ws.rs.*). They cannot coexist on one classpath, so RangerPluginClassLoader isolation is required. This is the trade-off for avoiding Jersey 1.x's legacy baggage. Drill (Jersey 3.1.9, jakarta.ws.rs.*) and Ranger 2.8.0 (Jersey 2.35, javax.ws.rs.*) require two binary-incompatible Jersey versions — isolated via RangerPluginClassLoader. **1.why a shim is needed** RangerPluginClassLoader.getResources() merges the parent's 3.1.9 SPI entry → ServiceFinder loads the 3.1.9 MultiPartFeatureAutodiscoverable → cast to 2.35 ForcedAutoDiscoverable fails → ClassCastException. Since this class does not exist in Jersey 2.x (verified via jar tf), it cannot be pulled from a dependency — the shim is the only way to provide a 2.35-compatible impl with the same FQN(Fully Qualified Name). **2.The shim is safe and scoped to the Ranger plugin only** The shim lives exclusively in the Ranger plugin's isolated directory (jars/ranger-drill-plugin-impl/). It is invisible to Drill's 3.1.9 REST server, so there is no functional risk or unintended side‑effect on Drill's main codebase. Given the above, do you have any concerns about this approach, or any suggestions for further improvements? -- 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]
