0

Let me make this clearer. I've setup my project with Java 8 in Tomcat 8 , firebase-admin library version 5.2.0, JSF 2.2, jersey-json 1.18.1 and Jersey 1.14. Upon server startup I got some error as below:

jul 11, 2017 5:23:47 PM org.apache.catalina.core.StandardContext loadOnStartup
GRAVE: Servlet [Jersey Web Application] in web application [/core-web-app] threw load() exception
java.lang.ArrayIndexOutOfBoundsException: 2560
    at org.objectweb.asm.ClassReader.accept(Unknown Source)
    at org.objectweb.asm.ClassReader.accept(Unknown Source)
    at com.sun.jersey.spi.scanning.AnnotationScannerListener.onProcess(AnnotationScannerListener.java:136)
    at com.sun.jersey.spi.scanning.servlet.WebAppResourcesScanner$2.f(WebAppResourcesScanner.java:104)
    at com.sun.jersey.core.util.Closing.f(Closing.java:71)


I realized that this error takes places when i Have the folowing code in my class:



Task<UserRecord> task = FirebaseAuth.getInstance().createUser(request)
                .addOnSuccessListener(userRecord -> {

                  System.out.println("Successfully created new user: " + userRecord.getUid());
                  try {

                    createLocalAccount(account, userRecord.getUid());

                } catch (Exception exception) {

                    exception.printStackTrace();
                }
                })
                .addOnFailureListener(e -> {
                  System.err.println("Error creating new user: " + e.getMessage());

                });

If the code above is removed no error is displayed in server startup. Is there some conflict between Jersey and Firebase Admin lib ? How could I fix this?

blackjack
  • 1,081
  • 2
  • 13
  • 30

1 Answers1

1

It's unlikely that this was caused by some incompatibility between Firebase and Jersey libraries. At least I'm not aware of such a problem. It seems Jersey did not add Java 8 support until version 1.19. So you might want to upgrade your Jersey version (v1.14 is around 5 years old). You can also try getting rid of the lambdas and any other Java 8 syntax, but it might not fully resolve the problem.

There are similar reports by developers who were having issues getting Java 8 code (specifically lambda's) working with older versions of Jersey. For example: Java 8 Lambda Expression Within REST Service not working

Hiranya Jayathilaka
  • 7,180
  • 1
  • 23
  • 34