title: JasperException: Unable to compile class for JSP - Tomcat 8 plus Spring MVC
body: <p>I followed successfully the excellent tutorial from Oracle showing how to create an embedded tomcat application which I could start via java -jar \targeg\"myExecutableJar". In such tutorial there isn't Spring at all. (<a href="http://www.oracle.com/webfolder/technetwork/tutorials/obe/java/basic_app_embedded_tomcat/basic_app-tomcat-embedded.html#section2s1" rel="nofollow noreferrer">Oracle Tutorial</a></p>
  
  <p>Then I edited the index.jsp as showed bellow. Obviously, I added in pom.xml all Spring lib necessary.</p>
  
  <p>After this, I am getting the error from my question subject. I have read several question with similar point none of them fixed my issue. FOr instance, in certain question someone told to check ecj so I added it in pom. Other answer recommend to use the most recent Tomcat available. I did it.</p>
  
  <p>It seems to me that there might exist some conflict probably between some embedded tomcat lib and other one but I can't imagine which one.</p>
  
  <p>Other possibility might be related to some issue with the spring context especially because it is an embedded tomcat but I can't guess anything else to try.</p>
  
  <p>Am I missing any extra configuration? Kindly, note in the image below that I leave the context.xml under META-INF exactly as automatically generated and I place all the beans definition in App-servlet.xml.</p>
  
  <p><a href="https://i.stack.imgur.com/BQpuy.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/BQpuy.jpg" alt="Project Structure and the main method"></a></p>
  
  <p>index.jsp</p>
  
  <pre><code>&lt;%@ taglib prefix="form" uri="http://www.springframework.org/tags/form"%&gt;
  
  &lt;html&gt;
  
  &lt;body&gt;
  
  
  
  &lt;h2&gt;Uploading a file.. &lt;/h2&gt;
  
        &lt;form:form method="POST" action="uploadFile" enctype="multipart/form-data"&gt;
  
                Upload your file please:
  
                &lt;input type="file" name="file" /&gt;
  
                &lt;input type="text" name="name"&gt;
  
                &lt;input type="submit" value="Upload" /&gt;
  
                &lt;form:errors path="file" cssStyle="color: #ff0000;" /&gt;
  
         &lt;/form:form&gt;
  
  
  
  &lt;/body&gt;
  
  &lt;/html&gt;
  </code></pre>
  
  <p>App-servlet.xml</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  
  &lt;beans xmlns="http://www.springframework.org/schema/beans"
  
         xmlns:context="http://www.springframework.org/schema/context"
  
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  
         xsi:schemaLocation="
  
     http://www.springframework.org/schema/beans    
  
     http://www.springframework.org/schema/beans/spring-beans-4.2.xsd
  
     http://www.springframework.org/schema/context
  
     http://www.springframework.org/schema/context/spring-context-4.2.xsd"&gt;
  
  
  
         &lt;context:component-scan base-package="com.example.employees" /&gt;
  
  
  
         &lt;bean
  
                class="org.springframework.web.servlet.view.InternalResourceViewResolver"&gt;
  
                &lt;property name="prefix" value="/WEB-INF/" /&gt;
  
                &lt;property name="suffix" value=".jsp" /&gt;
  
         &lt;/bean&gt;
  
  
  
         &lt;bean id="multipartResolver"
  
                class="org.springframework.web.multipart.commons.CommonsMultipartResolver" /&gt;
  
  
  
  &lt;/beans&gt;
  </code></pre>
  
  <p>web.xml</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  
  &lt;web-app version="3.0" xmlns="http://java.sun.com/xml/ns/javaee"
  
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  
         xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"&gt;
  
  
  
         &lt;display-name&gt;Spring MVC Application&lt;/display-name&gt;
  
  
  
  
  
  
  
  
  
         &lt;servlet&gt;
  
                &lt;servlet-name&gt;App&lt;/servlet-name&gt;
  
                &lt;servlet-class&gt;org.springframework.web.servlet.DispatcherServlet&lt;/servlet-class&gt;
  
                &lt;init-param&gt;
  
                       &lt;param-name&gt;contextConfigLocation&lt;/param-name&gt;
  
                       &lt;param-value&gt;/WEB-INF/App-servlet.xml&lt;/param-value&gt;
  
                &lt;/init-param&gt;
  
                &lt;load-on-startup&gt;1&lt;/load-on-startup&gt;
  
         &lt;/servlet&gt;
  
  
  
         &lt;servlet-mapping&gt;
  
                &lt;servlet-name&gt;App&lt;/servlet-name&gt;
  
                &lt;url-pattern&gt;/&lt;/url-pattern&gt;
  
         &lt;/servlet-mapping&gt;
  
         &lt;welcome-file-list&gt;
  
                &lt;welcome-file&gt;index.jsp&lt;/welcome-file&gt;
  
         &lt;/welcome-file-list&gt;
  
  &lt;/web-app&gt;
  </code></pre>
  
  <p>pom</p>
  
  <pre><code>&lt;project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"&gt;
  
         &lt;modelVersion&gt;4.0.0&lt;/modelVersion&gt;
  
         &lt;groupId&gt;com.example.employees&lt;/groupId&gt;
  
         &lt;artifactId&gt;employees-app&lt;/artifactId&gt;
  
         &lt;packaging&gt;war&lt;/packaging&gt;
  
         &lt;version&gt;1.0-SNAPSHOT&lt;/version&gt;
  
         &lt;name&gt;employees-app Maven Webapp&lt;/name&gt;
  
         &lt;url&gt;http://maven.apache.org&lt;/url&gt;
  
         &lt;properties&gt;
  
                &lt;project.build.sourceEncoding&gt;UTF-8&lt;/project.build.sourceEncoding&gt;
  
                &lt;tomcat.version&gt;8.0.32&lt;/tomcat.version&gt;
  
                &lt;spring.version&gt;4.2.5.RELEASE&lt;/spring.version&gt;
  
         &lt;/properties&gt;
  
         &lt;dependencies&gt;
  
  
  
                &lt;dependency&gt;
  
                       &lt;groupId&gt;org.springframework&lt;/groupId&gt;
  
                       &lt;artifactId&gt;spring-web&lt;/artifactId&gt;
  
                       &lt;version&gt;${spring.version}&lt;/version&gt;
  
                &lt;/dependency&gt;
  
  
  
                &lt;dependency&gt;
  
                       &lt;groupId&gt;org.springframework&lt;/groupId&gt;
  
                       &lt;artifactId&gt;spring-webmvc&lt;/artifactId&gt;
  
                       &lt;version&gt;${spring.version}&lt;/version&gt;
  
                &lt;/dependency&gt;
  
  
  
                &lt;dependency&gt;
  
                       &lt;groupId&gt;commons-fileupload&lt;/groupId&gt;
  
                       &lt;artifactId&gt;commons-fileupload&lt;/artifactId&gt;
  
                       &lt;version&gt;1.3.1&lt;/version&gt;
  
                &lt;/dependency&gt;
  
  
  
                &lt;dependency&gt;
  
                       &lt;groupId&gt;org.apache.tomcat.embed&lt;/groupId&gt;
  
                       &lt;artifactId&gt;tomcat-embed-core&lt;/artifactId&gt;
  
                       &lt;version&gt;${tomcat.version}&lt;/version&gt;
  
                &lt;/dependency&gt;
  
                &lt;dependency&gt;
  
                       &lt;groupId&gt;org.apache.tomcat.embed&lt;/groupId&gt;
  
                       &lt;artifactId&gt;tomcat-embed-logging-juli&lt;/artifactId&gt;
  
                       &lt;version&gt;${tomcat.version}&lt;/version&gt;
  
                &lt;/dependency&gt;
  
                &lt;dependency&gt;
  
                       &lt;groupId&gt;org.apache.tomcat.embed&lt;/groupId&gt;
  
                       &lt;artifactId&gt;tomcat-embed-jasper&lt;/artifactId&gt;
  
                       &lt;version&gt;${tomcat.version}&lt;/version&gt;
  
                &lt;/dependency&gt;
  
                &lt;dependency&gt;
  
                       &lt;groupId&gt;org.apache.tomcat&lt;/groupId&gt;
  
                       &lt;artifactId&gt;tomcat-jasper&lt;/artifactId&gt;
  
                       &lt;version&gt;${tomcat.version}&lt;/version&gt;
  
                &lt;/dependency&gt;
  
                &lt;dependency&gt;
  
                       &lt;groupId&gt;org.apache.tomcat&lt;/groupId&gt;
  
                       &lt;artifactId&gt;tomcat-jasper-el&lt;/artifactId&gt;
  
                       &lt;version&gt;${tomcat.version}&lt;/version&gt;
  
                &lt;/dependency&gt;
  
                &lt;dependency&gt;
  
                       &lt;groupId&gt;org.apache.tomcat&lt;/groupId&gt;
  
                       &lt;artifactId&gt;tomcat-jsp-api&lt;/artifactId&gt;
  
                       &lt;version&gt;${tomcat.version}&lt;/version&gt;
  
                &lt;/dependency&gt;
  
                &lt;dependency&gt;
  
                       &lt;groupId&gt;jstl&lt;/groupId&gt;
  
                       &lt;artifactId&gt;jstl&lt;/artifactId&gt;
  
                       &lt;version&gt;1.2&lt;/version&gt;
  
                &lt;/dependency&gt;
  
                &lt;dependency&gt;
  
                       &lt;groupId&gt;javax.servlet&lt;/groupId&gt;
  
                       &lt;artifactId&gt;javax.servlet-api&lt;/artifactId&gt;
  
                       &lt;version&gt;3.0.1&lt;/version&gt;
  
                &lt;/dependency&gt;
  
                &lt;dependency&gt;
  
                       &lt;groupId&gt;org.eclipse.jdt.core.compiler&lt;/groupId&gt;
  
                       &lt;artifactId&gt;ecj&lt;/artifactId&gt;
  
                       &lt;version&gt;4.5.1&lt;/version&gt;
  
                &lt;/dependency&gt;
  
  
  
         &lt;/dependencies&gt;
  
         &lt;build&gt;
  
                &lt;finalName&gt;employees-app&lt;/finalName&gt;
  
                &lt;resources&gt;
  
                       &lt;resource&gt;
  
                             &lt;directory&gt;src/main/webapp&lt;/directory&gt;
  
                             &lt;targetPath&gt;META-INF/resources&lt;/targetPath&gt;
  
                       &lt;/resource&gt;
  
                &lt;/resources&gt;
  
                &lt;plugins&gt;
  
                       &lt;plugin&gt;
  
                             &lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt;
  
                             &lt;artifactId&gt;maven-compiler-plugin&lt;/artifactId&gt;
  
                             &lt;version&gt;3.5.1&lt;/version&gt;
  
                             &lt;inherited&gt;true&lt;/inherited&gt;
  
                             &lt;configuration&gt;
  
                                    &lt;source&gt;1.8&lt;/source&gt;
  
                                    &lt;target&gt;1.8&lt;/target&gt;
  
                             &lt;/configuration&gt;
  
  
  
                       &lt;/plugin&gt;
  
                       &lt;plugin&gt;
  
                             &lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt;
  
                             &lt;artifactId&gt;maven-assembly-plugin&lt;/artifactId&gt;
  
                             &lt;configuration&gt;
  
                                    &lt;descriptorRefs&gt;
  
                                           &lt;descriptorRef&gt;jar-with-dependencies&lt;/descriptorRef&gt;
  
                                    &lt;/descriptorRefs&gt;
  
                                    &lt;finalName&gt;employees-app-${project.version}&lt;/finalName&gt;
  
                                    &lt;archive&gt;
  
                                           &lt;manifest&gt;
  
                                                  &lt;mainClass&gt;com.example.employees.Main&lt;/mainClass&gt;
  
                                           &lt;/manifest&gt;
  
                                    &lt;/archive&gt;
  
                             &lt;/configuration&gt;
  
                             &lt;executions&gt;
  
                                    &lt;execution&gt;
  
                                           &lt;phase&gt;package&lt;/phase&gt;
  
                                           &lt;goals&gt;
  
                                                  &lt;goal&gt;single&lt;/goal&gt;
  
                                           &lt;/goals&gt;
  
                                    &lt;/execution&gt;
  
                             &lt;/executions&gt;
  
                       &lt;/plugin&gt;
  
                &lt;/plugins&gt;
  
         &lt;/build&gt;
  
  &lt;/project&gt;
  </code></pre>
  
  <p>log:</p>
  
  <pre><code>type Exception report
  
  message Unable to compile class for JSP
  
  description The server encountered an internal error that prevented it from fulfilling this request.
  
  exception
  
  org.apache.jasper.JasperException: Unable to compile class for JSP
  
          org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:600)
  
          org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:363)
  
          org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:396)
  
          org.apache.jasper.servlet.JspServlet.service(JspServlet.java:340)
  
          javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
  
  root cause
  
  java.lang.NullPointerException
  
          org.apache.jasper.JspCompilationContext.getTldResourcePath(JspCompilationContext.java:551)
  
          org.apache.jasper.compiler.Parser.parseTaglibDirective(Parser.java:420)
  
          org.apache.jasper.compiler.Parser.parseDirective(Parser.java:479)
  
          org.apache.jasper.compiler.Parser.parseElements(Parser.java:1435)
  
          org.apache.jasper.compiler.Parser.parse(Parser.java:139)
  
          org.apache.jasper.compiler.ParserController.doParse(ParserController.java:227)
  
          org.apache.jasper.compiler.ParserController.parse(ParserController.java:100)
  
          org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:199)
  
          org.apache.jasper.compiler.Compiler.compile(Compiler.java:356)
  
          org.apache.jasper.compiler.Compiler.compile(Compiler.java:336)
  
          org.apache.jasper.compiler.Compiler.compile(Compiler.java:323)
  
          org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:585)
  
          org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:363)
  
          org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:396)
  
          org.apache.jasper.servlet.JspServlet.service(JspServlet.java:340)
  
          javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
  </code></pre>
  
  <p>************ Added </p>
  
  <p><a href="https://i.stack.imgur.com/ui3aP.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/ui3aP.jpg" alt="enter image description here"></a></p>