After an upgrade from Spring Boot 3.3.1 to 3.3.2 I got the following exception
9208 Jul 18 18:58:06 vidom-magazine.org vidom_archive[22404]: 2024-07-18T18:58:06.960Z ERROR 22404 --- [0.1-8080-exec-2] o.a.c.c.C.[Tomcat].[localhost] : Exception Processing [ErrorPage[errorCode=0, location=/error]]
9209 Jul 18 18:58:06 vidom-magazine.org vidom_archive[22404]: org.apache.jasper.JasperException: Unable to compile class for JSP
9210 Jul 18 18:58:06 vidom-magazine.org vidom_archive[22404]: at org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:619) ~[tomcat-embed-jasper-10.1.26.jar!/:na]
9211 Jul 18 18:58:06 vidom-magazine.org vidom_archive[22404]: at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:396) ~[tomcat-embed-jasper-10.1.26.jar!/:na]
9212 Jul 18 18:58:06 vidom-magazine.org vidom_archive[22404]: at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:377) ~[tomcat-embed-jasper-10.1.26.jar!/:na]
9213 Jul 18 18:58:06 vidom-magazine.org vidom_archive[22404]: at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:325) ~[tomcat-embed-jasper-10.1.26.jar!/:na]
9214 Jul 18 18:58:06 vidom-magazine.org vidom_archive[22404]: at jakarta.servlet.http.HttpServlet.service(HttpServlet.java:658) ~[tomcat-embed-core-10.1.26.jar!/:6.0.0]
---
9442Jul 18 18:58:06 vidom-magazine.org vidom_archive[22404]: Caused by: jakarta.el.ELException: Provider com.sun.el.ExpressionFactoryImpl not found
9443 Jul 18 18:58:06 vidom-magazine.org vidom_archive[22404]: at jakarta.el.FactoryFinder.newInstance(FactoryFinder.java:77) ~[jakarta.el-api-5.0.0.jar!/:5.0.0]
9444 Jul 18 18:58:06 vidom-magazine.org vidom_archive[22404]: at jakarta.el.FactoryFinder.find(FactoryFinder.java:173) ~[jakarta.el-api-5.0.0.jar!/:5.0.0]
9445 Jul 18 18:58:06 vidom-magazine.org vidom_archive[22404]: at jakarta.el.ExpressionFactory.newInstance(ExpressionFactory.java:138) ~[jakarta.el-api-5.0.0.jar!/:5.0.0]
9446 Jul 18 18:58:06 vidom-magazine.org vidom_archive[22404]: at jakarta.el.ExpressionFactory.newInstance(ExpressionFactory.java:108) ~[jakarta.el-api-5.0.0.jar!/:5.0.0]
9447 Jul 18 18:58:06 vidom-magazine.org vidom_archive[22404]: at org.apache.jasper.compiler.PageInfo.<init>(PageInfo.java:82) ~[tomcat-embed-jasper-10.1.26.jar!/:na]
9448 Jul 18 18:58:06 vidom-magazine.org vidom_archive[22404]: at org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:120) ~[tomcat-embed-jasper-10.1.26.jar!/:na]
9449 Jul 18 18:58:06 vidom-magazine.org vidom_archive[22404]: at org.apache.jasper.compiler.Compiler.compile(Compiler.java:396) ~[tomcat-embed-jasper-10.1.26.jar!/:na]
9450 Jul 18 18:58:06 vidom-magazine.org vidom_archive[22404]: at org.apache.jasper.compiler.Compiler.compile(Compiler.java:372) ~[tomcat-embed-jasper-10.1.26.jar!/:na]
9451 Jul 18 18:58:06 vidom-magazine.org vidom_archive[22404]: at org.apache.jasper.compiler.Compiler.compile(Compiler.java:356) ~[tomcat-embed-jasper-10.1.26.jar!/:na]
9452 Jul 18 18:58:06 vidom-magazine.org vidom_archive[22404]: at org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:603) ~[tomcat-embed-jasper-10.1.26.jar!/:na]
9453 Jul 18 18:58:06 vidom-magazine.org vidom_archive[22404]: ... 231 common frames omitted
9454 Jul 18 18:58:06 vidom-magazine.org vidom_archive[22404]: Caused by: java.lang.ClassNotFoundException: com.sun.el.ExpressionFactoryImpl
9455 Jul 18 18:58:06 vidom-magazine.org vidom_archive[22404]: at org.springframework.boot.web.embedded.tomcat.TomcatEmbeddedWebappClassLoader.loadClass(TomcatEmbeddedWebappClassLoader.java:72) ~[spring-boot-3.3.2.jar!/:3.3.2]
9456 Jul 18 18:58:06 vidom-magazine.org vidom_archive[22404]: at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1144) ~[tomcat-embed-core-10.1.26.jar!/:na]
9457 Jul 18 18:58:06 vidom-magazine.org vidom_archive[22404]: at jakarta.el.FactoryFinder.newInstance(FactoryFinder.java:47) ~[jakarta.el-api-5.0.0.jar!/:5.0.0]
9458 Jul 18 18:58:06 vidom-magazine.org vidom_archive[22404]: ... 240 common frames omitted
I'm using JSPs and JSTL, which both work with Spring Boot 3.3.1 without a problem.
I use the following dependencies in my maven pom file
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
</dependency>
<dependency>
<groupId>org.apache.tomcat.embed</groupId>
<artifactId>tomcat-embed-jasper</artifactId>
</dependency>
Comment From: wilkinsona
We use Apache's EL implementation (org.apache.tomcat.embed:tomcat-embed-el) by default. It's included in spring-boot-starter-tomcat and its entry point implementation is org.apache.el.ExpressionFactoryImpl. It's not clear to me why an attempt would be made to load com.sun.el.ExpressionFactoryImpl and you haven't provide enough information for us to be able to figure that out. My guess is that it's some pollution coming from another dependency but that is just a guess at this point.
If you would like us to spend some more time investigating, please spend some time providing a complete yet minimal sample that reproduces the problem. You can share it with us by pushing it to a separate repository on GitHub or by zipping it up and attaching it to this issue.
Comment From: akirsch76
I guess I've found the cause of this problem. In the new Tomcat dependency 10.1.26, a service provider file for the EL factory is missing in the jar. These files existed in the previous version, 10.1.25, of the Tomcat dependency. I hope you can see that in my screenshots.
Comment From: akirsch76
I've also checked the apache tomcat release. The service provider file is only missing in the embedded tomcat release 10.1.26 so I guess it is a problem with the tomcat embedded release.
Comment From: wilkinsona
Without that file, if there's no other META-INF/services/jakarta.el.ExpressionFactory file on the classpath, it should use org.apache.el.ExpressionFactoryImpl by default. You may be able to get it to work by excluding the dependency with the unwanted META-INF/services/jakarta.el.ExpressionFactory file. Alternatively, you could add a META-INF/services/jakarta.el.ExpressionFactory to your app that points to org.apache.el.ExpressionFactoryImpl.
so I guess it is a problem with the tomcat embedded release
Yes, I think so too. Please open a Tomcat issue so that they can address it.
Comment From: akirsch76
Adding a service provider file to my project with the correct Apache EL implementation worked for me as a workaround.
Comment From: wilkinsona
I've spoken with @markt-asf and a fix is already in place for this and will be part of the next Tomcat release.
Comment From: davidfritch
I'll just note, this also happened in my project upgrading in my project from spring boot 3.1 to 3.3.2 I set the <tomcat.version>10.1.25</tomcat.version> as noted in https://github.com/spring-projects/spring-boot/issues/41557#issuecomment-2237388174 and I was able to render a .jsp page correctly. I'll look forward to when tomcat patches this.
Comment From: christarczon
Tomcat 10.1.28 has been released and resolves this.