Question

I got this weird NoClassDef in logs

java.lang.NoClassDefFoundError: oracle/i18n/util/LocaleMapper

which didn't happen before the March 20. I wonder if this could be related to the recent update here?

Thanks a lot and apologize in advance if this totally has nothing to do with Spring Boot

Comment From: philwebb

That's not much to go on. Is that the only log message that you get? No stacktrace?

I don't think we've changed anything recently that would cause that failure. Do you have a sample application that you can share?

Comment From: hellocomrade

@philwebb Thanks!

Here is the background: I have spring boot 2.0 + jsp. Therefore, I need extend from SpringBootServletInitializer. Last weekend, I noticed its package has been changed from import org.springframework.boot.web.support.SpringBootServletInitializer to import org.springframework.boot.web.servlet.support.SpringBootServletInitializer, which gave me the impression there might be some major changes going on.

Here is the stacktrace. Any advice will be welcome.

java.util.concurrent.ExecutionException: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Tomcat].StandardHost[localhost].TomcatEmbeddedContext[]]
    at java.util.concurrent.FutureTask.report(FutureTask.java:122)
    at java.util.concurrent.FutureTask.get(FutureTask.java:192)
    at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:939)
    at org.apache.catalina.core.StandardHost.startInternal(StandardHost.java:872)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
    at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1419)
    at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1409)
    at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    at java.lang.Thread.run(Thread.java:745)
Caused by: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Tomcat].StandardHost[localhost].TomcatEmbeddedContext[]]
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:167)
    ... 6 common frames omitted
Caused by: java.lang.NoClassDefFoundError: oracle/i18n/util/LocaleMapper
    at oracle.xml.parser.v2.XMLReader.setEncoding(XMLReader.java:980)
    at oracle.xml.parser.v2.XMLReader.checkXMLDecl(XMLReader.java:3284)
    at oracle.xml.parser.v2.XMLReader.pushXMLReader(XMLReader.java:570)
    at oracle.xml.parser.v2.XMLReader.pushXMLReader(XMLReader.java:274)
    at oracle.xml.parser.v2.XMLParser.parse(XMLParser.java:232)
    at org.apache.tomcat.util.digester.Digester.parse(Digester.java:1458)
    at org.apache.tomcat.util.descriptor.tld.TldParser.parse(TldParser.java:76)
    at org.apache.jasper.servlet.TldScanner.parseTld(TldScanner.java:279)
    at org.apache.jasper.servlet.TldScanner$TldScannerCallback.scan(TldScanner.java:313)
    at org.apache.tomcat.util.scan.StandardJarScanner.process(StandardJarScanner.java:342)
    at org.apache.tomcat.util.scan.StandardJarScanner.scan(StandardJarScanner.java:288)
    at org.apache.jasper.servlet.TldScanner.scanJars(TldScanner.java:262)
    at org.apache.jasper.servlet.TldScanner.scan(TldScanner.java:104)
    at org.apache.jasper.servlet.JasperInitializer.onStartup(JasperInitializer.java:101)
    at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5178)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
    ... 6 common frames omitted
Caused by: java.lang.ClassNotFoundException: oracle.i18n.util.LocaleMapper
    at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
    ... 22 common frames omitted

Comment From: wilkinsona

Thanks for the update.

Tomcat is calling javax.xml.parsers.SAXParserFactory.newInstance() to get a SAXParser. It then calls getXMLReader() on that parser to get an XMLReader to use to read the XML that describes a TLD. In your JVM, it's returning an instance of oracle.xml.parser.v2.XMLParser but it depends on oracle.i18n.util.LocaleMapper which isn't on the classpath. This is what's causing the failure.

I don't think this has anything to do with Spring Boot. You need to check your application's dependencies and your JVM's configuration to either provide everything that the Oracle parser needs, or to remove it.

Comment From: hellocomrade

@wilkinsona Thank you for the timely reply!

One more question: does it sound right to you that "oracle.xml.parser.v2.XMLParser" is the right instance for parsing TLD? What would be the default XML Parser for Tomcat?

Comment From: wilkinsona

No, it doesn't sound right. As I said above, Tomcat will use whatever is available via javax.xml.parsers.SAXParserFactory.newInstance(). It's the configuration of your JVM that decides what that is.

Comment From: philwebb

Where is your com.oracle.jdbc:ojdbc7 dependency coming from? It doesn't appear to be in Maven Central. It's likely that that JAR is referencing oracle.xml.parser.v2.XMLParser. I still don't think this is a Spring Boot issue I'm afraid. I think you might be missing a required Oracle JAR (at least this answer appears to suggest as much).

Comment From: philwebb

As a side not, we don't recommend that you use SNAPSHOT versions in production. The current stable release is 1.5.2.RELEASE.

Comment From: wilkinsona

@hellocomrade That's essentially the same stack trace as the one you posted above and doesn't tell us anything new. @philwebb has already provided a link to a Stack Overflow question that should solve your problem. Please stop commenting here as this isn't a Spring Boot problem.

Comment From: hellocomrade

@wilkinsona Sure thing, thank you for the reply!

Comment From: just2evil

I know this is closed, but I thought I would post a comment on this. Oracle created a maven repository the public are allowed to use, but that installs "xmlparserv2" and this crashes tomcat. If you are using the maven.oracle.com repository then you will need to exclude this file. If you intend to use the OJDBC drivers from that repo.

Comment From: AshwikRaoAlladi

java.util.concurrent.ExecutionException: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Tomcat].StandardHost[localhost].TomcatEmbeddedContext[]]
    at java.util.concurrent.FutureTask.report(FutureTask.java:122)
    at java.util.concurrent.FutureTask.get(FutureTask.java:192)
    at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:939)
    at org.apache.catalina.core.StandardHost.startInternal(StandardHost.java:872)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
    at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1419)
    at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1409)
    at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    at java.lang.Thread.run(Thread.java:745)
Caused by: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Tomcat].StandardHost[localhost].TomcatEmbeddedContext[]]
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:167)
    ... 6 common frames omitted
Caused by: java.lang.NoClassDefFoundError: oracle/i18n/util/LocaleMapper
    at oracle.xml.parser.v2.XMLReader.setEncoding(XMLReader.java:980)
    at oracle.xml.parser.v2.XMLReader.checkXMLDecl(XMLReader.java:3284)
    at oracle.xml.parser.v2.XMLReader.pushXMLReader(XMLReader.java:570)
    at oracle.xml.parser.v2.XMLReader.pushXMLReader(XMLReader.java:274)
    at oracle.xml.parser.v2.XMLParser.parse(XMLParser.java:232)
    at org.apache.tomcat.util.digester.Digester.parse(Digester.java:1458)
    at org.apache.tomcat.util.descriptor.tld.TldParser.parse(TldParser.java:76)
    at org.apache.jasper.servlet.TldScanner.parseTld(TldScanner.java:279)
    at org.apache.jasper.servlet.TldScanner$TldScannerCallback.scan(TldScanner.java:313)
    at org.apache.tomcat.util.scan.StandardJarScanner.process(StandardJarScanner.java:342)
    at org.apache.tomcat.util.scan.StandardJarScanner.scan(StandardJarScanner.java:288)
    at org.apache.jasper.servlet.TldScanner.scanJars(TldScanner.java:262)
    at org.apache.jasper.servlet.TldScanner.scan(TldScanner.java:104)
    at org.apache.jasper.servlet.JasperInitializer.onStartup(JasperInitializer.java:101)
    at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5178)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
    ... 6 common frames omitted
Caused by: java.lang.ClassNotFoundException: oracle.i18n.util.LocaleMapper
    at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
    ... 22 common frames omitted

im too getting this error while deploying the war file in tomcat 8.5.28 what's wrong with my application. even i have included all the dependencies in my application. it will be greatful if you provide the solution to me

Comment From: wilkinsona

@AshwikRaoAlladi Please read all of the comments above yours. We've already provided all of the help that we can from a Spring Boot perspective. If you have any further questions, please follow up on Stack Overflow. As mentioned in the guidelines for contributing, we prefer to use GitHub issues only for bugs and enhancements.