When handling ADD JAR, Spark constructs a java.io.File first using the input jar path, and then converts it into a URL (here). This works file for local file path without a URL scheme (e.g. /tmp/a.jar). However, java.io.File.toURI returns unexpected result when given a path containing a URL scheme (e.g. file:///tmp/a.jar or hdfs://host:9000/path/to/a.jar):
The consequence is that, although the ADD JAR command doesn't fail immediately, the jar is actually not added properly.