facing this error -> Exception in thread "main" java.lang.NoSuchMethodError: com.google.common.collect.ImmutableMap.of, while trying to run Selenium

19 views Asked by At

I am trying to run Java selenium code from my local machine and my code execution starts from one main class where I am using java reflection API to call test classes and execute those. Now when I am running the test cases from IDE it is working fine, but when I am packaging the project and try running from cud by java -cp command one particular issue is coming which is - " Exception in thread "main" java.lang.NoSuchMethodError: com.google.common.collect.ImmutableMap.of" . I am using WebDriver Manager 5.3.2 and Selenium 4.11

Also guava is excluded in the POM file .

<dependency>
<groupId>io.github.bonigarcia</groupId>
<artifactId>webdrivermanager</artifactId>
<version>5.3.2</version>
<exclusions>
<exclusion>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
</exclusion>
</exclusions>
</dependency>

what is the reason of this issue ? I am packaging the project in jar and also copying all the dependency files inside target folder. still this error is coming while running from cmd.

0

There are 0 answers