{"record":{"id":"549f751fb9406ebb","repo":"code4craft/webmagic","slug":"property-s-not-set","errorCode":null,"errorMessage":"Property '%s' not set!","messagePattern":"Property '(.+?)' not set!","errorType":"exception","errorClass":"IOException","httpStatus":null,"severity":"critical","filePath":"webmagic-selenium/src/main/java/us/codecraft/webmagic/downloader/selenium/WebDriverPool.java","lineNumber":90,"sourceCode":"\t\t\tconfigFile = System.getProperty(\"selenuim_config\");\n\t\t}\n\t\tsConfig.load(new FileReader(configFile));\n\n\t\t// Prepare capabilities\n\t\tsCaps = new DesiredCapabilities();\n\t\tsCaps.setCapability(\"takesScreenshot\", false);\n\n\t\tString driver = sConfig.getProperty(\"driver\", DRIVER_PHANTOMJS);\n\n\t\t// Fetch PhantomJS-specific configuration parameters\n\t\tif (driver.equals(DRIVER_PHANTOMJS)) {\n\t\t\t// \"phantomjs_exec_path\"\n\t\t\tif (sConfig.getProperty(\"phantomjs_exec_path\") != null) {\n\t\t\t\tsCaps.setCapability(\n\t\t\t\t\t\tPhantomJSDriverService.PHANTOMJS_EXECUTABLE_PATH_PROPERTY,\n\t\t\t\t\t\tsConfig.getProperty(\"phantomjs_exec_path\"));\n\t\t\t} else {\n\t\t\t\tthrow new IOException(\n\t\t\t\t\t\tString.format(\n\t\t\t\t\t\t\t\t\"Property '%s' not set!\",\n\t\t\t\t\t\t\t\tPhantomJSDriverService.PHANTOMJS_EXECUTABLE_PATH_PROPERTY));\n\t\t\t}\n\t\t\t// \"phantomjs_driver_path\"\n\t\t\tif (sConfig.getProperty(\"phantomjs_driver_path\") != null) {\n\t\t\t\tSystem.out.println(\"Test will use an external GhostDriver\");\n\t\t\t\tsCaps.setCapability(\n\t\t\t\t\t\tPhantomJSDriverService.PHANTOMJS_GHOSTDRIVER_PATH_PROPERTY,\n\t\t\t\t\t\tsConfig.getProperty(\"phantomjs_driver_path\"));\n\t\t\t} else {\n\t\t\t\tSystem.out\n\t\t\t\t\t\t.println(\"Test will use PhantomJS internal GhostDriver\");\n\t\t\t}\n\t\t}\n\n\t\t// Disable \"web-security\", enable all possible \"ssl-protocols\" and\n\t\t// \"ignore-ssl-errors\" for PhantomJSDriver","sourceCodeStart":72,"sourceCodeEnd":108,"githubUrl":"https://github.com/code4craft/webmagic/blob/67816a19d68a4fec4657bf1336227e046e251df2/webmagic-selenium/src/main/java/us/codecraft/webmagic/downloader/selenium/WebDriverPool.java#L72-L108","documentation":"WebDriverPool.configure() loads the PhantomJS configuration and requires the property \"phantomjs_exec_path\". When the config Properties object doesn't define it, configure() throws an IOException whose message is \"Property 'phantomjs_exec_path' not set!\" (formatted with PhantomJSDriverService.PHANTOMJS_EXECUTABLE_PATH_PROPERTY). This happens lazily inside get() when the first WebDriver is requested.","triggerScenarios":"Calling WebDriverPool.get() without having set the \"phantomjs_exec_path\" property in the config passed to the pool (or default sConfig file), while using the PhantomJS driver — the pool cannot locate the phantomjs binary.","commonSituations":"Switching from PhantomJS to Chrome/Firefox or vice versa and leaving config properties mismatched; config file not found so defaults load without the property; deploying to a machine where the phantomjs path was configured in an env-specific file that wasn't copied.","solutions":["Set the system/config property before get(): sConfig.setProperty(\"phantomjs_exec_path\", \"/usr/local/bin/phantomjs\") or add it to the webdriver pool's config file.","Install phantomjs at the configured path and confirm the binary is executable.","If not using PhantomJS, switch WebDriverPool to the Chrome/Firefox configuration path so the phantomjs property check is skipped.","Pre-load the property from an environment variable as a fallback (System.getenv(\"PHANTOMJS_PATH\"))."],"exampleFix":"// before\nWebDriverPool pool = new WebDriverPool(); // config lacks phantomjs_exec_path\n// after\nSystem.setProperty(\"phantomjs_exec_path\", \"/usr/local/bin/phantomjs\");\nWebDriverPool pool = new WebDriverPool();","handlingStrategy":"validation","validationCode":"String path = System.getProperty(\"phantomjs_exec_path\",\n        System.getenv(\"PHANTOMJS_EXEC_PATH\"));\nif (path == null || !new java.io.File(path).canExecute()) {\n    throw new IllegalStateException(\"phantomjs_exec_path missing or binary not executable: \" + path);\n}","typeGuard":null,"tryCatchPattern":"try {\n    WebDriver driver = pool.get(url);\n} catch (java.io.IOException e) {\n    if (e.getMessage() != null && e.getMessage().contains(\"not set!\")) {\n        throw new IllegalStateException(\"Set phantomjs_exec_path in WebDriverPool config before get()\", e);\n    }\n    throw e;\n}","preventionTips":["Set phantomjs_exec_path (system property or pool config file) before any get() call","Verify the phantomjs binary exists and is executable in every environment","Warm up the pool at startup so config problems surface immediately","If PhantomJS is deprecated in your stack, use the Chrome/Firefox pool config path instead"],"tags":["java","selenium","phantomjs","configuration"],"backgroundTag":"missing-required-config-field","analyzedSha":"67816a19d68a4fec4657bf1336227e046e251df2","analyzedAt":"2026-09-08T11:15:28.425Z","contentChangedAt":"2026-09-08T11:15:28.425Z","schemaVersion":2},"datasetVersion":"2026-09-16T04:17:20.429Z"}