Discussion:
[selenium-users] java.lang.NoSuchMethodError: com.google.common.base.Preconditions
Manuel Moreno
2018-04-03 19:01:49 UTC
Permalink
Im getting this error.

java.lang.NoSuchMethodError: com.google.common.base.Preconditions.checkState(ZLjava/lang/String;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;)V
at org.openqa.selenium.remote.service.DriverService.findExecutable(DriverService.java:124)
at org.openqa.selenium.chrome.ChromeDriverService.access$000(ChromeDriverService.java:32)
at org.openqa.selenium.chrome.ChromeDriverService$Builder.findDefaultExecutable(ChromeDriverService.java:137)
at org.openqa.selenium.remote.service.DriverService$Builder.build(DriverService.java:339)
at org.openqa.selenium.chrome.ChromeDriverService.createDefaultService(ChromeDriverService.java:88)
at org.openqa.selenium.chrome.ChromeDriver.<init>(ChromeDriver.java:123)


Im building a bot for social media , so Im using Selenium libraries, and
the bot works fine on a Java Application , but when I copy the code to a
Web Application where I have a Servlet listening to my Android application
, when I run the servlet , and the servlet calls the code of the bot that
use Selenium, it throws that error when it comes to that line.

System.setProperty("webdriver.chrome.driver", "C:\\Users\\manue\\OneDrive\\Escritorio\\chromedriver.exe");
driver = new ChromeDriver();


I had read that it can be becouse of the version of guava that I have , but
my version of guava is updated and I have tried all versions , and I dont
know why Im getting this error.

In my maven pom.xml I have the dependencies like this:

<dependency>
<groupId>javax</groupId>
<artifactId>javaee-web-api</artifactId>
<version>7.0</version>
<scope>provided</scope>
</dependency>
<!-- https://mvnrepository.com/artifact/org.seleniumhq.selenium/selenium-java -->
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-java</artifactId>
<version>3.10.0</version>
</dependency>

All help is welcome and Thanks in advice.
--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to selenium-users+***@googlegroups.com.
To post to this group, send email to selenium-***@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/5f3fe45d-a41c-45f0-af0e-5dcee40497ec%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Krishnan Mahadevan
2018-04-04 02:48:45 UTC
Permalink
What do you use to serve your web application ? Tomcat ? Perhaps you might want to check if there are any libraries that are being exposed by Tomcat via its lib folder, that is causing the confusion?



The fact that it works fine as a standalone java application, indicates that your project doesn’t have any problem.



The fact that it crashes when run as a servlet indicates that the problem is maybe in your web server’s lib.



Thanks & Regards

Krishnan Mahadevan



"All the desirable things in life are either illegal, expensive, fattening or in love with someone else!"

My Scribblings @ http://wakened-cognition.blogspot.com/

My Technical Scribbings @ http://rationaleemotions.wordpress.com/

Reply-To: <selenium-***@googlegroups.com>
Date: Wednesday, April 4, 2018 at 8:14 AM
To: Selenium Users <selenium-***@googlegroups.com>
Subject: [selenium-users] java.lang.NoSuchMethodError: com.google.common.base.Preconditions



Im getting this error.



java.lang.NoSuchMethodError: com.google.common.base.Preconditions.checkState(ZLjava/lang/String;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;)V
at org.openqa.selenium.remote.service.DriverService.findExecutable(DriverService.java:124)
at org.openqa.selenium.chrome.ChromeDriverService.access$000(ChromeDriverService.java:32)
at org.openqa.selenium.chrome.ChromeDriverService$Builder.findDefaultExecutable(ChromeDriverService.java:137)
at org.openqa.selenium.remote.service.DriverService$Builder.build(DriverService.java:339)
at org.openqa.selenium.chrome.ChromeDriverService.createDefaultService(ChromeDriverService.java:88)
at org.openqa.selenium.chrome.ChromeDriver.<init>(ChromeDriver.java:123)

Im building a bot for social media , so Im using Selenium libraries, and the bot works fine on a Java Application , but when I copy the code to a Web Application where I have a Servlet listening to my Android application , when I run the servlet , and the servlet calls the code of the bot that use Selenium, it throws that error when it comes to that line.



System.setProperty("webdriver.chrome.driver", "C:\\Users\\manue\\OneDrive\\Escritorio\\chromedriver.exe");
driver = new ChromeDriver();


I had read that it can be becouse of the version of guava that I have , but my version of guava is updated and I have tried all versions , and I dont know why Im getting this error.

In my maven pom.xml I have the dependencies like this:
<dependency>
        <groupId>javax</groupId>
        <artifactId>javaee-web-api</artifactId>
        <version>7.0</version>
        <scope>provided</scope>
    </dependency>
    <!-- https://mvnrepository.com/artifact/org.seleniumhq.selenium/selenium-java -->
    <dependency>
        <groupId>org.seleniumhq.selenium</groupId>
        <artifactId>selenium-java</artifactId>
        <version>3.10.0</version>
    </dependency>
All help is welcome and Thanks in advice.
--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to selenium-users+***@googlegroups.com.
To post to this group, send email to selenium-***@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/5f3fe45d-a41c-45f0-af0e-5dcee40497ec%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to selenium-users+***@googlegroups.com.
To post to this group, send email to selenium-***@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/6F377A86-D45F-4ACB-AA3D-AF7961C8F8F4%40gmail.com.
For more options, visit https://groups.google.com/d/optout.
Manuel Moreno
2018-04-12 09:23:39 UTC
Permalink
Hi Krishnan Mahadevan , thanks for your reply , I am using a glassfish
server to run the servlet, while cheking the meta-inf folder of the server
all the libraries were correct , I m going to change the glassfish server
for a Tomcat server. I will tell you something when I change it.
Post by Krishnan Mahadevan
What do you use to serve your web application ? Tomcat ? Perhaps you might
want to check if there are any libraries that are being exposed by Tomcat
via its lib folder, that is causing the confusion?
The fact that it works fine as a standalone java application, indicates
that your project doesn’t have any problem.
The fact that it crashes when run as a servlet indicates that the problem
is maybe in your web server’s lib.
Thanks & Regards
Krishnan Mahadevan
"All the desirable things in life are either illegal, expensive, fattening
or in love with someone else!"
*Date: *Wednesday, April 4, 2018 at 8:14 AM
com.google.common.base.Preconditions
Im getting this error.
java.lang.NoSuchMethodError: com.google.common.base.Preconditions.checkState(ZLjava/lang/String;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;)V
at org.openqa.selenium.remote.service.DriverService.findExecutable(DriverService.java:124)
at org.openqa.selenium.chrome.ChromeDriverService.access$000(ChromeDriverService.java:32)
at org.openqa.selenium.chrome.ChromeDriverService$Builder.findDefaultExecutable(ChromeDriverService.java:137)
at org.openqa.selenium.remote.service.DriverService$Builder.build(DriverService.java:339)
at org.openqa.selenium.chrome.ChromeDriverService.createDefaultService(ChromeDriverService.java:88)
at org.openqa.selenium.chrome.ChromeDriver.<init>(ChromeDriver.java:123)
Im building a bot for social media , so Im using Selenium libraries, and
the bot works fine on a Java Application , but when I copy the code to a
Web Application where I have a Servlet listening to my Android application
, when I run the servlet , and the servlet calls the code of the bot that
use Selenium, it throws that error when it comes to that line.
System.setProperty("webdriver.chrome.driver", "C:\\Users\\manue\\OneDrive\\Escritorio\\chromedriver.exe");
driver = new ChromeDriver();
I had read that it can be becouse of the version of guava that I have ,
but my version of guava is updated and I have tried all versions , and I
dont know why Im getting this error.
<dependency>
<groupId>javax</groupId>
<artifactId>javaee-web-api</artifactId>
<version>7.0</version>
<scope>provided</scope>
</dependency>
<!-- https://mvnrepository.com/artifact/org.seleniumhq.selenium/selenium-java -->
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-java</artifactId>
<version>3.10.0</version>
</dependency>
All help is welcome and Thanks in advice.
--
You received this message because you are subscribed to the Google Groups
"Selenium Users" group.
To unsubscribe from this group and stop receiving emails from it, send an
<javascript:>.
To view this discussion on the web visit
https://groups.google.com/d/msgid/selenium-users/5f3fe45d-a41c-45f0-af0e-5dcee40497ec%40googlegroups.com
<https://groups.google.com/d/msgid/selenium-users/5f3fe45d-a41c-45f0-af0e-5dcee40497ec%40googlegroups.com?utm_medium=email&utm_source=footer>
.
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to selenium-users+***@googlegroups.com.
To post to this group, send email to selenium-***@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/11f2be77-fb94-46d4-94db-69d6361f352b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Loading...