Forum Discussion
Custom Libraries in Fabric Notebook Environment
- Anonymous1 year ago
Hi cahenning,
The import fails due to a known limitation in Fabric Notebooks — the Scala REPL doesn't recognize classes from dynamically added JARs at compile time.
As a workaround, you can use reflection to interact with the class or repackage your code as a fat JAR (including all dependencies) and try again. Direct import may not work unless Microsoft updates the REPL classloading behavior.
Regards,
Vinay Pabbu
Hi burakkaragoz,
Thank you for your thorough response.
I've tried adding the jars with the command "spark.sparkContext.addJar("./env/UdsReader-1.1.jar"), but that does not lead to the import working either. I've restarted the notebook session a few times as well. The class path is also definitely correct.
Interestingly, the statement "Class.forName("BingPlacesData.UdsReader.UdsReader")" does not cause an error. I think I have all the dependencies installed, but it's hard for me to know for sure.
Do you have any recommendations on how I can debug this further?
Hi cahenning,
The import fails due to a known limitation in Fabric Notebooks — the Scala REPL doesn't recognize classes from dynamically added JARs at compile time.
As a workaround, you can use reflection to interact with the class or repackage your code as a fat JAR (including all dependencies) and try again. Direct import may not work unless Microsoft updates the REPL classloading behavior.
Regards,
Vinay Pabbu
- cahenning1 year ago
Microsoft Employee
Hi Anonymous , you're right! Thank you so much - using reflection does work.