Why is the forEach tag not working with Tomcat but all is fine with Jetty? - maven

These are the dependencies I have in pom.xml
<dependency>
<groupId>com.sun.faces</groupId>
<artifactId>jsf-api</artifactId>
<version>2.2.13</version>
</dependency>
<dependency>
<groupId>com.sun.faces</groupId>
<artifactId>jsf-impl</artifactId>
<version>2.2.13</version>
</dependency>
and the Jetty plugin I use:
<plugin>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-maven-plugin</artifactId>
<version>9.2.1.v20140609</version>
</plugin>
and the Tomcat I use is: 8.5.4.
This is the view I have:
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://xmlns.jcp.org/jsf/html"
xmlns:c="http://xmlns.jcp.org/jsp/jstl/core">
<h:head>
<title>Student List</title>
</h:head>
<h:body>
<c:forEach items="#{studentBean.studentList}"
var="student">
#{student.fullname}
<br/>
</c:forEach>
</h:body>
</html>
When I run this application like this:
mvn clean install
mvn jetty:start
and visit localhost:8080, I will see the list just fine on my browser.
Koray Tugay
Mick Jagger
Now if I copy the .war file created and deploy it to Tomcat, I will see:
type Exception report
message javax/servlet/jsp/jstl/core/LoopTagStatus
description The server encountered an internal error that prevented it from fulfilling this request.
exception
javax.servlet.ServletException: javax/servlet/jsp/jstl/core/LoopTagStatus
javax.faces.webapp.FacesServlet.service(FacesServlet.java:659)
org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
javax.faces.view.facelets.FaceletException: javax/servlet/jsp/jstl/core/LoopTagStatus
com.sun.faces.facelets.tag.AbstractTagLibrary$UserComponentHandlerFactory.createHandler(AbstractTagLibrary.java:344)
java.lang.ClassNotFoundException: javax.servlet.jsp.jstl.core.LoopTagStatus
(full stack trace here..)
Now you maybe tempted to say Tomcat does not come with JSTL, you should add it in your pom.xml as dependency! However, at this point I will ask you:
Why does it work fine with Jetty?
Also, when I go through the jsf-impl-2.2.13.jar, which maven downloaded, I find the file called: jstl-core.taglib under com/sun/faces/metadata/taglib.
And in this file, I see this tag declaration:
<tag>
<description><![CDATA[
The basic iteration tag, accepting many different
collection types and supporting subsetting and other
functionality
]]></description>
<tag-name>forEach</tag-name>
<handler-class>com.sun.faces.facelets.tag.jstl.core.ForEachHandler</handler-class>
<attribute>
<description><![CDATA[
Collection of items to iterate over.
]]></description>
<name>items</name>
<required>false</required>
<type>java.lang.Object</type>
</attribute>
</tag>
and also, class com.sun.faces.facelets.tag.jstl.core.ForEachHandler is already included in the jsf-impl-2.2.13.jar.
So my understanding is, c:forEach is supposed to be included in the JSF implementation. Why is Tomcat not liking this situation?
If I include this dependency:
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>jstl</artifactId>
<version>1.2</version>
</dependency>
in pom.xml, for loop will loop happily in Tomcat as well. How does this work, or not work?

The class com.sun.faces.facelets.tag.jstl.core.ForEachHandler has via its dependency com.sun.faces.facelets.tag.jstl.core.JstlIterationStatus a dependency on javax.servlet.jsp.jstl.core.LoopTagStatus.
Tomcat doesn't ship with it. Hence the required JSTL dependency.
Jetty apparently provides its own JSTL library. So you don't need to include it via webapp. You should mark it at least <scope>provided</scope>.

Related

How do I fix HTTP Status 404 - Not Found on Intellij IDEA?

I've started my first job 2 months ago and it's been awhile since I've dealt with Spring. I'm trying to run Tomcat server, and display "/home" but I'm getting 404 on it. When I hover at my "home", IntelliJ IDEA is showing home.html . Error
HTTP Status 404 – Not Found
Type Status Report
Message The requested resource [/home] is not available
Description The origin server did not find a current representation for the target resource or is not willing to disclose that one exists.
Apache Tomcat/9.0.65
HTTP error
Code folders screenshot
Tomcat config
Tomcat deployment config
I've googled about it but it's doesn't fix it. Here is my code.
File HomeController.java
package com.example.demo;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
#Controller
public class HomeController {
#RequestMapping("/home")
public String landingPage() {
return ("home");
}
}
File home.html
<!DOCTYPE html>
<html lang="en"
xmlns:th="http://www.thymeleaf.org">
<head>
<meta charset="UTF-8">
<title>Title</title>
</head>
<body>
<h1>Landing page</h1>
</body>
</html>
File pom.xml
<?xml version="1.0" encoding="UTF-8"?>
<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 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.7.3</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<groupId>com.example</groupId>
<artifactId>demo</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>demo</name>
<description>demo</description>
<properties>
<java.version>17</java.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-thymeleaf</artifactId>
</dependency>
<dependency>
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<excludes>
<exclude>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
</exclude>
</excludes>
</configuration>
</plugin>
</plugins>
</build>
</project>
I also tried to run my older projects that works but now it doesn't.
Thank you in advance!
try to use ModelAndView:
#RequestMapping("/")
public ModelAndView index () {
ModelAndView modelAndView = new ModelAndView();
modelAndView.setViewName("home");
return modelAndView;
}
You are using Spring Boot, which has an embedded Tomcat server. I believe you have a standalone Tomcat running on port 8080 on your machine, preventing Spring Boot from using its own embedded Tomcat.
Stop the standalone Tomcat and start the Spring Boot application again.
Everything looks good. Spring boot doesn't require you to do any tomcat configuration.
The configuration you have should be the problem. Re create the project without the Tom Cat config and deployment config.
Check out this video: https://www.youtube.com/watch?v=HYGnVeCs0Yg&t=4235s
As previous answers mentioned before, you're using Spring Boot, which has its embedded Tomcat server under the hood. It's the default behavior, but you may configure your Spring Boot project to use Netty or Undertow servers, please check more details here — Embedded Web Servers
So since you already have the Tomcat server, there is no need to configure it in your IDE. Also, worth mentioning that running a project from your IDE is not the best idea. Especially, when you're describing your steps for reproducing the issue to someone else. Instead, you may run your Spring Boot project from the command line using the such command:
mvn spring-boot:run
By default, it'll start your application on the 8080 port and you will be able to access your homepage at this URL: localhost:8080/home
For more details on running your Spring Boot application, you may check this document — Running your application
To run the Spring Boot project from your IntelliJ IDEA, you need to open the DemoApplication class (in your case), which has the main method. And on the left, there should be a play button for running your project. You can also configure it in the 'Edit configurations' menu by selecting the 'Spring Boot' item under the 'Add new configuration' menu.
Updated:
I'm using that you're using macOS. To identify the process running on the 8080 port, which prevents you from starting your Spring Boot application, you may use such command:
sudo lsof -i :8080
This is the example output of this command from my machine, which has the Docker container running on the 8080 port:
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
com.docke 3134 golovnya 174u IPv6 0xcaf3b5f3fb45111 0t0 TCP *:http-alt (LISTEN)
Here we're interested in PID, which stands for the process identifier. It's a unique id of the running application. In my case, the PID of the process running on the 8080 port is 3134. Knowing this, we may kill this process by the following command:
kill -9 <PID>
In my case it will look like this:
kill -9 3134
That's all.
P.S. If it looks a bit complicated to your or you experience some issues, reloading your machine is always not a bad idea.

Error when running tests: Unable to locate NamespaceHandler for namespace [http://www.mulesoft.org/schema/mule/oauth2]

When I run the app (with Maven support), it works fine, but when I run mvn test (functional test) it gives me the error: Unable to locate NamespaceHandler for namespace [http://www.mulesoft.org/schema/mule/oauth2]
It looks like it comes from this:
<http:request-config name="ApiRest" protocol="HTTPS" doc:name="HTTP Request Configuration" basePath="rest" host="${api.endpointUrl}" port="443">
<oauth2:client-credentials-grant-type clientId="${api.client_id}" clientSecret="${api.client_secret}">
<oauth2:token-request tokenUrl="${api.endpointUrl}/oauth/token" />
</oauth2:client-credentials-grant-type>
</http:request-config>
What exactly is wrong?
I had a similar issue before but it is complaining about spring-ss namespace. See if the same solution will work with you.
Add these jars on your pom.xml which may be responsible for that namespace.
<dependency>
<groupId>com.mulesoft.muleesb.modules</groupId>
<artifactId>mule-module-boot-ee</artifactId>
<version>${mule.version}</version>
</dependency>
<dependency>
<groupId>org.mule.modules</groupId>
<artifactId>mule-module-ws</artifactId>
<version>${mule.version}</version>
<scope>provided</scope>
</dependency>
Maybe worth trying with mule-module-oauth module as well.
Good luck!

JspException and PageContext cannot be resolved

This is a follow up to a question on accessing resources in jsp page of spring mvc app
Thanks to #kmb385 I was able to resolve that problem but now I get the following eclipse errors in my JSP file
javax.servlet.jsp.JspException cannot be resolved to a type
and
javax.servlet.jsp.PageContext cannot be resolved to a type
as suggest by kmb385, here is my controller:
#Controller
public class AdminController {
#RequestMapping("/")
protected ModelAndView handleRequestInternal(HttpServletRequest request,
HttpServletResponse response) throws Exception {
ModelAndView model = new ModelAndView("index");
model.addObject("msg", "hello world");
return model;
}
}
and here is my index.jsp page just in case:
<%# page language="java" contentType="text/html; charset=ISO-8859-1"pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<!-- <link type="text/css" rel="stylesheet" href="css/style.css"/> -->
<style type="text/css">
<%#include file="css/style.css" %>
</style>
<title>My Project - MainPage</title>
</head>
<body>
<h2 class="main_heading2">My Project - MainPage</h2>
<div style="float: right; width: 30%; text-align: center">
<p style="float:left;">an image should be here</p>
<img src="images/logo.jpg" alt="Logo"/>
<img src="${pageContext.servletContext.contextPath}/resources/images/logo.jpg" />
</div>
</body>
I have come across "solutions" to this by disabling it in the JSP validator but Please do not suggest this unless you can give a legitimate reason. I would rather correct this issue properly
Any Help appreciated
UPDATE:
Build path screen grab as requested by #kmb385
Try setting the servlet-api dependency in your pom.xml to provided. This jar maybe conflicting with the tomcat provided servlet-api.jar.
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<version>2.5</version>
<scope>provided</scope>
</dependency>
Also be sure to include the jsp-api dependency, once again set as provided:
<!-- Servlet -->
<dependency>
<groupId>javax.servlet.jsp</groupId>
<artifactId>javax.servlet.jsp-api</artifactId>
<version>2.3.3</version>
<scope>provided</scope>
</dependency>
Make sure all of your maven dependencies are being used to build the project by right clicking your project > Properties. On the deployment assembly tab click the add button, then Java Build Path Entries, then Maven Dependencies and finally Finish.
You may also need to add your maven dependencies to the build path. Right click your project > Maven > Update Project Configuration.
If you have downloaded all the dependencies in maven and the error is still not getting away, follow the steps below:
Right click on project and go to properties
Click over target run time
Check the box in front of the server you are using.
This should work.
Try import the class.
Modify your jsp's first line to look like this;
<%# page language="java" import="javax.servlet.jsp.PageContext" contentType="text/html; charset=ISO-8859-1"pageEncoding="ISO-8859-1"%>
Add to the pom.xml dependencies:
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<version>2.5</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>javax.servlet.jsp</groupId>
<artifactId>jsp-api</artifactId>
<version>2.1</version>
<scope>provided</scope>
</dependency>
JSP:
Make sure to add on jsp, before tag:
<%# taglib prefix="fmt" uri="http://java.sun.com/jstl/fmt" %>
<%# taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
Get the context on JSP:
<c:set var="contextPath" value="${pageContext.request.contextPath}"/>
Import style css:
<link type="text/css" rel="stylesheet" href="${contextPath}/css/yourCssFile.css"/>
Dispatcher-servlet:
On your "spring-dispatcher-servlet.xml" add the following lines:
<beans xmlns="... xmlns:mvc="http://www.springframework.org/schema/mvc"
xsi:schemaLocation="...
http://www.springframework.org/schema/mvc
http://www.springframework.org/schema/mvc/spring-mvc-3.0.xsd">
<mvc:resources mapping="/resources/**" location="/resources/css/" />
Maybe, you need to add this adapters:
<bean class="org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter"/>
<bean class="org.springframework.web.servlet.mvc.SimpleControllerHandlerAdapter"/> [Optional]
<bean class="org.springframework.web.servlet.mvc.annotation.DefaultAnnotationHandlerMapping">
<property name="order" value="0"/>
</bean>
explained here: how to include js and css in jsp with spring MVC
How to solve javax.servlet.jsp.PageContext cannot be resolved to a type
1:- Select your project and Right click
2:- Go to Properties
3:- Click Targated Runtimes
4:- Check mark "Apache Tomcat v8.0"
I am using Apache v8.0 in my case
This will solve the problem
<!-- Need this to compile JSP -->
<dependency>
<groupId>org.apache.tomcat.embed</groupId>
<artifactId>tomcat-embed-jasper</artifactId>
<scope>provided</scope>
</dependency>
This alternative worked for me <%=request.getContextPath()%> which gets the Application context.

Embedded ActiveMQ in Embedded Glassfish (using maven-embedded-glassfish-plugin)

Im trying to run a ActiveMQ glassfish embedded using the maven-embedded-glassfish-plugin.
I have separately completed below tutorials, so I know the basics.
The goal is to have a setup that builds in one click and avoids 3pp libraries in svn.
1 http://www.hascode.com/2011/09/java-ee-6-development-using-the-maven-embedded-glassfish-plugin/
2 http://javadude.wordpress.com/2011/07/21/glassfish-v3-1-running-embedded-activemq-for-jms-part-1/
Project setup for #2 is used as startpoint from now and I will try to merge the steps from #1
I've setup a glassfish-resources.xml hoping it will do the configuration tutorial 1 did from the glassfish admin-console.
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE resources PUBLIC "-//GlassFish.org//DTD GlassFish Application Server 3.1 Resource Definitions//EN" "http://glassfish.org/dtds/glassfish-resources_1_5.dtd">
<resources>
<resource-adapter-config resource-adapter-name="activemq-rar-5.6.0" thread-pool-ids="thread-pool-1">
<property name="ServerUrl" value="vm://localhost:61616"></property>
<property name="BrokerXmlConfig" value="broker:(tcp://0.0.0.0:61616)"></property>
</resource-adapter-config>
<connector-resource enabled="true" jndi-name="amqres"
object-type="user" pool-name="amqpool">
</connector-resource>
<connector-connection-pool
connection-definition-name="javax.jms.ConnectionFactory"
fail-all-connections="false" idle-timeout-in-seconds="300"
is-connection-validation-required="false" max-pool-size="32"
max-wait-time-in-millis="60000" name="amqpool" pool-resize-quantity="2"
resource-adapter-name="activemq-rar-5.6.0" steady-pool-size="2" />
<admin-object-resource res-adapter="activemq-rar-5.6.0"
res-type="javax.jms.Queue" jndi-name="amqmsg"></admin-object-resource>
</resources>
additions to pom.xml
<dependencies>
<dependency>
<groupId>org.apache.activemq</groupId>
<artifactId>activemq-rar</artifactId>
<version>5.6.0</version>
<type>rar</type>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.apache.activemq</groupId>
<artifactId>activemq-core</artifactId>
<version>5.6.0</version>
<scope>compile</scope>
</dependency>
</dependencies>
Q1: How is glassfish-resources.xml loaded? Should i use maven admin command or place it in some META-INF?
edit: looks like it goes in web-inf if war and meta-inf if ejb-jar
Q2: Not entirely sure what is the next step. #1 has me copy activemq and log4j libraries to GLASSFISH_HOME/glassfish/lib so far I only added the dependency in the pom.xml, what is the equivalent here?
Q3: The Rar needs to be deployed as well. How can multiple applications be deployed?

Unable to read TLD "META-INF/c.tld"

there's this issue with JSTL I'm stuck with for the past couple of days. Any help is appreciated.
Tomcat 6.0.28
Eclipse: Helios
pom.xml :
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>jstl</artifactId>
<version>1.1.2</version>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<version>2.4</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>taglibs</groupId>
<artifactId>standard</artifactId>
<version>1.1.2</version>
</dependency>
<dependency>
<groupId>javax.servlet.jsp</groupId>
<artifactId>jsp-api</artifactId>
<version>2.0</version>
<scope>provided</scope>
</dependency>
JSP:
<%# page session="true"%>
<%# taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%# taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%# taglib prefix="utilfn" uri="/utility-functions" %>
web.xml:
<web-app id="WebApp_ID" version="2.4"
xmlns="http://java.sun.com/xml/ns/j2ee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
When I deploy the Maven-built war on tomcat 6 using the manager it works fine.
When I run it as "Run As > Run On Server" inside eclipse, I get this:
Unable to read TLD "META-INF/c.tld" from JAR file "file:/<- location ->/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/Myproject/WEB-INF/lib/standard-1.1.2.jar": org.apache.jasper.JasperException: Failed to load or instantiate TagLibraryValidator class: org.apache.taglibs.standard.tlv.JstlCoreTLV
Wherever I look, it says the same thing:
Make sure servlet-api and jsp-api are not in lib
Make sure to use the right JSTL version and URI that goes with JSP 2.0.
And they seem to be fine as I can deploy the war independently. So what's wrong here!?
After i moved using Indigo Eclipse 3.7 and took the lasted update of m2e, this problem happened to me, i remove the dependency below it worked well.
<dependency>
<groupId>javax.servlet.jsp</groupId>
<artifactId>jsp-api</artifactId>
<version>2.1</version>
<scope>provided</scope>
</dependency>
I'm not sure why the issues was gone, as my understanding new version of m2e has jsp compilation library already.
remove :
javax.servlet.jsp
jsp-api
2.0
provided
from you pom.xml and that should do.. it worked in my case :-)
It looks like there is an issue with maven/m2eclipse plugin. Even I am seeing the same issue. By default it is pushing all the jar files to server lib directory. Which includes the scope "provided" jar files. This issue was fixed in old versions of m2eclipse. But it got introduced again it seems.
Check that
.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/Myproject/WEB-INF/lib/standard-1.1.2.jar is not corrupted (and do some cleanup if required).
Quickfix:
Make a backup of .classpath and .project and .settings/org.eclipse.wst.common.component.
Run this command:
mvn eclipse:eclipse
Or, right-click over the project, in the Maven sub-menu, you have an Update Project... command which I think does the same thing.
Republish.
Explanation:
You likely added all Maven Dependencies as a Deployment Assembly to your project. This copies all Maven class path entries to the WEB-INF/lib directory. Open your .classpath file (at the root of your project) and you'll probably find the following XML:
<classpathentry kind="con" path="org.maven.ide.eclipse.MAVEN2_CLASSPATH_CONTAINER">
<attributes>
<attribute name="org.eclipse.jst.component.dependency" value="/WEB-INF/lib"/>
</attributes>
</classpathentry>
That means copy EVERY .jar file which becomes a problem in this case.
Updating the project should remove the XML block above and explicitly list the JAR files.
So, if you re-open .classpath, you'll see this instead:
<classpathentry kind="var" path="M2_REPO/com/google/code/gson/gson/2.2.1/gson-2.2.1.jar" sourcepath="M2_REPO/com/google/code/gson/gson/2.2.1/gson-2.2.1-sources.jar"/>
<classpathentry kind="var" path="M2_REPO/javax/servlet/jsp/jsp-api/2.1/jsp-api-2.1.jar" sourcepath="M2_REPO/javax/servlet/jsp/jsp-api/2.1/jsp-api-2.1-sources.jar"/>
...
This is for the classpath which you still need, but it removed the dependency to copy them to lib. Instead, if you open .settings/org.eclipse.wst.common.component/, you'll see that the JAR files are now explicitly listed:
<dependent-module deploy-path="/WEB-INF/lib" handle="module:/classpath/var/M2_REPO/com/google/code/gson/gson/2.2.1/gson-2.2.1.jar">
<dependency-type>uses</dependency-type>
</dependent-module>
And, you'll note that jsp-api-2.1.jar is now missing. Apply the same logic to the other JAR files.
Does anyone know how to make this automatic?
platform: eclipse 3.7 indigo, tomcat 6.0.29
commented out the following dependencies in pom.xml:
javax.servlet
org.apache.taglibs
this cleared up the issue (as they are provided via tomcat) ...
I agree with Jay's answer. I have same issue here. If I remove jsp-api from pom.xlm, maven test will fail because it cannot find jspWriter class in jsp-api jar. If I keep jsp-api in pom and set it to 'provided' or 'test', tomcat side will fail as the m2e plugin pushes jsp-api jar to maven dependencies which is then included in my tomcat deployed lib. I would say it's plugin issue as jsp-api has to be declared in pom.xml as provided because it is provided by application servers.
I can't find any way of solving this issue but to manually delete the jsp-api every time after tomcat server synch.
With Eclipse, please assure that you installed 'Maven Integration for Eclipse WTP '
With the other plugin without WTP, eclipse change your classpath and include servlet-api.jar in your webapps.
You must exclude jsp-api dependency from jstl import in your pom.xml :
<dependency>
<groupId>javax.servlet.jsp.jstl</groupId>
<artifactId>jstl-api</artifactId>
<version>1.2</version>
<exclusions>
<exclusion>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
</exclusion>
<exclusion>
<artifactId>jsp-api</artifactId>
<groupId>javax.servlet.jsp</groupId>
</exclusion>
</exclusions>
</dependency>
Removed jsp-api 2.0 from
.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/Myproject/WEB-INF/lib/
this worked for me .
I was getting the same error in netbeans IDE 8.0.2. It turns out my part was set to 8080 for outgoing and shutdown. I changed the outgoing to 8081 for Tomcat server. It worked! I then changed my shutdown port 8005. To change go to Tools>Servers>
My tomcat server now works.

Resources