美文网首页我爱编程
Hadoop-common 与 spring-boot-star

Hadoop-common 与 spring-boot-star

作者: MoneyAndLucky | 来源:发表于2017-12-28 15:54 被阅读500次

    一个spring web项目引用了hadoop-common后启动会抛异常:java.lang.ClassNotFoundException: javax.servlet.jsp.JspFactory

    java.lang.NoClassDefFoundError: javax/servlet/jsp/JspFactory at java.lang.ClassLoader.defineClass1(Native Method) ~[?:1.8.0_152] at java.lang.ClassLoader.defineClass(ClassLoader.java:763) ~[?:1.8.0_152] at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142) ~[?:1.8.0_152] at java.net.URLClassLoader.defineClass(URLClassLoader.java:467) ~[?:1.8.0_152] at java.net.URLClassLoader.access$100(URLClassLoader.java:73) ~[?:1.8.0_152] at java.net.URLClassLoader$1.run(URLClassLoader.java:368) ~[?:1.8.0_152] at java.net.URLClassLoader$1.run(URLClassLoader.java:362) ~[?:1.8.0_152] at java.security.AccessController.doPrivileged(Native Method) ~[?:1.8.0_152] at java.net.URLClassLoader.findClass(URLClassLoader.java:361) ~[?:1.8.0_152] at java.lang.ClassLoader.loadClass(ClassLoader.java:424) ~[?:1.8.0_152] at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:338) ~[?:1.8.0_152] at java.lang.ClassLoader.loadClass(ClassLoader.java:357) ~[?:1.8.0_152] at org.apache.jasper.compiler.JspRuntimeContext.(JspRuntimeContext.java:74) ~[jasper-compiler-5.5.23.jar:?] at org.apache.jasper.servlet.JspServlet.init(JspServlet.java:100) ~[jasper-compiler-5.5.23.jar:?] at org.apache.catalina.core.StandardWrapper.initServlet(StandardWrapper.java:1183) [tomcat-embed-core-8.5.23.jar:8.5.23] at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1099) [tomcat-embed-core-8.5.23.jar:8.5.23] at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:989) [tomcat-embed-core-8.5.23.jar:8.5.23] at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:4931) [tomcat-embed-core-8.5.23.jar:8.5.23] at org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedContext.deferredLoadOnStartup(TomcatEmbeddedContext.java:78) [spring-boot-1.5.9.RELEASE.jar:1.5.9.RELEASE] at org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedServletContainer.startConnector(TomcatEmbeddedServletContainer.java:273) [spring-boot-1.5.9.RELEASE.jar:1.5.9.RELEASE] at org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedServletContainer.start(TomcatEmbeddedServletContainer.java:196) [spring-boot-1.5.9.RELEASE.jar:1.5.9.RELEASE] at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.startEmbeddedServletContainer(EmbeddedWebApplicationContext.java:297) [spring-boot-1.5.9.RELEASE.jar:1.5.9.RELEASE] at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.finishRefresh(EmbeddedWebApplicationContext.java:145) [spring-boot-1.5.9.RELEASE.jar:1.5.9.RELEASE] at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:546) [spring-context-4.3.13.RELEASE.jar:4.3.13.RELEASE] at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh(EmbeddedWebApplicationContext.java:122) [spring-boot-1.5.9.RELEASE.jar:1.5.9.RELEASE] at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:693) [spring-boot-1.5.9.RELEASE.jar:1.5.9.RELEASE] at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:360) [spring-boot-1.5.9.RELEASE.jar:1.5.9.RELEASE] at org.springframework.boot.SpringApplication.run(SpringApplication.java:303) [spring-boot-1.5.9.RELEASE.jar:1.5.9.RELEASE] at org.springframework.boot.SpringApplication.run(SpringApplication.java:1118) [spring-boot-1.5.9.RELEASE.jar:1.5.9.RELEASE] at org.springframework.boot.SpringApplication.run(SpringApplication.java:1107) [spring-boot-1.5.9.RELEASE.jar:1.5.9.RELEASE] at com.jd.git.cke.ts.AppMain.main(AppMain.java:13) [classes/:?] Caused by: java.lang.ClassNotFoundException: javax.servlet.jsp.JspFactory at java.net.URLClassLoader.findClass(URLClassLoader.java:381) ~[?:1.8.0_152] at java.lang.ClassLoader.loadClass(ClassLoader.java:424) ~[?:1.8.0_152] at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:338) ~[?:1.8.0_152] at java.lang.ClassLoader.loadClass(ClassLoader.java:357) ~[?:1.8.0_152] ... 31 more 2017-12-28 15:47:24.142 ERROR 14218 --- [ main] o.a.c.c.C.[.[.[/] : Servlet [jsp] in web application [] threw load() exception java.lang.ClassNotFoundException: javax.servlet.jsp.JspFactory at java.net.URLClassLoader.findClass(URLClassLoader.java:381) ~[?:1.8.0_152] at java.lang.ClassLoader.loadClass(ClassLoader.java:424) ~[?:1.8.0_152] at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:338) ~[?:1.8.0_152] at java.lang.ClassLoader.loadClass(ClassLoader.java:357) ~[?:1.8.0_152] at java.lang.ClassLoader.defineClass1(Native Method) ~[?:1.8.0_152] at java.lang.ClassLoader.defineClass(ClassLoader.java:763) ~[?:1.8.0_152] at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142) ~[?:1.8.0_152] at java.net.URLClassLoader.defineClass(URLClassLoader.java:467) ~[?:1.8.0_152] at java.net.URLClassLoader.access$100(URLClassLoader.java:73) ~[?:1.8.0_152] at java.net.URLClassLoader$1.run(URLClassLoader.java:368) ~[?:1.8.0_152] at java.net.URLClassLoader$1.run(URLClassLoader.java:362) ~[?:1.8.0_152] at java.security.AccessController.doPrivileged(Native Method) ~[?:1.8.0_152] at java.net.URLClassLoader.findClass(URLClassLoader.java:361) ~[?:1.8.0_152] at java.lang.ClassLoader.loadClass(ClassLoader.java:424) ~[?:1.8.0_152] at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:338) ~[?:1.8.0_152] at java.lang.ClassLoader.loadClass(ClassLoader.java:357) ~[?:1.8.0_152] at org.apache.jasper.compiler.JspRuntimeContext.(JspRuntimeContext.java:74) ~[jasper-compiler-5.5.23.jar:?] at org.apache.jasper.servlet.JspServlet.init(JspServlet.java:100) ~[jasper-compiler-5.5.23.jar:?] at org.apache.catalina.core.StandardWrapper.initServlet(StandardWrapper.java:1183) ~[tomcat-embed-core-8.5.23.jar:8.5.23] at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1099) ~[tomcat-embed-core-8.5.23.jar:8.5.23] at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:989) ~[tomcat-embed-core-8.5.23.jar:8.5.23] at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:4931) [tomcat-embed-core-8.5.23.jar:8.5.23] at org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedContext.deferredLoadOnStartup(TomcatEmbeddedContext.java:78) [spring-boot-1.5.9.RELEASE.jar:1.5.9.RELEASE] at org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedServletContainer.startConnector(TomcatEmbeddedServletContainer.java:273) [spring-boot-1.5.9.RELEASE.jar:1.5.9.RELEASE] at org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedServletContainer.start(TomcatEmbeddedServletContainer.java:196) [spring-boot-1.5.9.RELEASE.jar:1.5.9.RELEASE] at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.startEmbeddedServletContainer(EmbeddedWebApplicationContext.java:297) [spring-boot-1.5.9.RELEASE.jar:1.5.9.RELEASE] at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.finishRefresh(EmbeddedWebApplicationContext.java:145) [spring-boot-1.5.9.RELEASE.jar:1.5.9.RELEASE] at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:546) [spring-context-4.3.13.RELEASE.jar:4.3.13.RELEASE] at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh(EmbeddedWebApplicationContext.java:122) [spring-boot-1.5.9.RELEASE.jar:1.5.9.RELEASE] at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:693) [spring-boot-1.5.9.RELEASE.jar:1.5.9.RELEASE] at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:360) [spring-boot-1.5.9.RELEASE.jar:1.5.9.RELEASE] at org.springframework.boot.SpringApplication.run(SpringApplication.java:303) [spring-boot-1.5.9.RELEASE.jar:1.5.9.RELEASE] at org.springframework.boot.SpringApplication.run(SpringApplication.java:1118) [spring-boot-1.5.9.RELEASE.jar:1.5.9.RELEASE] at org.springframework.boot.SpringApplication.run(SpringApplication.java:1107) [spring-boot-1.5.9.RELEASE.jar:1.5.9.RELEASE] at com.jd.git.cke.ts.AppMain.main(AppMain.java:13) [classes/:?]


    虽然不影响启动和使用,但非常不爽,经查是由于hadoop-common中引用了jasper-compiler jasper-runtime与spring boot中内置的tomcat冲突导致。exclude这两个包即可。(简书怎么粘贴xml?)

    相关文章

      网友评论

        本文标题:Hadoop-common 与 spring-boot-star

        本文链接:https://www.haomeiwen.com/subject/qvrvgxtx.html