我有一个jar
文件调用的war
。运行jar
时,它没有问题。
当war
从tomcat部署后,我按下运行按钮,该调用将调用jar
的主类,并引发以下错误
ERROR org.springframework.boot.context.web.ErrorPageFilter - Forwarding to error page from request [/client/runApp] due to exception [com.google.common.base.Preconditions.checkState(ZLjava/lang/String;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;)V]
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:125)
at org.openqa.selenium.chrome.ChromeDriverService.access$000(ChromeDriverService.java:35)
at org.openqa.selenium.chrome.ChromeDriverService$Builder.findDefaultExecutable(ChromeDriverService.java:156)
at org.openqa.selenium.remote.service.DriverService$Builder.build(DriverService.java:346)
at org.openqa.selenium.chrome.ChromeDriverService.createDefaultService(ChromeDriverService.java:91)
at org.openqa.selenium.chrome.ChromeDriver.<init>(ChromeDriver.java:157)
我尝试通过guava
将pom.xml
依赖项包括在内,但没有解决方案。
我尝试在guava
无解决方案中包含gradle.build
依赖项
success8
是检查chromedriver初始化是否成功但在引发该错误之前的检查点。
但是当jar运行时,初始化成功
driverprop.load(new FileInputStream(homepath+"/Config/dbconfig.properties"));
System.out.println(driverprop.getProperty("chromepath")+"****************** Chromepath");
Map<String, Object> prefs = new HashMap<>();
System.out.println("Success1");
//To Turns off multiple download warning
prefs.put("profile.default_content_settings.popups", 0);
System.out.println("Success2");
prefs.put("profile.default_content_setting_values.automatic_downloads", 1);
System.out.println("Success3");
//Turns off download prompt
prefs.put("download.prompt_for_download", false);
System.out.println("Success4");
ChromeOptions options = new ChromeOptions();
System.out.println("Success5");
options.setExperimentalOption("prefs", prefs);
System.out.println("Success6");
// options.addArguments("window-size=1400,800");
// options.addArguments("headless");
System.setProperty("webdriver.chrome.driver", driverprop.getProperty("chromepath"));
System.out.println("Success7");
driver = new ChromeDriver(options);
System.out.println("Success8");