복붙노트

[SPRING] org.openqa.selenium.WebDriverException : 드라이버 서버가 시작되기를 기다리는 시간이 초과되었습니다. 빌드 정보 : 버전 : '알 수 없음', 개정 : '알 수 없음'

SPRING

org.openqa.selenium.WebDriverException : 드라이버 서버가 시작되기를 기다리는 시간이 초과되었습니다. 빌드 정보 : 버전 : '알 수 없음', 개정 : '알 수 없음'

모든 것이 내 컴퓨터에서 작동하는 동안 서버에서 작업하는 프로젝트를 가져올 때 Selenium 및 Chromedriver가 부팅되지 않아 다음 예외가 발생합니다.

2018-08-31 09:16:06,578 ERROR [stderr] (Exec Stream Pumper) /home/app.conf/homebooks2/chromedriver: 1: /home/app.conf/homebooks2/chromedriver: Syntax error: Unterminated quoted string
2018-08-31 09:16:26,570 ERROR [io.undertow.request] (default task-1) UT005023: Exception handling request to /crawlerClass/myCrawler/5922: org.springframework.web.util.NestedServletException: Request processing failed; nested exception is org.openqa.selenium.WebDriverException: Timed out waiting for driver server to start.
Build info: version: 'unknown', revision: 'unknown', time: 'unknown'
System info: host: 'shaula', ip: '127.0.1.1', os.name: 'Linux', os.arch: 'i386', os.version: '3.16.0-44-generic', java.version: '1.8.0_92'
Driver info: driver.version: ChromeDriver
    at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:982)
    at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:872)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:707)
    at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:846)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:790)
    at io.undertow.servlet.handlers.ServletHandler.handleRequest(ServletHandler.java:85)
    at io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:129)
    at org.springframework.web.filter.HiddenHttpMethodFilter.doFilterInternal(HiddenHttpMethodFilter.java:81)
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
    at io.undertow.servlet.core.ManagedFilter.doFilter(ManagedFilter.java:61)
    at io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:131)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:317)
    at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:127)
    at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:91)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331)
    at org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:114)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331)
    at org.springframework.security.web.session.SessionManagementFilter.doFilter(SessionManagementFilter.java:137)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331)
    at org.springframework.security.web.authentication.AnonymousAuthenticationFilter.doFilter(AnonymousAuthenticationFilter.java:111)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331)
    at org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter.doFilter(SecurityContextHolderAwareRequestFilter.java:170)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331)
    at org.springframework.security.web.savedrequest.RequestCacheAwareFilter.doFilter(RequestCacheAwareFilter.java:63)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331)
    at org.springframework.security.web.authentication.AbstractAuthenticationProcessingFilter.doFilter(AbstractAuthenticationProcessingFilter.java:200)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331)
    at org.springframework.security.web.authentication.logout.LogoutFilter.doFilter(LogoutFilter.java:116)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331)
    at org.springframework.security.web.header.HeaderWriterFilter.doFilterInternal(HeaderWriterFilter.java:64)
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331)
    at org.springframework.security.web.context.request.async.WebAsyncManagerIntegrationFilter.doFilterInternal(WebAsyncManagerIntegrationFilter.java:56)
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331)
    at it.myproject.security.web.utils.AjaxConcurrentSessionFilter.doFilter(AjaxConcurrentSessionFilter.java:70)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331)
    at org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:105)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331)
    at org.springframework.security.web.FilterChainProxy.doFilterInternal(FilterChainProxy.java:214)
    at org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:177)
    at org.springframework.security.web.debug.DebugFilter.invokeWithWrappedRequest(DebugFilter.java:90)
    at org.springframework.security.web.debug.DebugFilter.doFilter(DebugFilter.java:77)
    at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:346)
    at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:262)
    at io.undertow.servlet.core.ManagedFilter.doFilter(ManagedFilter.java:61)
    at io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:131)
    at io.undertow.servlet.handlers.FilterHandler.handleRequest(FilterHandler.java:84)
    at io.undertow.servlet.handlers.security.ServletSecurityRoleHandler.handleRequest(ServletSecurityRoleHandler.java:62)
    at io.undertow.servlet.handlers.ServletDispatchingHandler.handleRequest(ServletDispatchingHandler.java:36)
    at org.wildfly.extension.undertow.security.SecurityContextAssociationHandler.handleRequest(SecurityContextAssociationHandler.java:78)
    at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
    at io.undertow.servlet.handlers.security.SSLInformationAssociationHandler.handleRequest(SSLInformationAssociationHandler.java:131)
    at io.undertow.servlet.handlers.security.ServletAuthenticationCallHandler.handleRequest(ServletAuthenticationCallHandler.java:57)
    at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
    at io.undertow.security.handlers.AbstractConfidentialityHandler.handleRequest(AbstractConfidentialityHandler.java:46)
    at io.undertow.servlet.handlers.security.ServletConfidentialityConstraintHandler.handleRequest(ServletConfidentialityConstraintHandler.java:64)
    at io.undertow.security.handlers.AuthenticationMechanismsHandler.handleRequest(AuthenticationMechanismsHandler.java:60)
    at io.undertow.servlet.handlers.security.CachedAuthenticatedSessionHandler.handleRequest(CachedAuthenticatedSessionHandler.java:77)
    at io.undertow.security.handlers.NotificationReceiverHandler.handleRequest(NotificationReceiverHandler.java:50)
    at io.undertow.security.handlers.AbstractSecurityContextAssociationHandler.handleRequest(AbstractSecurityContextAssociationHandler.java:43)
    at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
    at org.wildfly.extension.undertow.security.jacc.JACCContextIdHandler.handleRequest(JACCContextIdHandler.java:61)
    at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
    at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
    at io.undertow.servlet.handlers.ServletInitialHandler.handleFirstRequest(ServletInitialHandler.java:292)
    at io.undertow.servlet.handlers.ServletInitialHandler.access$100(ServletInitialHandler.java:81)
    at io.undertow.servlet.handlers.ServletInitialHandler$2.call(ServletInitialHandler.java:138)
    at io.undertow.servlet.handlers.ServletInitialHandler$2.call(ServletInitialHandler.java:135)
    at io.undertow.servlet.core.ServletRequestContextThreadSetupAction$1.call(ServletRequestContextThreadSetupAction.java:48)
    at io.undertow.servlet.core.ContextClassLoaderSetupAction$1.call(ContextClassLoaderSetupAction.java:43)
    at io.undertow.servlet.api.LegacyThreadSetupActionWrapper$1.call(LegacyThreadSetupActionWrapper.java:44)
    at io.undertow.servlet.api.LegacyThreadSetupActionWrapper$1.call(LegacyThreadSetupActionWrapper.java:44)
    at io.undertow.servlet.api.LegacyThreadSetupActionWrapper$1.call(LegacyThreadSetupActionWrapper.java:44)
    at io.undertow.servlet.api.LegacyThreadSetupActionWrapper$1.call(LegacyThreadSetupActionWrapper.java:44)
    at io.undertow.servlet.api.LegacyThreadSetupActionWrapper$1.call(LegacyThreadSetupActionWrapper.java:44)
    at io.undertow.servlet.api.LegacyThreadSetupActionWrapper$1.call(LegacyThreadSetupActionWrapper.java:44)
    at io.undertow.servlet.handlers.ServletInitialHandler.dispatchRequest(ServletInitialHandler.java:272)
    at io.undertow.servlet.handlers.ServletInitialHandler.access$000(ServletInitialHandler.java:81)
    at io.undertow.servlet.handlers.ServletInitialHandler$1.handleRequest(ServletInitialHandler.java:104)
    at io.undertow.server.Connectors.executeRootHandler(Connectors.java:202)
    at io.undertow.server.HttpServerExchange$1.run(HttpServerExchange.java:805)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    at java.lang.Thread.run(Thread.java:745)
Caused by: org.openqa.selenium.WebDriverException: Timed out waiting for driver server to start.
Build info: version: 'unknown', revision: 'unknown', time: 'unknown'
System info: host: 'shaula', ip: '127.0.1.1', os.name: 'Linux', os.arch: 'i386', os.version: '3.16.0-44-generic', java.version: '1.8.0_92'
Driver info: driver.version: ChromeDriver
    at org.openqa.selenium.remote.service.DriverService.waitUntilAvailable(DriverService.java:193)
    at org.openqa.selenium.remote.service.DriverService.start(DriverService.java:179)
    at org.openqa.selenium.remote.service.DriverCommandExecutor.execute(DriverCommandExecutor.java:79)
    at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:548)
    at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:212)
    at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:130)
    at org.openqa.selenium.chrome.ChromeDriver.<init>(ChromeDriver.java:181)
    at org.openqa.selenium.chrome.ChromeDriver.<init>(ChromeDriver.java:168)
    at org.openqa.selenium.chrome.ChromeDriver.<init>(ChromeDriver.java:157)
    at it.myproject.initCrawler(ImmobiliareItController.java:127)
    at it.myproject$$FastClassBySpringCGLIB$$c2524ba.invoke(<generated>)
    at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:204)
    at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.invokeJoinpoint(CglibAopProxy.java:721)
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:157)
    at org.springframework.aop.framework.adapter.MethodBeforeAdviceInterceptor.invoke(MethodBeforeAdviceInterceptor.java:52)
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
    at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:92)
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
    at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:656)
    at it.myproject$$EnhancerBySpringCGLIB$$a6350cf3.initCrawler(<generated>)
    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.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:205)
    at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:133)
    at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:116)
    at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:827)
    at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:738)
    at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:85)
    at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:963)
    at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:897)
    at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:970)
    ... 84 more
Caused by: org.openqa.selenium.net.UrlChecker$TimeoutException: Timed out waiting for [http://localhost:4668/status] to be available after 20000 ms
    at org.openqa.selenium.net.UrlChecker.waitUntilAvailable(UrlChecker.java:100)
    at org.openqa.selenium.remote.service.DriverService.waitUntilAvailable(DriverService.java:188)
    ... 116 more
Caused by: java.util.concurrent.TimeoutException
    at java.util.concurrent.FutureTask.get(FutureTask.java:205)
    at com.google.common.util.concurrent.SimpleTimeLimiter.callWithTimeout(SimpleTimeLimiter.java:156)
    at org.openqa.selenium.net.UrlChecker.waitUntilAvailable(UrlChecker.java:75)
    ... 117 more

크롤러를 시작하는 사용자는 버튼을 클릭해야합니다. 그런 다음 JavaScript를 사용하여 초기화를 위해 크롤러를 보유하는 특정 클래스의 특정 메소드에 대한 Ajax 호출을 수행합니다.

[...]
public Map initCrawler(Things that I give as input) throws InterruptedException, ApiException, IOException {
    System.setProperty("webdriver.chrome.driver",  BackEndProperties.getProperty("chrome_driver_path") );
    final ChromeOptions chromeOptions = new ChromeOptions();
    //chromeOptions.setBinary("/usr/bin/chromium-browser"); 
    chromeOptions.addArguments("--headless");
    chromeOptions.addArguments("--disable-extensions");
    chromeOptions.addArguments("--disable-gpu");
    chromeOptions.addArguments("--no-sandbox");
    [...]

내가 말했듯이 모든 것이 내 컴퓨터에서는 잘 작동하지만 서버 쪽에서는 작동하지 않습니다. 웹을 검색하면 서버에서 이전 크롬 인스턴스를 업그레이드 하여이 문제를 겪은 사람이 문제를 해결했으며 이것이 내가 한 것 (그리고 최신 ChromeDriver도 다운로드했지만)으로 해결되지 않았다는 것을 이해하는 데 도움이되었습니다. 또한 다른 브라우저가 무언가를 바꿀 수 있는지 확인하기 위해 다른 브라우저를 사용하려고 생각하고있었습니다. 아무도 내가 일할 수있는 단서가 있습니까?

해결법

  1. ==============================

    1.이 오류 메시지는 ...

    이 오류 메시지는 ...

    2018-08-31 09:16:26,570 ERROR [io.undertow.request] (default task-1) UT005023: Exception handling request to /crawlerClass/myCrawler/5922: org.springframework.web.util.NestedServletException: Request processing failed; nested exception is org.openqa.selenium.WebDriverException: Timed out waiting for driver server to start.
    

    ... ChromeDriver가 새로운 WebBrowser, 즉 Chrome 브라우저 세션을 시작하거나 생성 할 수 없음을 의미합니다.

    다음과 같은 이유로 드라이버 서버가 시작되기를 기다리는 시간이 초과되었습니다. 기본 예외는 org.openqa.selenium.WebDriverException입니다.

    따라서 JDK v8u92와 현재 Selenium Client v3.14.0간에 명확한 불일치가 있습니다.

  2. ==============================

    2.비슷한 오류가 발생하는 가능성이 적은 시나리오는 바보 같은 실수입니다.

    비슷한 오류가 발생하는 가능성이 적은 시나리오는 바보 같은 실수입니다.

    phantomjs WebDriver를 사용하고이 오류가 발생하면 실제로 phantomjs.exe에 올바른 경로를 제공하는지 확인해야합니다. 이 오류는 Chromedriver 경로를 지정하고 PhantomJs 드라이버를 인스턴스화 할 때 발생합니다.

  3. ==============================

    3.로그를 파일에 쓰려고 시도한 후 chromedriver를 만들 때이 오류가 발생했습니다.

    로그를 파일에 쓰려고 시도한 후 chromedriver를 만들 때이 오류가 발생했습니다.

    System.setProperty("webdriver.chrome.driver", DriverFactory.getChromeDriverPath())
    System.setProperty("webdriver.chrome.logfile", "${System.getenv('HOME')}/Documents")
    

    이 줄에 오류가 나타납니다.

    WebDriver driver1 = new ChromeDriver()
    

    하지만 파일 이름을 추가하는 것을 잊었습니다. 다음을 수행 한 후 모든 것이 정상으로 돌아 왔습니다.

    System.setProperty("webdriver.chrome.logfile", "${System.getenv('HOME')}/Documents/chromedriver.log")
    
  4. ==============================

    4.JDK와 Selenium 사이에 버전 불일치에 대한 또 다른 측면이 있습니다 .JDK 마이너 버전이 너무 높을 수 있습니다 (예 : JDK 8u201 및 Selenium 3.141.59는 호환되지 않지만 8u192는 작동합니다). JDK 부 버전을 사용중인 Selenium 버전의 릴리스 날짜 이전에 릴리스 된 버전으로 다운 그레이드해야합니다.

    JDK와 Selenium 사이에 버전 불일치에 대한 또 다른 측면이 있습니다 .JDK 마이너 버전이 너무 높을 수 있습니다 (예 : JDK 8u201 및 Selenium 3.141.59는 호환되지 않지만 8u192는 작동합니다). JDK 부 버전을 사용중인 Selenium 버전의 릴리스 날짜 이전에 릴리스 된 버전으로 다운 그레이드해야합니다.

  5. from https://stackoverflow.com/questions/52110521/org-openqa-selenium-webdriverexception-timed-out-waiting-for-driver-server-to-s by cc-by-sa and MIT license