firebase / quickstart-nodejs

Apache License 2.0
896 stars 423 forks source link

UnsupportedClassVersionError #68

Open bijoutrouvaille opened 5 years ago

bijoutrouvaille commented 5 years ago

Running the emulator after firebase setup:emulators:firestore gives the following error:

firebase serve --only firestore                                                                
✔  firestore: started on http://localhost:8080
⚠  firestore: Exception in thread "main"
⚠  firestore: java.lang.UnsupportedClassVersionError: com/google/cloud/datastore/emulator/firestore/CloudFirestore : Unsupported major.minor version 52.0
        at java.lang.ClassLoader.defineClass1(Native Method)
        at java.lang.ClassLoader.defineClass(ClassLoader.java:800)
        at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
        at java.net.URLClassLoader.defineClass(URLClassLoader.java:449)
⚠  firestore:
        at java.net.URLClassLoader.access$100(URLClassLoader.java:71)
        at java.net.URLClassLoader$1.run(URLClassLoader.java:361)
        at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:425)
⚠  firestore:
        at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
        at sun.launcher.LauncherHelper.checkAndLoadMain(LauncherHelper.java:482)
⚠  firestore:

Error: firestore: emulator has exited with code: 1
samtstern commented 5 years ago

@bijoutrouvaille I think this is a Java version compatibility issue. Do you have Java 8 installed on your machine? What do you get when you run java -version?

samtstern commented 5 years ago

cc @ryanpbrewster I am surprised the error is this ugly.

bijoutrouvaille commented 5 years ago

@samtstern You are right on both accounts. I had to update my JDK, which apparently is different from the system Java version. And the error is pretty bad. Not a Java guy. Thanks for the quick help. The emulator is running now.

samtstern commented 5 years ago

@bijoutrouvaille glad it worked!

katowulf commented 4 years ago

Reopening this to address the error message (not useful) and docs (incomplete). Ran into this today. Found that our setup doc doesn't mention which Java dependency--JRE, JSE, JDK, MRE, WTF, or OMG--is needed (okay, I made some of those up).

Last but not least, no error was shown in the console when it failed. Just "Error... exited with code 1" and I had to hunt down the error in firebase-debug.log, which didn't help either.

Furthermore, download for 14 seems broken on the Java site, which exacerbates the issue. image