You can encounter the following error after upgrading to Spring Boot 1.3.0.M1:
Caused by: java.lang.NoClassDefFoundError: org/w3c/dom/ElementTraversal
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:760)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:455)
at java.net.URLClassLoader.access$100(URLClassLoader.java:73)
at java.net.URLClassLoader$1.run(URLClassLoader.java:367)
at java.net.URLClassLoader$1.run(URLClassLoader.java:361)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:360)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
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 org.apache.ibatis.parsing.XPathParser.createDocument(XPathParser.java:254)
at org.apache.ibatis.parsing.XPathParser.<init>(XPathParser.java:125)
at org.apache.ibatis.builder.xml.XMLConfigBuilder.<init>(XMLConfigBuilder.java:75)
at org.mybatis.spring.SqlSessionFactoryBean.buildSqlSessionFactory(SqlSessionFactoryBean.java:358)
at org.mybatis.spring.SqlSessionFactoryBean.afterPropertiesSet(SqlSessionFactoryBean.java:340)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1637)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1574)
With the hint from StackOverflow and the following command:
gradle dependencies
I can figure out that `xml-apis-1.4.01` has been changed to `xml-apis-1.3.04` as follows:
Before upgrading to Spring Boot 1.3.0.M1:
+--- net.sourceforge.nekohtml:nekohtml:1.9.22
| \--- xerces:xercesImpl:2.11.0
| \--- xml-apis:xml-apis:1.4.01
After upgrading to Spring Boot 1.3.0.M1:
+--- net.sourceforge.nekohtml:nekohtml:1.9.22
| \--- xerces:xercesImpl:2.11.0
| \--- xml-apis:xml-apis:1.4.01 -> 1.3.04
With the following command:
gradle dependencyInsight --dependency xml-apis
you will get the following result:
:dependencyInsight
xml-apis:xml-apis:1.3.04 (selected by rule)
xml-apis:xml-apis:1.4.01 -> 1.3.04
\--- xerces:xercesImpl:2.11.0
\--- net.sourceforge.nekohtml:nekohtml:1.9.22
\--- compile
`spring-boot-dependencies` enforces `1.3.04` as follows:
<xml-apis.version>1.3.04</xml-apis.version>
You can resolve the problem by using `xml-apis:1.4.01` as follows:
compile("xml-apis:xml-apis:1.4.01")
I created a PR to upgrade `xml-apis as follows:
https://github.com/spring-projects/spring-boot/pull/3226
References:
http://stackoverflow.com/questions/10234201/appengine-error-java-lang-noclassdeffounderror-org-w3c-dom-elementtraversal
https://github.com/spring-projects/spring-boot/blob/master/spring-boot-dependencies/pom.xml
No comments:
Post a Comment