FirebaseApp with name [DEFAULT] doesn't exist in JAX-RS application (NOT ANDROID)
<p>Don't mark as duplicate. This is a question for Java EE, not Android development.</p>

<p>I'm new to Firebase and I thought I'd give it a try to evaluate it for use in some upcoming development work, but I'm unable to even initialize Firebase.</p>

<p>I followed the tutorial on this page: <a href="https://firebase.google.com/docs/server/setup#initialize_the_sdk" rel="nofollow">Add Firebase to your server</a></p>

<p>I added Firebase to my pom.xml as described, ran an update on Maven to ensure it was added properly and have subclassed Application in the JAX-RS portion of my server like so:</p>

<pre><code>public class HelloFirebaseApp extends Application {
    public HelloFirebaseApp(){
        FirebaseOptions options;
        try {
            options = new FirebaseOptions.Builder()
                    .setServiceAccount(new FileInputStream("Hello Firebase-124jksdjfkl32j5.json"))
                    .build();
            FirebaseApp.initializeApp(options);
            System.out.println("Firebase initialized!");
        } catch (FileNotFoundException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
    }
}
</code></pre>

<p>However, on deployment, I receive the following error:</p>

<pre><code>Caused by: java.lang.IllegalStateException: FirebaseApp name [DEFAULT] already exists!
at com.google.firebase.internal.Preconditions.checkState(Preconditions.java:173)
at com.google.firebase.FirebaseApp.initializeApp(FirebaseApp.java:180)
at com.google.firebase.FirebaseApp.initializeApp(FirebaseApp.java:160)
at me.hello-firebase.HelloFirebaseApp.&lt;init&gt;(HelloFirebaseApp.java:20)
</code></pre>

<p>What's going on here?</p>