code4craft/webmagic · critical · IOException
Property ' ' not set!
Error message
Property '%s' not set!
What it means
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.
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")).
Example fix
// before
WebDriverPool pool = new WebDriverPool(); // config lacks phantomjs_exec_path
// after
System.setProperty("phantomjs_exec_path", "/usr/local/bin/phantomjs");
WebDriverPool pool = new WebDriverPool(); Defensive patterns
Strategy: validation
Validate before calling
String path = System.getProperty("phantomjs_exec_path",
System.getenv("PHANTOMJS_EXEC_PATH"));
if (path == null || !new java.io.File(path).canExecute()) {
throw new IllegalStateException("phantomjs_exec_path missing or binary not executable: " + path);
} Try / catch
try {
WebDriver driver = pool.get(url);
} catch (java.io.IOException e) {
if (e.getMessage() != null && e.getMessage().contains("not set!")) {
throw new IllegalStateException("Set phantomjs_exec_path in WebDriverPool config before get()", e);
}
throw e;
} Prevention
- 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
When it happens
Trigger: 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.
Common situations: 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.
Understand the failure class
Background: "is required", "must be set", "missing required field": configuration validation errors across open-source libraries — this error's family across 36 libraries.
Related errors
- wrong proto type map
- Already closed!
- threadNum should be more than one!
- emptySleepTime should be more than zero!
- init cache scheduler error
AI-assisted analysis of code4craft/webmagic@67816a19d6 (2026-09-08).
Data as JSON: /api/errors/549f751fb9406ebb.
Report an issue: GitHub.
Appendix: source
Thrown at webmagic-selenium/src/main/java/us/codecraft/webmagic/downloader/selenium/WebDriverPool.java:90
configFile = System.getProperty("selenuim_config");
}
sConfig.load(new FileReader(configFile));
// Prepare capabilities
sCaps = new DesiredCapabilities();
sCaps.setCapability("takesScreenshot", false);
String driver = sConfig.getProperty("driver", DRIVER_PHANTOMJS);
// Fetch PhantomJS-specific configuration parameters
if (driver.equals(DRIVER_PHANTOMJS)) {
// "phantomjs_exec_path"
if (sConfig.getProperty("phantomjs_exec_path") != null) {
sCaps.setCapability(
PhantomJSDriverService.PHANTOMJS_EXECUTABLE_PATH_PROPERTY,
sConfig.getProperty("phantomjs_exec_path"));
} else {
throw new IOException(
String.format(
"Property '%s' not set!",
PhantomJSDriverService.PHANTOMJS_EXECUTABLE_PATH_PROPERTY));
}
// "phantomjs_driver_path"
if (sConfig.getProperty("phantomjs_driver_path") != null) {
System.out.println("Test will use an external GhostDriver");
sCaps.setCapability(
PhantomJSDriverService.PHANTOMJS_GHOSTDRIVER_PATH_PROPERTY,
sConfig.getProperty("phantomjs_driver_path"));
} else {
System.out
.println("Test will use PhantomJS internal GhostDriver");
}
}
// Disable "web-security", enable all possible "ssl-protocols" and
// "ignore-ssl-errors" for PhantomJSDriverView on GitHub (pinned to 67816a19d6)