Java EE FirebaseApp name [DEFAULT] already exists
Solved the problem.
The problem was: I've called the connect method everytime a request was incoming.
Solution: Call the connect method only once. (ServletContextListener)
this for the future users, You can check whether the default app is initialized or not like this.
FirebaseApp firebaseApp = null;
List<FirebaseApp> firebaseApps = FirebaseApp.getApps();
if(firebaseApps!=null && !firebaseApps.isEmpty()){
for(FirebaseApp app : firebaseApps){
if(app.getName().equals(FirebaseApp.DEFAULT_APP_NAME))
firebaseApp = app;
}
}
else
firebaseApp = FirebaseApp.initializeApp(options);