Cannot invoke "org.apache.spark.sql.SparkSession.read()" because "this.spark" is null

I want to obfuscate only some classes from my code but I face this issue from spark.
Please note spark should not be obfuscated.
HOw to solve this issue, please