Tomcat and VM

I am really confused in understanding where tomcat really works. Does it run inside JVMs that run servlets. Or it has its own virtual machine when running a servlet or JSP.

Thanks in advance.

+3
source share
4 answers

Tomcat will run in the JVM, and servlets are executed in the Tomcat process (in the same JVM).

Launch Catalina.sh (or .bat) will launch a new JVM for Tomcat to launch. You can load / run Tomcat programmatically within the existing JVM if you need a web server as part of a larger application.

+13
source

Java provides a JVM to run any Java application.

Tomcat - , , Java, .

, ( ) Java JRE Tomcat.

+3

This is a confusing topic, since the "appearance" of individual JVMs is sometimes confused with different instances of the class loader.

Tomcat and your applications (WARs or servlets) use the same JVM, but they use independent class loaders - this is why you can use 2 WARs using different versions of something like log4J, and all this is good. Here's an O'Reilly article on the class loader .

+3
source

Tomcat and all servlets run inside the JVM.

0
source

Source: https://habr.com/ru/post/1710754/


All Articles