Caused by: java.lang.IllegalStateException: The process has not exited yet there

Java wrote a crawler seleuinm+phantomjs and the following error occurs, and Baidu google can't find the problem.

Tested on multiple machines, only two of them could not be started alive or dead 

 

[root@app_test tools]# java -jar t-1.0.jar
February 22, 2017 2:28:30 pm org.openqa.selenium.phantomjs.PhantomJSDriverService <init>
Info: executable: /home/tools/phantomjs-2.1.1-linux-x86_64/bin/phantomjs
February 22, 2017 2:28:30 pm org.openqa.selenium.phantomjs.PhantomJSDriverService <init>
info: port: 65326
February 22, 2017 2:28:30 pm org.openqa.selenium.phantomjs.PhantomJSDriverService <init>
信息: arguments: [--ignore-ssl-errors=true, --ssl-protocol=tlsv1, --cookies-file=test.cookies, --disk-cache=true, --local-to-remote-url-access=true, --web-security=false, --webdriver=65326, --webdriver-logfile=/home/tools/phantomjsdriver.log]
February 22, 2017 2:28:30 pm org.openqa.selenium.phantomjs.PhantomJSDriverService <init>
info: environment: {}
[INFO  - 2017-02-22T06:28:30.928Z] GhostDriver - Main - running on port 65326
org.openqa.selenium.remote.UnreachableBrowserException: Could not start a new session. Possible causes are invalid address of the remote server or browser start-up failure.
Build info: version: 'unknown', revision: 'unknown', time: 'unknown'
System info: host: 'app_test', ip: '127.0.0.1', os.name: 'Linux', os.arch: 'amd64', os.version: '2.6.32-431.el6.x86_64', java.version: '1.8.0_102'
Driver info: driver.version: PhantomJSDriver
	at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:665)
	at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:249)
	at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:131)
	at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:144)
	at org.openqa.selenium.phantomjs.PhantomJSDriver.<init>(PhantomJSDriver.java:116)
	at org.openqa.selenium.phantomjs.PhantomJSDriver.<init>(PhantomJSDriver.java:105)
	at robot.TestSelenium.getPhantomjs(TestSelenium.java:43)
	at robot.TestSelenium.main(TestSelenium.java:49)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.springframework.boot.loader.MainMethodRunner.run(MainMethodRunner.java:48)
	at org.springframework.boot.loader.Launcher.launch(Launcher.java:87)
	at org.springframework.boot.loader.Launcher.launch(Launcher.java:50)
	at org.springframework.boot.loader.JarLauncher.main(JarLauncher.java:51)
Caused by: java.lang.IllegalStateException: The process has not exited yet therefore no result is available ...
	at org.apache.commons.exec.DefaultExecuteResultHandler.getException(DefaultExecuteResultHandler.java:76)
	at org.openqa.selenium.os.UnixProcess.checkForError(UnixProcess.java:171)
	at org.openqa.selenium.os.CommandLine.checkForError(CommandLine.java:185)
	at org.openqa.selenium.remote.service.DriverService.waitUntilAvailable(DriverService.java:177)
	at org.openqa.selenium.remote.service.DriverService.start(DriverService.java:166)
	at org.openqa.selenium.phantomjs.PhantomJSCommandExecutor.execute(PhantomJSCommandExecutor.java:78)
	at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:644)
	... 15 more

 

In the end, it turned out that there was a problem with the hosts file configuration.

If 127.0.0.1 localhost is not defined in host, the above problem will be reported

 

Add localhost 127.0.0.1 relationship

 

 

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=326641382&siteId=291194637