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

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?

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.

java.lang.NoClassDefFoundError:org/apache/commons/fileupload/FileItemFactoryin Spring MVC

I am trying to build a simple Spring MVC Web App with the functionality of file uploading.I got following error:
java.lang.NoClassDefFoundError: org/apache/commons/fileupload/FileItemFactory
After a quick search,all answers pointed to the missing of dependencies,but it seems not to be true in my case:
I have included the following code in pom.xml:
<dependencies>
<dependency>
<groupId>commons-fileupload</groupId>
<artifactId>commons-fileupload</artifactId>
<version>1.3.1</version>
</dependency>
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>2.4</version>
</dependency>
</dependencies>
with commons.io-2.4.jar and commons.fileupload-1.3.1.jar added into lib folder.
One interesting thing I found was that whenever I deleted the code:
<bean id="multipartResolver"
class="org.springframework.web.multipart.commons.CommonsMultipartResolver">
<property name="maxUploadSize">
<value>10000000</value>
</property>
<property name="maxInMemorySize">
<value>10000000</value>
</property>
</bean>
the web app works fine(of course I removed the form for file uploading as well. )
If you visit the Maven Central Repository and enter the search term:
fc:org.apache.commons.fileupload.FileItemFactory
then every released artifact available containing that class will be listed.
You will find commons-upload 1.3.1 in that list.
Therefore you need to double check your deployment to ensure that jar is present.
Tip: Use fc: to locate jars in Maven Central that contain a specific class.
try to update your jar version, for Example:
<dependency>
<groupId>commons-fileupload</groupId>
<artifactId>commons-fileupload</artifactId>
<version>2.0.0-SNAPSHOT</version>
</dependency>
We cann't find versions upper 1.3 on Apache and mvnrepository.com , but you can try this : https://repository.jboss.org/commons-fileupload/commons-fileupload/2.0.0-SNAPSHOT/
In fact, I encountered the same problem and now working fine with version 2.0 under SpringMVC framework.

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!

java.lang.ClassNotFoundException: org.springframework.web.servlet.DispatcherServlet

i am using spring 3.1.0.RELEASE, and my servlet container is tomcat 7 and my IDE is eclipse indigo
and the jar spring-webmvc-3.1.0.RELEASE.jar which contains the DispatcherServlet
exists in the lib folder, and yet when running the application, i am getting the exception:
java.lang.ClassNotFoundException: org.springframework.web.servlet.DispatcherServlet
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1678)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1523)
at org.apache.catalina.core.DefaultInstanceManager.loadClass(DefaultInstanceManager.java:525)
at org.apache.catalina.core.DefaultInstanceManager.loadClassMaybePrivileged(DefaultInstanceManager.java:507)
at org.apache.catalina.core.DefaultInstanceManager.newInstance(DefaultInstanceManager.java:126)
at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1099)
at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:1043)
at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:4957)
at org.apache.catalina.core.StandardContext$3.call(StandardContext.java:5284)
at org.apache.catalina.core.StandardContext$3.call(StandardContext.java:5279)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
at java.util.concurrent.FutureTask.run(FutureTask.java:138)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:662)
please advise why i am getting this exception, and how to fix it.
EDIT: following are my configuration files:
1- .springBeans:
<?xml version="1.0" encoding="UTF-8"?>
<beansProjectDescription>
<version>1</version>
<pluginVersion><![CDATA[2.9.0.201203011806-RELEASE]]></pluginVersion>
<configSuffixes>
<configSuffix><![CDATA[xml]]></configSuffix>
</configSuffixes>
<enableImports><![CDATA[false]]></enableImports>
<configs>
<config>src/main/webapp/WEB-INF/checkout-servlet.xml</config>
</configs>
<configSets>
</configSets>
</beansProjectDescription>
2- web.xml:
<web-app>
<display-name>Checkout</display-name>
<servlet>
<servlet-name>checkout</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>checkout</servlet-name>
<url-pattern>*.action</url-pattern>
</servlet-mapping>
</web-app>
3- checkout-servlet.xml:
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:context="http://www.springframework.org/schema/context"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.1.xsd">
<context:component-scan base-package="com.myapp"/>
<bean id="myService" class="com.myapp.MyService"/>
</beans>
also when trying to access any page in the application, i get the exception:
HTTP Status 404 - Servlet checkout is not available
type Status report
message Servlet checkout is not available
description The requested resource (Servlet checkout is not available) is not available.
Apache Tomcat/7.0.22
You need to add the "Maven Dependency" in the Deployment Assembly
right click on your project and choose properties.
click on Deployment Assembly.
click add
click on "Java Build Path Entries"
select Maven Dependencies"
click Finish.
Rebuild and deploy again
Note: This is also applicable for non maven project.
Two possible answers:
1- You did not include spring-beans and spring-context jars in your lib.
If you are using maven (which will help a lot) those two lines will be enough
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
<version>3.1.0.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-webmvc</artifactId>
<version>3.1.0.RELEASE</version>
</dependency>
2- The necessary jars are in your classpath but are not deployed on tomcat.
I had the same problem with Idea Intellij and Spring 4. I fixed the problem and I wanted to share the answer with you.
I use tomcat 7 / idea intellij 13 / spring 4.
pom.xml dependencies:
<properties>
<spring.version>4.0.5.RELEASE</spring.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-core</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
enter code here
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-jdbc</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-web</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-webmvc</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-test</artifactId>
<version>${spring.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.11</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
<version>1.7.2</version>
</dependency>
<dependency>
<groupId>commons-dbcp</groupId>
<artifactId>commons-dbcp</artifactId>
<version>1.4</version>
</dependency>
</dependencies>
In idea Intellij, you need to go to File -> Project Settings -> Artifacts.
Then
clean -> rebuild the project -> build the artifact, and everything will be ok.
This solves the problem for me. It's easy and pretty simply explained.
Step 1
Right click on project
Click on Properties
Step 2
Click on Deployment Assembly Tab in the
Click Add...
Step 3
Click on Java Build Path Entries
Step 4
Click on Maven Dependencies
Click Finish button
Step 5
Redeploy Spring MVC application to Tomcat again
Restart Tomcat
List item
classnotfoundexception
i found that in the deployment assembly, there was the entry:
[persisted container] org.maven.ide.eclipse.maven2_classpath_container
i removed it, and added the maven dependencies entry, and it works fine now.
If all of these advice doesn't work, you should re-create your Server (Tomcat or like that). That solved my problem.
Include below dependency in your pom.xml
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-webmvc</artifactId>
<version>{spring-version}</version>
</dependency>
I was facing the same Issue. When I saw into maven repository .m2 folder(....m2\repository\org\springframework\spring-webmvc) in my local I found two 3.2.0.RELEASE folders. SO I removed one.
Then I went to project, right click->properties->deployment essembly-> add maven dependencies.
clean build and then restart the server.
Then the DispatcherServlet got loaded.
Go to properties of Project which your working
Choose the Deployment Assembly menu and Click on add button
opt the Java Build Path Entries and Click on Maven Dependencies
Build the project and run
In my case I get this trouble after using the maven's update project utility.
I tried all the workarounds you suggested but nothing seemed to work.
At the end the solution was simply to remove the project from the server to ensure that it was clean, and add it again. Then it works, I hope this solution could help any of you.
You can use GlassFish server and the error will be resolved. I tried with tomcat7 and tomcat8 but this error was coming continuously but resolved with GlassFish. I think it's a problem with server.
These are the results with tomcat7:
Here are the results with GlassFish:
right click on your project and choose properties.
click on Deployement Assembly.
click add
click on "Java Build Path Entries"
select Maven Dependencies"
click Finish.
It may be useful for someone, so I'll post it here.
I was missing this dependency on my pom.xml
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
<exclusions>
<exclusion>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
</exclusion>
</exclusions>
</dependency>
I solved by following these steps:
Right click in the project > Configure > Convert to Maven project
After the conversion, right click in the project > Maven > Update project
This fixes the "Deployment Assembly" settings of the project.
Move the jar files from your classpath to web-inf/lib, and run a new tomcat server.
I found a simple solution,
Simply add your jars inside WEB-INF-->lib folder..
I had this same issue in WebSphere, but couldn't find a solution even though I verified the Spring dependencies were there and it ran in tomcat just fine. I ended up uninstalling the application and was still getting the error so I think WebSphere was hanging onto some corrupt instance.
To fix the issue I had to reinstall the application, stop it, uninstall it and then reinstall it.
For me it was a mistake in the pom.xml - I'd set <scope>provided<scope> on my dependencies, and this was making them not get copied during the mvn package stage.
My symptoms were the error message the OP posted, and that the jars were not included in the WEB-INF/lib path inside the .war after package was run. When I removed the scope, the jars appeared in the output, and all loads up fine now.

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