Reputation: 177
I have include these dependency in pom.xml.
<dependency>
<groupId>org.apache.tomcat.embed</groupId>
<artifactId>tomcat-embed-jasper</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>jstl</artifactId>
</dependency>
Still i am getting javax.servlet.ServletException: java.lang.NoSuchMethodError: org.apache.el.lang.ELSupport.coerceToType(Ljavax/el/ELContext;Ljava/lang/Object;Ljava/lang/Class;)Ljava/lang/Object;
I also included one more dependency in pom.xml.
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
<scope>provided</scope>
</dependency>
Then the error changed to An exception occurred processing JSP page /WEB-INF/views/index.jsp at line 7 4: <%@ page session="false" %> [[[[ JSTL CODE USING EXPRESSION LANGUAGE]]]
Everything is working fine in eclipse ide but not working on deploying on separate tomcat server.
Upvotes: 4
Views: 5295
Reputation: 2374
You are getting below error because of the presence of tomcat-embed-el-8.0.32.jar in your Tomcat 8.0\webapps\AppName\WEB-INF\lib
folder.
javax.servlet.ServletException: java.lang.NoSuchMethodError:
org.apache.el.lang.ELSupport.coerceToType(Ljavax/el/ELContext;Ljava/lang/Object;Ljava/lang/Class;)Ljava/lang/Object;
This error is due to the conflict between the ELSupport.class
provided by Tomcat and tomcat-embed-el-8.0.32.jar present in the applications lib
directory, hence you get that error in Tomcat. And it works fine in Eclipse since it uses embedded server.
To fix this issue add below code in your pom.xml
:
<dependency>
<groupId>org.apache.tomcat.embed</groupId>
<artifactId>tomcat-embed-el</artifactId>
<scope>provided</scope>
</dependency>
When you add tomcat-embed-el
dependency as scope=required
then the tomcat-embed-el-8.0.32.jar will not be added into your \AppName\WEB-INF\lib
folder.
For information check this Issue on Spring-Boot's Github repository.
Also you can use these sample apps:
InternalResourceViewResolver
bean.application.properties
just like in the spring-boot sample apps.Upvotes: 2