Issue 5245 in selenium: getting java.lang.NoClassDefFoundError: org/w3c/dom/ElementTraversal when calling the FirefoxDriver contructor using selenium-java 2.30.0

19 views
Skip to first unread message

sele...@googlecode.com

unread,
Feb 26, 2013, 9:18:37 PM2/26/13
to selenium-develope...@googlegroups.com
Status: New
Owner: ----
Labels: Type-Defect Priority-Medium Status-Untriaged

New issue 5245 by whatarey...@gmail.com: getting
java.lang.NoClassDefFoundError: org/w3c/dom/ElementTraversal when calling
the FirefoxDriver contructor using selenium-java 2.30.0
http://code.google.com/p/selenium/issues/detail?id=5245

Selenium version: selenium-java 2.30.0
OS: Windows 7 Professional 64bit
Browser: Firefox
Browser version: 15.0
JDK: 1.6.0_34

Hi,

After I have upgraded the selenium-java jar from 2.24.1 to 2.30.0,
I am getting the following exception at run-time when my code is calling
the FirefoxDriver constructor:

driver = new FirefoxDriver(firefoxBinary, firefoxProfile);


Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 4.493 sec
<<< FAILURE!
testFF(au.com.mycompany.selenium.SeleniumCommonTest) Time elapsed: 4.43
sec <<< ERROR!
java.lang.NoClassDefFoundError: org/w3c/dom/ElementTraversal
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClassCond(ClassLoader.java:631)
at java.lang.ClassLoader.defineClass(ClassLoader.java:615)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:141)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:283)
at java.net.URLClassLoader.access$000(URLClassLoader.java:58)
at java.net.URLClassLoader$1.run(URLClassLoader.java:197)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
at org.apache.xerces.parsers.AbstractDOMParser.startDocument(Unknown
Source)
at org.apache.xerces.impl.dtd.XMLDTDValidator.startDocument(Unknown Source)
at org.apache.xerces.impl.XMLDocumentScannerImpl.startEntity(Unknown
Source)
at org.apache.xerces.impl.XMLVersionDetector.startDocumentParsing(Unknown
Source)
at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
at org.apache.xerces.parsers.DOMParser.parse(Unknown Source)
at org.apache.xerces.jaxp.DocumentBuilderImpl.parse(Unknown Source)
at javax.xml.parsers.DocumentBuilder.parse(DocumentBuilder.java:208)
at
org.openqa.selenium.firefox.internal.FileExtension.readIdFromInstallRdf(FileExtension.java:97)
at
org.openqa.selenium.firefox.internal.FileExtension.writeTo(FileExtension.java:60)
at
org.openqa.selenium.firefox.internal.ClasspathExtension.writeTo(ClasspathExtension.java:63)
at
org.openqa.selenium.firefox.FirefoxProfile.installExtensions(FirefoxProfile.java:465)
at
org.openqa.selenium.firefox.FirefoxProfile.layoutOnDisk(FirefoxProfile.java:443)
at
org.openqa.selenium.firefox.internal.NewProfileExtensionConnection.start(NewProfileExtensionConnection.java:77)
at
org.openqa.selenium.firefox.FirefoxDriver.startClient(FirefoxDriver.java:244)
at
org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:110)
at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:188)
at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:183)
at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:179)
at
au.com.mycompany.selenium.SeleniumTestParent.setUpFirefoxDriver(SeleniumTestParent.java:70)
at
au.com.mycompany.selenium.SeleniumCommonTest.testFF(SeleniumCommonTest.java:9)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at
org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:45)
at
org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
at
org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:42)
at
org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:20)
at
org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:30)
at org.junit.rules.TestWatcher$1.evaluate(TestWatcher.java:47)
at org.junit.rules.RunRules.evaluate(RunRules.java:18)
at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:263)
at
org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:68)
at
org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:47)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:231)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:60)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:229)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:50)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:222)
at org.junit.runners.ParentRunner.run(ParentRunner.java:300)
at
org.apache.maven.surefire.junit4.JUnit4TestSet.execute(JUnit4TestSet.java:62)
at
org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.executeTestSet(AbstractDirectoryTestSuite.java:140)
at
org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.execute(AbstractDirectoryTestSuite.java:127)
at org.apache.maven.surefire.Surefire.run(Surefire.java:177)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at
org.apache.maven.surefire.booter.SurefireBooter.runSuitesInProcess(SurefireBooter.java:345)
at
org.apache.maven.surefire.booter.SurefireBooter.main(SurefireBooter.java:1009)
Caused by: java.lang.ClassNotFoundException: org.w3c.dom.ElementTraversal
at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
... 65 more



--
You received this message because this project is configured to send all
issue notifications to this address.
You may adjust your notification preferences at:
https://code.google.com/hosting/settings

sele...@googlecode.com

unread,
Feb 27, 2013, 1:00:25 PM2/27/13
to selenium-develope...@googlegroups.com
Updates:
Labels: Lang-Java

Comment #1 on issue 5245 by barancev: getting
java.lang.NoClassDefFoundError: org/w3c/dom/ElementTraversal when calling
the FirefoxDriver contructor using selenium-java 2.30.0
http://code.google.com/p/selenium/issues/detail?id=5245

(No comment was entered for this change.)

sele...@googlecode.com

unread,
Feb 27, 2013, 5:47:49 PM2/27/13
to selenium-develope...@googlegroups.com
Updates:
Status: NeedsClarification

Comment #2 on issue 5245 by barancev: getting
java.lang.NoClassDefFoundError: org/w3c/dom/ElementTraversal when calling
the FirefoxDriver contructor using selenium-java 2.30.0
http://code.google.com/p/selenium/issues/detail?id=5245

What's your full classpath? Do you use selenium-server-standalone? Or
maven? Or any other way to build the classpath for selenium tests?

sele...@googlecode.com

unread,
Feb 27, 2013, 6:28:03 PM2/27/13
to selenium-develope...@googlegroups.com

Comment #3 on issue 5245 by whatarey...@gmail.com: getting
java.lang.NoClassDefFoundError: org/w3c/dom/ElementTraversal when calling
the FirefoxDriver contructor using selenium-java 2.30.0
http://code.google.com/p/selenium/issues/detail?id=5245

I found out that it is the apache poi-ooxml 3.9 jar that I'm using for
processing xlsx files which caused the issue.
When building using Maven, it is pulling in the xml-apis jar 1.0.b2 which
is not compatible with the new selenium version.
My current work around is to exclude the xml-apis jars from the poi
dependency.

Dependency:tree
[INFO] +- org.apache.poi:poi-ooxml:jar:3.9:compile
[INFO] | +- org.apache.poi:poi:jar:3.9:compile
[INFO] | | \- commons-codec:commons-codec:jar:1.5:compile
[INFO] | +- org.apache.poi:poi-ooxml-schemas:jar:3.9:compile
[INFO] | | \- org.apache.xmlbeans:xmlbeans:jar:2.3.0:compile
[INFO] | | \- stax:stax-api:jar:1.0.1:compile
[INFO] | \- dom4j:dom4j:jar:1.6.1:compile
[INFO] | \- xml-apis:xml-apis:jar:1.0.b2:compile

Workaround:
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi-ooxml</artifactId>
<version>3.9</version>
<exclusions>
<exclusion>
<artifactId>xml-apis</artifactId>
<groupId>xml-apis</groupId>
</exclusion>
<exclusion>
<artifactId>xerces</artifactId>
<groupId>xerces</groupId>
</exclusion>
</exclusions>
</dependency>

sele...@googlecode.com

unread,
Feb 27, 2013, 6:47:30 PM2/27/13
to selenium-develope...@googlegroups.com

Comment #4 on issue 5245 by whatarey...@gmail.com: getting

sele...@googlecode.com

unread,
Feb 28, 2013, 1:50:09 AM2/28/13
to selenium-develope...@googlegroups.com
Updates:
Status: Invalid
Labels: -Status-Untriaged

Comment #5 on issue 5245 by barancev: getting
java.lang.NoClassDefFoundError: org/w3c/dom/ElementTraversal when calling
the FirefoxDriver contructor using selenium-java 2.30.0
http://code.google.com/p/selenium/issues/detail?id=5245

Yes, selenium requires xml-apis-1.4.01.jar that is much newer.
Good to know you resolved the issue!

sele...@googlecode.com

unread,
Mar 11, 2013, 7:50:06 PM3/11/13
to selenium-develope...@googlegroups.com

Comment #6 on issue 5245 by navalkgu...@gmail.com: getting
java.lang.NoClassDefFoundError: org/w3c/dom/ElementTraversal when calling
the FirefoxDriver contructor using selenium-java 2.30.0
http://code.google.com/p/selenium/issues/detail?id=5245

Thanks for providing this solution. I was also facing the same issue, now
resolved with including below dependencies to pom.xml:
<dependency>
<groupId>xml-apis</groupId>
<artifactId>xml-apis</artifactId>
<version>1.4.01</version>
</dependency>

<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi-ooxml</artifactId>
<version>3.9</version>
<exclusions>
<exclusion>
<artifactId>xml-apis</artifactId>
<groupId>xml-apis</groupId>
</exclusion>
</exclusions>
</dependency>

sele...@googlecode.com

unread,
Apr 17, 2013, 11:57:44 AM4/17/13
to selenium-develope...@googlegroups.com

Comment #7 on issue 5245 by franck...@gmail.com: getting
java.lang.NoClassDefFoundError: org/w3c/dom/ElementTraversal when calling
the FirefoxDriver contructor using selenium-java 2.30.0
http://code.google.com/p/selenium/issues/detail?id=5245

Seeing the same issue under maven, and looking at the dependency tree,
unless I am missing something, this seems to be a pb with the selenium-java
and driver dependencies.
In the tree below notice that a) the firefox driver (which I am trying to
instantiate) doesn't declare a dependency on xml-apis and b) the selenium
htmlunit driver declares one on xml-apis version 1.3.04.

That version is on my classpath, but I still get the NoClassDefFoundError.
Adding an explicit dependency on xml-apis 1.4.01 solved the problem.

+- org.seleniumhq.selenium:selenium-java:jar:2.31.0:test
| +- org.seleniumhq.selenium:selenium-android-driver:jar:2.31.0:test
| | \- org.seleniumhq.selenium:selenium-remote-driver:jar:2.31.0:test
| | +- cglib:cglib-nodep:jar:2.1_3:test
| | \- org.json:json:jar:20080701:test
| +- org.seleniumhq.selenium:selenium-chrome-driver:jar:2.31.0:test
| +- org.seleniumhq.selenium:selenium-htmlunit-driver:jar:2.31.0:test
| | +- org.seleniumhq.selenium:selenium-api:jar:2.31.0:test
| | \- net.sourceforge.htmlunit:htmlunit:jar:2.11:test
| | +- xalan:xalan:jar:2.7.1:test
| | | \- xalan:serializer:jar:2.7.1:test
| | | \- xml-apis:xml-apis:jar:1.3.04:test
| | +- org.apache.commons:commons-lang3:jar:3.1:test
| | +- net.sourceforge.htmlunit:htmlunit-core-js:jar:2.11:test
| | +- net.sourceforge.nekohtml:nekohtml:jar:1.9.17:test
| | +- net.sourceforge.cssparser:cssparser:jar:0.9.8:test
| | | \- org.w3c.css:sac:jar:1.3:test
| | \- org.eclipse.jetty:jetty-websocket:jar:8.1.7.v20120910:test
| | +- org.eclipse.jetty:jetty-util:jar:8.1.7.v20120910:test
| | +- org.eclipse.jetty:jetty-io:jar:8.1.7.v20120910:test
| | \- org.eclipse.jetty:jetty-http:jar:8.1.7.v20120910:test
| +- org.seleniumhq.selenium:selenium-firefox-driver:jar:2.31.0:test
| | \- org.apache.commons:commons-exec:jar:1.1:test
| +- org.seleniumhq.selenium:selenium-ie-driver:jar:2.31.0:test
| | +- net.java.dev.jna:jna:jar:3.4.0:test
| | \- net.java.dev.jna:platform:jar:3.4.0:test
| +- org.seleniumhq.selenium:selenium-iphone-driver:jar:2.31.0:test
| +- org.seleniumhq.selenium:selenium-safari-driver:jar:2.31.0:test
| +- org.seleniumhq.selenium:selenium-support:jar:2.31.0:test
| \- org.webbitserver:webbit:jar:0.4.14:test
| \- io.netty:netty:jar:3.5.2.Final:test

sele...@googlecode.com

unread,
Aug 18, 2013, 11:07:45 AM8/18/13
to selenium-develope...@googlegroups.com

Comment #8 on issue 5245 by oliinyk....@gmail.com: getting
java.lang.NoClassDefFoundError: org/w3c/dom/ElementTraversal when calling
the FirefoxDriver contructor using selenium-java 2.30.0
http://code.google.com/p/selenium/issues/detail?id=5245

Thank you very much, you are awesome!

sele...@googlecode.com

unread,
May 15, 2014, 9:09:39 AM5/15/14
to selenium-develope...@googlegroups.com

Comment #9 on issue 5245 by clayt...@gmail.com: getting
java.lang.NoClassDefFoundError: org/w3c/dom/ElementTraversal when calling
the FirefoxDriver contructor using selenium-java 2.30.0
http://code.google.com/p/selenium/issues/detail?id=5245

I encountered the same issue and this resolved it. Thanks so much!

sele...@googlecode.com

unread,
Aug 9, 2014, 2:43:07 PM8/9/14
to selenium-develope...@googlegroups.com

Comment #10 on issue 5245 by sriram...@gmail.com: getting
java.lang.NoClassDefFoundError: org/w3c/dom/ElementTraversal when calling
the FirefoxDriver contructor using selenium-java 2.30.0
http://code.google.com/p/selenium/issues/detail?id=5245

I am also encountering this issue. Though I have used the above work around
and commented out all the xml-api's in pom.xml still I am getting the above
error. :(

sele...@googlecode.com

unread,
Aug 14, 2014, 6:04:38 AM8/14/14
to selenium-develope...@googlegroups.com

Comment #11 on issue 5245 by sudheer....@gmail.com: getting
java.lang.NoClassDefFoundError: org/w3c/dom/ElementTraversal when calling
the FirefoxDriver contructor using selenium-java 2.30.0
http://code.google.com/p/selenium/issues/detail?id=5245

If you are using selenium and poi in your project then add below dependency
to pom.xml

<dependency>
<groupId>xml-apis</groupId>
<artifactId>xml-apis</artifactId>
<version>1.4.01</version>
</dependency>

sele...@googlecode.com

unread,
Jan 19, 2015, 4:14:05 PM1/19/15
to selenium-develope...@googlegroups.com

Comment #12 on issue 5245 by kiron...@gmail.com: getting
java.lang.NoClassDefFoundError: org/w3c/dom/ElementTraversal when calling
the FirefoxDriver contructor using selenium-java 2.30.0
https://code.google.com/p/selenium/issues/detail?id=5245

Even for me exclusion of "xml-apis" from "poi-ooxml" worked .thanks a lot
for the posts .very useful highly appreciated.

-Hari Kiran Mutyala

sele...@googlecode.com

unread,
Apr 9, 2015, 9:34:16 AM4/9/15
to selenium-develope...@googlegroups.com

Comment #13 on issue 5245 by rgrth...@gmail.com: getting
java.lang.NoClassDefFoundError: org/w3c/dom/ElementTraversal when calling
the FirefoxDriver contructor using selenium-java 2.30.0
https://code.google.com/p/selenium/issues/detail?id=5245

me too came across the same page, got resolved by your post.
Thanks Lot Guys...!!!
Reply all
Reply to author
Forward
0 new messages