I'm trying to add the Firebase Admin SDK to my Java Web App, but getting the following error on init :
java.lang.NoClassDefFoundError: com/google/firebase/FirebaseOptions
at backend.servlets.Init.contextInitialized(Init.java:33)
I added the Firebase Dependency to my pom.xml file and use the following code to init Firebase : ClassLoader classloader = Thread.currentThread().getContextClassLoader(); InputStream is = classloader.getResourceAsStream("serviceAccount.json");
FirebaseOptions options = null;
try {
options = FirebaseOptions.builder()
.setCredentials(GoogleCredentials.fromStream(is))
.build();
} catch (IOException e) {
e.printStackTrace();
}
FirebaseApp.initializeApp(options);+
Can anyone help me ?