Can you run two different versions of Apache Tomcat on two seperate local host ports?

I am current running Apache Tomcat 7 in eclipse, however when I attempt to start the same Apache outside of eclipse it stops immediately and says that I am currently using port 8080. So if I were to download Apache Tomcat 9 on my computer and tell it to run on a different localhost port say 9090, would that allow me to run Tomcat 7 in eclipse and Tomcat 9 outside of eclipse. The reason I am asking is because I want to be able to test my web services applications both inside and outside eclipse however that is not an option at this time.

apache 2.2 – Tomcat Trailing Slash With Proxy Forwarding

I am running Tomcat 9 behind an Apache 2 server on Ubuntu 18. I am using a reverse proxy to send traffic to Tomcat with the following in the apache conf file:

ProxyPreserveHost On
ProxyPass ""  "http://localhost:8080/MyApp/"
ProxyPassReverse ""  "http://localhost:8080/MyApp/"
ProxyPassReverseCookiePath ""  "http://localhost:8080/MyApp/"
ProxyPassReverseCookieDomain ""  "http://localhost:8080/MyApp/"

Everything is working fine except one aspect. If the user omits the trailing slash on a subfolder then Tomcat redirects incorrectly. So for example:

works fine, however if the user types

Tomcat will redirect to

It’s sticking the MyApp folder into the redirect. Any ideas how to solve this?


Linux ProcessBuilder on tomcat 7

Please would you able to help me to solve this problem, i have been trying to fix from past 10 days or so.

I have simple jsp page code below.

ProcessBuilder pb = new ProcessBuilder();
pb.command("/bin/sh", "-c","ls /code/test/MSV/");
Process process = pb.start();
StringBuilder output = new StringBuilder();
BufferedReader reader = new BufferedReader(new InputStreamReader(process.getInputStream()));
String line;
while ((line = reader.readLine()) != null)

i get the error – ls: cannot open directory /code/test/MSV/: Permission denied

but when i change the directory to ls /code/test/ it works fine.

web application runs as user tomcat

the directory structure is below.
structure of /code below
drwxr-xr-x. 19 root root 231 Jan 24 14:51 code

structure of /code/test below

drwxr-xr-x. 3 root root 17 Aug 6 2019 test

structure of /code/test/MSV below

drwxrwxr-x. 20 root fg_atmsv_app 250 Jan 24 14:32 MSV

please let me know, thanks.

java – Tomcat 9.0.35 with JDK 11 behind a IIS 8.5 ISAPI redirector

I am trying to install Tomcat 9.0.35 using JDK 11 on Windows 2012 R2 VM. This will an upgrade from Tomcat 9.0.11 and JDK 10. I am having issues with ISAPI Redirect. I see the following errors in ISAPI logs:

(2912:2028) (info) jk_open_socket::jk_connect.c (815): connect to failed (errno=61)
(2912:2028) (info) ajp_connect_to_endpoint::jk_ajp_common.c (1064): (tom9) Failed opening socket to ( (errno=61)
(2912:2028) (error) ajp_send_request::jk_ajp_common.c (1724): (tom9) connecting to backend failed. Tomcat is probably not started or is listening on the wrong port (errno=61)
(2912:2028) (info) ajp_service::jk_ajp_common.c (2774): (tom9) sending request to tomcat failed (recoverable), because of error during request sending (attempt=2)
(2912:2028) (error) ajp_service::jk_ajp_common.c (2795): (tom9) connecting to tomcat failed (rc=-3, errors=3, client_errors=0).
(2912:2028) (error) HttpExtensionProc::jk_isapi_plugin.c (2123): service() failed with http error 503 

My AJP connector in Server.XML looks like this:

<Connector port="7009" redirectPort="8443" protocol="AJP/1.3" secretRequired="false" address="::1"/>

Does anyone know what changed in latest version of Tomcat and/or JDK?

java – In my Spring MVC project, Tomcat takes 3 to 4 minutes to start / restart, how can it be improved?

I am using two databases MySql and MongoDB with the Spring MVC project. I checked my console and my log, it is taking too long for the MongoDB connection.

1.MySql connection code

public DataSource restDataSource() {
    final BasicDataSource dataSource = new BasicDataSource();
    return dataSource;

public HibernateTransactionManager transactionManager(final SessionFactory sessionFactory) {
    final HibernateTransactionManager txManager = new HibernateTransactionManager();
    return txManager;

2.MongoDB connection code

public MongoDbFactory mongoDbFactory() throws UnknownHostException, {
   return new SimpleMongoDbFactory(new MongoClientURI("mongodb://localhost:27017/dbname"));

public MongoTemplate mongoTemplate() throws UnknownHostException, {
    return new MongoTemplate(mongoDbFactory());

Am I doing it the right way or not?

Normalization of path with semicolon in Tomcat

I observed a path normalization problem in the tomcat when I passed "..;"in the URL. I tested this with Nginx and Apache-tomcat-10.0.0-M4. I was able to access the file directories which are not allowed in the Nginx. Please find the screenshots below for more information,

  1. Configuration of Nginx:

Configuration of Nginx:

As per the above configuration, I have enabled / app / context path only in Nginx.

  1. I created two directories called App (contains test.html) and App2 (contains test2.html) in the Tomcat ROOT directory.

enter description of image here

  1. According to the Nginx configuration above, it only allows access to app / test.html. But using the semicolon it is also possible to access the app2 / test2.html file.

Normal behavior

enter description of image here

Behavior with semicolon

enter description of image here

According to the screenshot above, it is allowed to access the test2.html page via Nginx with the semicolon, even the app2 context path is not defined in the Nginx configuration. Please also note that I verified this behavior without the Nginx and that it was rated the same behavior. I was able to reproduce this number directly in the Tomcat 9.0.12 and Tomcat 10.0.0-M4.

enter description of image here

enter description of image here

Is this already a known problem? or is this normal behavior at Tomcat level? A similar issue was discussed in Blckhat (see the link below for more details).

When to choose nginx on Apache tomcat or vice versa?

Apache Tomcat or Undertow are all a class of servers called web containers. These specialize in the life cycle of a deployed Java application or a java byte code.
Nginx or even Apache servers are an interface, most of the time don't worry about the class to load, etc. or to my knowledge does not have these responsibilities. Instead, it is just front-end servers that divert traffic by a different strategy when you have a bunch of services running.

Let's go one by one on your questions.

I can't understand where Nginx could work better than Tomcat or other web servers

The two are for different purposes and Nginx can scale better and is good for serving static pages and redirects to real web servers.

How Nginx is able to evolve well

Too broad a question. At a high level, Nginx uses an event-driven architecture to manage requests and thus maintains good resource management on simultaneous requests.

Please suggest me a good use case or business need where you can adopt Nginx on tomcat or other web servers

Load balancing, image services, JS and html for a single page application.

If Nginx is built on a model based on asynchronous events – will there be an increase in client wait time? How would the request be prioritized here and queued?

There is no simpler way to prioritize one request over the other. Since requests are all processed in an event loop, the maximum response time of final services decides how long it takes to process requests.

tomcat – Path to component not found in Angular

i use import {RouterModule, Routes} from '@ angular / router'; to generate a route, in localhost it works for me but when I pass it to tomcat it does not find the route that I generate.

module app

const rutas: Routes = [
    path: 'wsp/client-id/:id',
    component: wspComponent

HTML menu: