anoopamS commented on code in PR #60135:
URL: https://github.com/apache/spark/pull/60135#discussion_r4595466389


##########
core/src/main/scala/org/apache/spark/status/api/v1/ApiRootResource.scala:
##########
@@ -61,7 +61,18 @@ private[spark] object ApiRootResource {
     val jerseyContext = new 
ServletContextHandler(ServletContextHandler.NO_SESSIONS)
     jerseyContext.setContextPath("/api")
     val holder: ServletHolder = new ServletHolder(classOf[ServletContainer])
-    holder.setInitParameter(ServerProperties.PROVIDER_PACKAGES, 
"org.apache.spark.status.api.v1")
+    // Register the JAX-RS resources explicitly by class name instead of 
scanning
+    // the package. Package scanning (PROVIDER_PACKAGES) relies on the 
classpath
+    // being enumerable from the filesystem, which fails when spark-core is 
loaded
+    // from a non-scannable location (e.g. an OSGi bundle where resources are
+    // exposed as "bundleresource://" URLs, or a shaded/modular classpath). The
+    // root resource ApiRootResource and the JacksonMessageWriter provider are
+    // sufficient; all nested resources are reached via sub-resource locators.
+    holder.setInitParameter(
+      ServerProperties.PROVIDER_CLASSNAMES,
+      Seq(

Review Comment:
   I made the trait private[spark] to avoid committing to a new public API. 
Downstream code outside org.apache.spark packages can
   't implement it. If the committers prefer, it can be marked @DeveloperApi 
instead.



-- 
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]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to