Firebase Admin SDK: NoSuchMethodError for setCredential() - java

My application uses the Firebase Admin SDK for Java (recently upgraded from the Firebase Server SDK). It has worked correctly while testing on the local environment, however after deploying it to Google App Engine from Eclipse, the logs are showing this error:
com.google.api.server.spi.SystemService invokeServiceMethod: exception occurred while calling backend method
java.lang.NoSuchMethodError: com.google.firebase.FirebaseOptions$Builder.setCredential(Lcom/google/firebase/auth/FirebaseCredential;)Lcom/google/firebase/FirebaseOptions$Builder;
Can anyone advise? I have checked pom.xml on the server and I can see that the firebase-admin SDK dependency was uploaded successfully:
<dependency>
<groupId>com.google.firebase</groupId>
<artifactId>firebase-admin</artifactId>
<version>5.2.0</version>
</dependency>

You may have to upgrade Firebase version to 4.1.0 or later. com.google.firebase.FirebaseOptions$Builder.setCredential() has been introduced since version 4.1.0.
<dependency>
<groupId>com.google.firebase</groupId>
<artifactId>firebase-admin</artifactId>
<version>4.1.0</version>
</dependency>

I had the same issue on Tomcat 8.0 on a dev machine (Windows 10).
I had just migrated firebase-admin from 4.1.7 version to the latest one (6.11.0), so there was somewhere an old firebase-admin-4.1.7.jar.
Hence that's what I did to fix:
find and delete any copy of firebase-admin-4.1.7.jar from my dev machine (check lib/ folders)
remove webapp from Tomcat Server
Maven Update
Project Clean

Related

Maven plugin compatibility error with newest version of Java

So recently I was given a maven project I need to compile, but there seems to be some compatibility issues with wr04j and the most recent version of Java I have installed on my Mac.
Execution {redacted} of goal ro.isdc.wro4j:wro4j-maven-plugin:1.8.0:run failed: An API incompatibility was encountered while executing ro.isdc.wro4j:wro4j-maven-plugin:1.8.0:run: java.lang.ExceptionInInitializerError: null
Upon further research I found a Java version manager similar to nvm with node. I followed all of the steps I could find to download prior versions of Java hoping to find the one that worked. One issue arrived that caskroom and homebrew don't appear to host versions of Java older than Java11.
Is there something I am missing? I run these lines in my command line
brew tap caskroom/versions
brew search java
The only versions that show up after doing this are
java
java-beta
java11
java6
All of the instructions list versions 6-11 as available. Maybe they were removed? Maybe I'm doing something wrong? Any direction would be much appreciated.
I was unable to find a version of Java before 11 on homebrew other than Java6, but found this fix for anyone receiving the same error.
<plugin> section for wr04j in the pom.xml
<dependencies>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-core</artifactId>
<version>2.18.0</version>
</dependency>
</dependencies>

Appium Java Client Version vs Selenium Version

Can any one please tell me how do I make sure which appium java-client jar version is compatible with which selenium jar version. I have tried a lot of different appium java-client versions and also selenium versions and I faced below issues :-
org.openqa.selenium.remote.RemoteWebElement cannot be cast to io.appium.java_client.android.AndroidElement with java-client 4.1.2 ans selenium 3.9.1
java.lang.NullPointerException with java-client 4.1.0 ans selenium 3.9.1
java.lang.NoSuchMethodError with java-client 6.0.0 ans selenium 3.13.0
java.lang.NoClassDefFoundError with java-client 6.0.0 ans selenium 3.9.1
The list is long.
I have tried a lot of thing and finally it worked for me with Java-client 2.1.0 and selenium version 2.45.0
These are old version and I want to work with newer once.
Is there a way to find out which java-client version works perfectly with which selenium version ?
Is there any link where there is a list of it or something instead of try all permutation and combination?
You can follow the Appium news section to get updates about the concerned dependency for selenium - java.
Example:
To know about the Java - Client 5.0.2 release and to know about it's dependency visit the below link
Java-client-5-0-2
You will find the update like this
Hi You can use the following versions :
<dependencies>
<!-- https://mvnrepository.com/artifact/io.appium/java-client -->
<dependency>
<groupId>io.appium</groupId>
<artifactId>java-client</artifactId>
<version>6.0.0-BETA5</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.seleniumhq.selenium/selenium-server -->
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-server</artifactId>
<version>3.9.1</version>
</dependency>
</dependencies>
Even I had faced such issues, after few permutations the above versions work fine for me.
My guess for this is that You might be having issues with environment. If is not too much inconvenient for You, use latest drivers for both Selenium and Appium.
I wrote in Your previous question You can use for eg. this environment:
Appium java-client (6.1.0)
Appium server (1.6.2)
Selenium java-client (3.13.0)
if You still have issues try with this appium tool, appium-doctor.
Use appium-doctor to verify setting
After installation, we can run appium-doctor to verify settings:
appium-doctor
The green check mark of all settings indicate us that we can start next chapter - execute the existing appium demos from its source.
You can also use the appium-doctor in the appium GUI tool to verify sesstings.
if You don't have it installed:
npm install appium-doctor -g
and then following commands to check your settings
(android)
appium-doctor -- android
(ios)
appium-doctor --ios
Hope this helps,
I got it working with
<dependency>
<groupId>io.appium</groupId>
<artifactId>java-client</artifactId>
<version>4.1.2</version>
</dependency>
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-server</artifactId>
<version>3.1.0</version>
</dependency>
Before that Selenium Server was complaining about one Desired Capability:
waitForQuiescence.
When I run the same tests against my local there was no problem with "waitForQuiscene"
In the Maven-Repository you can see the necessary version of Selenium:
https://mvnrepository.com/artifact/io.appium/java-client/7.1.0

Tomcat: The server encountered an unexpected condition that prevented it from fulfilling the request

I had written a program that counts th times i visited the site. When i press run button there opens new window with this stack trace:
I dont know what to do, beacause i am a newbie for tomcat. Im using Eclipse and tomcat 8.5. I also provide my project tree and web.xml
I hope we`ll find the answer, because i want to continue learning, and for now i stuck on this.
In this case, check the dependencies in the pom.xml file. You may be trying to use too new one for JVM or Server.
for example
JVM 1.8
Tomcat 8.5
Using jackson version 2.12.1 will cause this bug.
<dependency>
<groupId>com.fasterxml.jackson.dataformat</groupId>
<artifactId>jackson-dataformat-xml</artifactId>
<version>2.12.1</version>
</dependency>
But with version 2.9.4 there won't be a problem
<dependency>
<groupId>com.fasterxml.jackson.dataformat</groupId>
<artifactId>jackson-dataformat-xml</artifactId>
<version>2.9.4</version>
</dependency>
However, Good Practice says: Use the latest stable versions whenever possible. So maybe Upgrade server and JVM.

NoSuchMethod error on Google App Engine

My Google App Engine server runs:
The Firebase Admin SDK
Google Cloud Endpoints v2
After updating to Endpoints v2 recently (unsure if related), I have been getting this error on the server while my mobile app:
com.google.api.server.spi.SystemService invokeServiceMethod: exception occurred while calling backend method
java.lang.NoSuchMethodError: com.google.common.base.Preconditions.checkState(ZLjava/lang/String;Ljava/lang/Object;)V
at com.google.firebase.FirebaseApp.checkNotDeleted(FirebaseApp.java:314)
at com.google.firebase.FirebaseApp.getOptions(FirebaseApp.java:260)
at com.google.firebase.auth.FirebaseAuth.<init>(FirebaseAuth.java:74)
at com.google.firebase.auth.FirebaseAuth.<init>(FirebaseAuth.java:61)
at com.google.firebase.auth.FirebaseAuth.<init>(FirebaseAuth.java:52)
at com.google.firebase.auth.FirebaseAuth$FirebaseAuthService.<init>(FirebaseAuth.java:316)
at com.google.firebase.auth.FirebaseAuth.getInstance(FirebaseAuth.java:98)
at com.google.firebase.auth.FirebaseAuth.getInstance(FirebaseAuth.java:85)
at com.project.apis.UserAPI.verifyUserIDToken(MyAPI.java:100)
Can anyone advise? Other reports have suggested updating the Guava dependency in my pom.xml, but I am not even using Guava:
https://github.com/SeleniumHQ/selenium/issues/3880
https://github.com/SeleniumHQ/selenium/issues/3540
This happens when there are 2 incompatible versions of guava in the classpath. Firebase uses one version (v20.0), and the Google App Engine libraries use an older version (v18.0 I believe). You can check the dependency tree using the mvn dependency:tree command, and then add an exclusion rule to the older version.
https://github.com/firebase/firebase-admin-java/issues/50
NoSuchMethodError: While integrating Firebase with app engine app

Build Path Exception using Spring 4.0.2 and eclipse kepler

I have the same problem mentioned at this SO question. I have tried to find the solution every where but could not find one.
Here is information about my environment
OS: Ubuntu 13.10
IDE: eclipse kepler 4.3
Spring version 4.0.2
I have jdk 8 installed on my machine and I am using JRE 1.7 for the project
I do have aspectjweaver dependency in my POM file
<dependency>
<groupId>aspectj</groupId>
<artifactId>aspectjweaver</artifactId>
<version>1.5.4</version>
</dependency>
I can find the class BCException using ctrl+shift+T
Please find the screen shot of my eclipse.

Categories