Closed lukeis closed 8 years ago
1) The messages mean your selenium *server* does not contain Opera driver and PhantomJS
driver on the classpath.
2) java.lang.ClassNotFoundException: org.w3c.dom.ElementTraversal means that you use
outdated xml-apis-1.4.01.jar, check your classpath
Reported by barancev
on 2014-07-23 08:28:43
Hmmm...I'm not too sure what you mentioned is the root cause to this problem. I understand
the drivers are not in the classpath, hence, why I mentioned I had to inject it in
pom via maven dependency in which it gets in classpath then clears up...all but htmlunit
driver.
We currently are using this maven dependency (have maven project):
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-server</artifactId>
<version>2.41.0</version>
</dependency>
When you change the version to 2.35, the problem is not there. If you change to any
version later than 2.35, the problem exist. So is the requirement now that you have
to include additional dependencies (the ones not in classpath) in a version > 2.35?
This shouldn't be happening as that test clearly shows something is up when changing
version via maven dependency. Possibly the issue lies with the maven dependency itself:
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-server</artifactId>
<version>2.41.0</version>
</dependency>
as it may be pulling in old stuff like you mentioned. Like I said, no problems occur
using 2.35 but the issues come when increasing version > 2.35 via maven dependency.
BTW, using the maven dependency above (version 2.41) pulls in the following versions:
xml-apis-1.3.04.jar
selenium-htmlunit-driver-2.41.0.jar
It doesn't pull in any PhantomJSDriver or OperaDriver. So possibly this is it? It's
not puling them in in newer versions, hence, is that a new requirement now? It pulled
them in 2.35.
Please clarify?
Reported by majones713
on 2014-07-23 12:51:24
So here are the issues guys as its easy to see now based off your comment:
So we have three issues:
1. They stopped pulling in PhantomJSDriver after maven dependency version 2.35
2. They stopped pulling in OperaDriver after maven dependency version 2.35
3. They are not pulling in correct aml-apis-*.jar after maven dependency version 2.35
These are the problems.
Reported by majones713
on 2014-07-23 13:01:48
Do you start selenium server from a maven project?
Reported by barancev
on 2014-07-23 13:36:13
yes
Reported by majones713
on 2014-07-23 13:38:08
1) Maven artifacts for selenium don't have dependencies on opera and phantomjs drivers,
to avoid circular dependencies (it's a maven restriction). You have to add these deps
manually to your POM file.
Versions before 2.35 did not contain these deps too (see for example http://search.maven.org/remotecontent?filepath=org/seleniumhq/selenium/selenium-java/2.34.0/selenium-java-2.34.0.pom
)
2) Here is a part of mvn dependency:tree output for a project that uses selenium 2.42.2:
[INFO] +- org.seleniumhq.selenium:selenium-java:jar:2.42.2:compile
[INFO] | +- org.seleniumhq.selenium:selenium-chrome-driver:jar:2.42.2:compil
e
[INFO] | | \- org.seleniumhq.selenium:selenium-remote-driver:jar:2.42.2:com
pile
[INFO] | | +- cglib:cglib-nodep:jar:2.1_3:compile
[INFO] | | \- org.json:json:jar:20080701:compile
[INFO] | +- org.seleniumhq.selenium:selenium-htmlunit-driver:jar:2.42.2:comp
ile
[INFO] | | +- net.sourceforge.htmlunit:htmlunit:jar:2.14:compile
[INFO] | | | +- xalan:xalan:jar:2.7.1:compile
[INFO] | | | | \- xalan:serializer:jar:2.7.1:compile
[INFO] | | | +- commons-collections:commons-collections:jar:3.2.1:compile
[INFO] | | | +- org.apache.commons:commons-lang3:jar:3.2.1:compile
[INFO] | | | +- org.apache.httpcomponents:httpmime:jar:4.3.2:compile
[INFO] | | | +- commons-codec:commons-codec:jar:1.9:compile
[INFO] | | | +- net.sourceforge.htmlunit:htmlunit-core-js:jar:2.14:compile
[INFO] | | | +- xerces:xercesImpl:jar:2.11.0:compile
[INFO] | | | | \- xml-apis:xml-apis:jar:1.4.01:compile
Reported by barancev
on 2014-07-23 13:49:48
I think we are getting somewhere, So look at stacktrace where it bombs out
trying to register driver in DefaultDriverSessions class (which is called
eventually when selenium attempts to start remote server):
at org.openqa.selenium.remote.server.DefaultDriverSessions.registerDriver(DefaultDriverSessions.java:86):
private void registerDriver(Capabilities caps, String className) {
try {
registerDriver(caps,
Class.forName(className).asSubclass(WebDriver.class));
} catch (ClassNotFoundException e) {
log.log(Level.INFO, "Unable to register driver with className "
+ className + " - not be able to create due " + e.getMessage(), e);
} catch (NoClassDefFoundError e) {
log.log(Level.WARNING, "Unable to register driver with className
" + className + " - dependency missing due " + e.getMessage(), e);
}
}
In that class its trying to register the below default drivers, hence,
where you see it needs the missing dependencies PhantomJSDriver,
OperaDriver but they don't exist in classpath.
private static Map<Capabilities, String> defaultDrivers = new HashMap<
Capabilities, String>() {{
put(DesiredCapabilities.chrome(),
"org.openqa.selenium.chrome.ChromeDriver");
put(DesiredCapabilities.firefox(),
"org.openqa.selenium.firefox.FirefoxDriver");
put(DesiredCapabilities.htmlUnit(),
"org.openqa.selenium.htmlunit.HtmlUnitDriver");
put(DesiredCapabilities.internetExplorer(),
"org.openqa.selenium.ie.InternetExplorerDriver");
put(DesiredCapabilities.opera(), "com.opera.core.systems.OperaDriver");
put(DesiredCapabilities.safari(),
"org.openqa.selenium.safari.SafariDriver");
put(DesiredCapabilities.iphone(),
"org.openqa.selenium.iphone.IPhoneDriver");
put(DesiredCapabilities.ipad(),
"org.openqa.selenium.iphone.IPhoneDriver");
put(DesiredCapabilities.phantomjs(),
"org.openqa.selenium.phantomjs.PhantomJSDriver");
}};
So basically its forcing you to have that in classpath due to these class
updates. That wasn't like that before. So the issue lies here like I said
in the beginning.
Reported by majones713
on 2014-07-23 14:09:43
So like you said, they were never pulled in before. I can see that and tkx
for the clarity. But this class update is forcing you to have it in
classpath...see what I mean? You can probably see the update on your end
better than I can for comparison purposes. Please see what was changed
here...
On Wed, Jul 23, 2014 at 10:09 AM, Jones Michael <majones713@gmail.com>
wrote:
Reported by majones713
on 2014-07-23 14:13:44
These are just INFO messages that warn you that some browser will be unavailable on
the node because the drivers were not found on the classpath. May be they should be
changes to be more explicit.
Reported by barancev
on 2014-07-23 14:26:57
K...
I just looked at source comparing version 2.35 against 2.36 and yeah I see registerDriver
changed:
2.35
private void registerDriver(Capabilities caps, String className) {
try {
registerDriver(caps, Class.forName(className).asSubclass(WebDriver.class));
} catch (ClassNotFoundException e) {
// OK. Fall through. We just won't be able to create these
} catch (NoClassDefFoundError e) {
// OK. Missing a dependency, which is obviously a Bad Thing
// TODO(simon): Log this!
}
}
2.36
private void registerDriver(Capabilities caps, String className) {
try {
registerDriver(caps, Class.forName(className).asSubclass(WebDriver.class));
} catch (ClassNotFoundException e) {
log.log(Level.INFO, "Unable to register driver with className " + className +
" - not be able to create due " + e.getMessage(), e);
} catch (NoClassDefFoundError e) {
log.log(Level.WARNING, "Unable to register driver with className " + className
+ " - dependency missing due " + e.getMessage(), e);
}
}
So this is exactly when/where it all started. Like you said its WARN/INFO messages
so no real major issue but annoying messages that are giving false/positives.
The only concern now I have is when I DO add the missing dependencies in classpath
the only exception that still remains is:
10:37:33.179 WARN - Unable to register driver with className org.openqa.selenium.htmlunit.HtmlUnitDriver
- dependency missing due org/w3c/dom/ElementTraversal
java.lang.NoClassDefFoundError: org/w3c/dom/ElementTraversal
Tkx for the responses btw. Appreciate that...
Reported by majones713
on 2014-07-23 14:40:51
Run mvn dependency:tree to see where old xml-apis dependency comes from.
Reported by barancev
on 2014-07-23 15:08:22
yeah I now see what's pulling in the older version:
[INFO] com.nbcuni.testframework:test-clovis:jar:1.0.0-SNAPSHOT
[INFO] +- mysql:mysql-connector-java:jar:5.1.30:compile
[INFO] +- com.nbcuni.testframework:test-lib:jar:1.1.0:compile
[INFO] \- com.nbcuni.testframework:test-drivers:jar:1.1.6:compile
[INFO] +- org.mongodb:mongo-java-driver:jar:2.11.4:compile
[INFO] +- com.google.code.gson:gson:jar:1.7.1:compile
[INFO] +- javax.ws.rs:jsr311-api:jar:1.0:compile
[INFO] +- org.jyaml:jyaml:jar:1.3:compile
[INFO] +- xerces:xercesImpl:jar:2.9.1:compile
[INFO] | \- xml-apis:xml-apis:jar:1.3.04:compile
So looks like that issue I need to fix. Thanks for pointing that out :-)
Reported by majones713
on 2014-07-23 22:13:08
Reported by luke.semerau
on 2015-09-17 18:22:42
Originally reported on Google Code with ID 7632
Reported by
majones713
on 2014-07-22 13:24:14