I have to authorize my server to Firebase for the Firebase SDK. But unfortunately I can't read the credentials.json file. I have put my service.json file into my WEB-INF folder.
I have added this to my appengine-web.xml file:
<resource-files>
    <include path="/service.json"/>
</resource-files>
And I am trying to read the file with this code:
FirebaseOptions options = new FirebaseOptions.Builder().setServiceAccount(ServletServletContext.class.getResourceAsStream("/WEB-INF/service.json"))
But when I try to read the file I get a NullPointerException.
This is my whole class:
@Api(
  name = "myApi",
version = "v1",
namespace = @ApiNamespace(
ownerDomain = "backend",
ownerName = "backend",
packagePath=""
  )
)
public class MyEndpoint {
private static final Logger log = Logger.getLogger(MyEndpoint.class.getName());
private String uid;
@ApiMethod(name = "signup")
public MyBean signup(@Named("token")String token)
{
    uid = "empty";
    uid = "init";
    log.info(new File(getClass().getResource("/WEB-INF/service.json").toString()).exists()+"");
    FirebaseOptions options = new FirebaseOptions.Builder()
                .setServiceAccount(getClass().getResourceAsStream("/WEB-INF/service.json"))
                .setDatabaseUrl("url")
                .build();
    FirebaseApp.initializeApp(options);
    uid = "initialized";
    log.severe("initialized");
    FirebaseAuth.getInstance().verifyIdToken(token)
            .addOnSuccessListener(new OnSuccessListener<FirebaseToken>() {
                    @Override
                    public void onSuccess(FirebaseToken decodedToken) {uid = decodedToken.getUid();
                    }
            });
    MyBean b = new MyBean();
    if(!uid.equals(""))
        b.setData(uid);
    // else
    // b.setData("failed");
    return b;
}
}
Thanks in advance for your help.