Running same web application in 2 instances having separate tomcat

Answered

I am trying to run  2 IntelliJ instances with different git branches of same project.(have cloned 2 repos for the same)

To achieve same, I open 2 multiple instances of IntelliJ 2018(licensed).

I have kept 2 instances of Tomcat installations. I have done changes to the http,jmx etc ports in each individual IntelliJ instances and I can run each of them individually on IntelliJ, they get deployed to tomcat successfully.

But if I deploy to one IntelliJ(A) instance when tomcat on IntelliJ(B) is already running. It restarts the IntelliJ(B) as well.

Starting one intellij tomcat will start another one as well.

I even happened to change the shutdown port in server.xml in both the tomcat installations to keep them different

I am not clear how can I achieve this objective of running same web application in separate intellij instances?

0
3 comments

When you say 2 IntelliJ IDEA instances - do you mean you really have 2 different IDE installations? Or you just open multiple IDE windows of the same running instance?

These two Tomcat installations - did you place them into different directories and added as different Application servers in IDEs?

When the other instance is restarted - what is the output it shows? Please attach the outputs form these two Tomcat runs from both cases.

0

I open multiple instances of the same IDE installation.

Yes I have 2 tomcat installations in different folders. Added them as application server.

When I restart the IntelliJ A tomcat, below is the first thing that hits the IntelliJ B tomcat logs(which was already running).

07-Jun-2021 22:05:15.669 INFO [ContainerBackgroundProcessor[StandardEngine[Catalina]]] org.apache.catalina.startup.HostConfig.reload Reloading context [/my-web]
07-Jun-2021 22:05:15.670 INFO [ContainerBackgroundProcessor[StandardEngine[Catalina]]] org.apache.catalina.core.StandardContext.reload Reloading Context with name [/my-web] has started
07-Jun-2021 22:05:17.524 WARNING [ContainerBackgroundProcessor[StandardEngine[Catalina]]] org.apache.catalina.loader.WebappClassLoaderBase.clearReferencesThreads The web application [my-web] appears to have started a thread named [Timer-0] but has failed to stop it. This is very likely to create a memory leak. Stack trace of thread:
java.lang.Object.wait(Native Method)
java.util.TimerThread.mainLoop(Timer.java:552)
java.util.TimerThread.run(Timer.java:505)
07-Jun-2021 22:05:17.525 SEVERE [ContainerBackgroundProcessor[StandardEngine[Catalina]]] org.apache.catalina.loader.WebappClassLoaderBase.checkThreadLocalMapForLeaks The web application [my-web] created a ThreadLocal with key of type [org.springframework.core.NamedThreadLocal] (value [LocaleContext]) and a value of type [org.springframework.context.i18n.SimpleLocaleContext] (value [en]) but failed to remove it when the web application was stopped. Threads are going to be renewed over time to try and avoid a probable memory leak.
07-Jun-2021 22:05:17.526 SEVERE [ContainerBackgroundProcessor[StandardEngine[Catalina]]] org.apache.catalina.loader.WebappClassLoaderBase.checkThreadLocalMapForLeaks The web application [my-web] created a ThreadLocal with key of type [org.springframework.core.NamedThreadLocal] (value [LocaleContext]) and a value of type [org.springframework.context.i18n.SimpleLocaleContext] (value [en]) but failed to remove it when the web application was stopped. Threads are going to be renewed over time to try and avoid a probable memory leak.
07-Jun-2021 22:05:17.526 SEVERE [ContainerBackgroundProcessor[StandardEngine[Catalina]]] org.apache.catalina.loader.WebappClassLoaderBase.checkThreadLocalMapForLeaks The web application [my-web] created a ThreadLocal with key of type [org.springframework.core.NamedThreadLocal] (value [LocaleContext]) and a value of type [org.springframework.context.i18n.SimpleLocaleContext] (value [en]) but failed to remove it when the web application was stopped. Threads are going to be renewed over time to try and avoid a probable memory leak.
07-Jun-2021 22:05:17.527 SEVERE [ContainerBackgroundProcessor[StandardEngine[Catalina]]] org.apache.catalina.loader.WebappClassLoaderBase.checkThreadLocalMapForLeaks The web application [my-web] created a ThreadLocal with key of type [java.lang.ThreadLocal] (value [java.lang.ThreadLocal@1512b04e]) and a value of type [com.ibm.icu.util.ULocale] (value [en]) but failed to remove it when the web application was stopped. Threads are going to be renewed over time to try and avoid a probable memory leak.
07-Jun-2021 22:05:17.528 SEVERE [ContainerBackgroundProcessor[StandardEngine[Catalina]]] org.apache.catalina.loader.WebappClassLoaderBase.checkThreadLocalMapForLeaks The web application [my-web] created a ThreadLocal with key of type [org.springframework.core.NamedThreadLocal] (value [LocaleContext]) and a value of type [org.springframework.context.i18n.SimpleLocaleContext] (value [en]) but failed to remove it when the web application was stopped. Threads are going to be renewed over time to try and avoid a probable memory leak.
07-Jun-2021 22:05:17.529 SEVERE [ContainerBackgroundProcessor[StandardEngine[Catalina]]] org.apache.catalina.loader.WebappClassLoaderBase.checkThreadLocalMapForLeaks The web application [my-web] created a ThreadLocal with key of type [org.springframework.core.NamedThreadLocal] (value [LocaleContext]) and a value of type [org.springframework.context.i18n.SimpleLocaleContext] (value [en]) but failed to remove it when the web application was stopped. Threads are going to be renewed over time to try and avoid a probable memory leak.
07-Jun-2021 22:05:17.530 SEVERE [ContainerBackgroundProcessor[StandardEngine[Catalina]]] org.apache.catalina.loader.WebappClassLoaderBase.checkThreadLocalMapForLeaks The web application [my-web] created a ThreadLocal with key of type [java.lang.ThreadLocal] (value [java.lang.ThreadLocal@1512b04e]) and a value of type [com.ibm.icu.util.ULocale] (value [en]) but failed to remove it when the web application was stopped. Threads are going to be renewed over time to try and avoid a probable memory leak.
07-Jun-2021 22:05:17.530 SEVERE [ContainerBackgroundProcessor[StandardEngine[Catalina]]] org.apache.catalina.loader.WebappClassLoaderBase.checkThreadLocalMapForLeaks The web application [my-web] created a ThreadLocal with key of type [org.springframework.core.NamedThreadLocal] (value [LocaleContext]) and a value of type [org.springframework.context.i18n.SimpleLocaleContext] (value [en]) but failed to remove it when the web application was stopped. Threads are going to be renewed over time to try and avoid a probable memory leak.
07-Jun-2021 22:05:17.530 SEVERE [ContainerBackgroundProcessor[StandardEngine[Catalina]]] org.apache.catalina.loader.WebappClassLoaderBase.checkThreadLocalMapForLeaks The web application [my-web] created a ThreadLocal with key of type [org.springframework.core.NamedThreadLocal] (value [LocaleContext]) and a value of type [org.springframework.context.i18n.SimpleLocaleContext] (value [en]) but failed to remove it when the web application was stopped. Threads are going to be renewed over time to try and avoid a probable memory leak.
07-Jun-2021 22:05:17.532 SEVERE [ContainerBackgroundProcessor[StandardEngine[Catalina]]] org.apache.catalina.loader.WebappClassLoaderBase.checkThreadLocalMapForLeaks The web application [my-web] created a ThreadLocal with key of type [org.springframework.core.NamedThreadLocal] (value [LocaleContext]) and a value of type [org.springframework.context.i18n.SimpleLocaleContext] (value [en]) but failed to remove it when the web application was stopped. Threads are going to be renewed over time to try and avoid a probable memory leak.
07-Jun-2021 22:05:17.532 SEVERE [ContainerBackgroundProcessor[StandardEngine[Catalina]]] org.apache.catalina.loader.WebappClassLoaderBase.checkThreadLocalMapForLeaks The web application [my-web] created a ThreadLocal with key of type [org.springframework.core.NamedThreadLocal] (value [LocaleContext]) and a value of type [org.springframework.context.i18n.SimpleLocaleContext] (value [en]) but failed to remove it when the web application was stopped. Threads are going to be renewed over time to try and avoid a probable memory leak.
07-Jun-2021 22:05:17.533 SEVERE [ContainerBackgroundProcessor[StandardEngine[Catalina]]] org.apache.catalina.loader.WebappClassLoaderBase.checkThreadLocalMapForLeaks The web application [my-web] created a ThreadLocal with key of type [org.springframework.core.NamedThreadLocal] (value [LocaleContext]) and a value of type [org.springframework.context.i18n.SimpleLocaleContext] (value [en]) but failed to remove it when the web application was stopped. Threads are going to be renewed over time to try and avoid a probable memory leak.
07-Jun-2021 22:05:17.534 SEVERE [ContainerBackgroundProcessor[StandardEngine[Catalina]]] org.apache.catalina.loader.WebappClassLoaderBase.checkThreadLocalMapForLeaks The web application [my-web] created a

Also I have observed one thing.

Catalina Base that gets printed on server restarts on the both the instances point to the same location

IntelliJ A:Using CATALINA_BASE: "C:\Users\rip.jal\.IntelliJIdea2018.1\system\tomcat\Unnamed_my-web_39"
Using CATALINA_HOME: "C:\rip\abc\my\Core_Softwares\Apache3-Tomcat-8.5.51"
Using CATALINA_TMPDIR: "C:\rip\abc\my\Core_Softwares\Apache3-Tomcat-8.5.51\temp"
Intellij B Using CATALINA_BASE: "C:\Users\rip.jal\.IntelliJIdea2018.1\system\tomcat\Unnamed_my-web_39"
Using CATALINA_HOME: "C:\rip\abc\my\Core_Softwares\Apache2-Tomcat-8.5.51"
Using CATALINA_TMPDIR: "C:\rip\abc\my\Core_Softwares\Apache2-Tomcat-8.5.51\temp"
1

Cannot reproduce. It looks like you are using the same Tomcat instance. Double check you have added two different tomcat installations in Settings (Preferences on macOS) | Build, Execution, Deployment | Application Servers | Build, Execution, Deployment | Application Servers and select separate tomcat servers in Run/Debug Configurations. Try re-creating the run configurations. Try version from https://www.jetbrains.com/idea/download

0

Please sign in to leave a comment.