Another option would be to detect this case and throw an error saying that both the assembly jar (including Spark) and Spark classes are present, and it's not clear which one to use.