Arquivo da categoria: Tomcat

Dando alto start no Tomcat caso esteja fora do AR

r=`wget -q localhost:8080`
if [ $? -ne 0 ]
  then /opt/tomcat/bin/
  else echo "OK"

Depois de criar esse arquivo dê permissão de executável.

sudo chmod +x

Para finalizar coloque ele para ser chamado no crontab.

Tomcat – java.lang.OutOfMemoryError: PermGen space

Apache Tomcat is widely used Web Container in the world. Very big companies run on Apache Tomcat now a days. There are quite a few other alternatives like IBM WebSphere, Geronimo, IIS, etc. but Tomcat is my favorite one too.

It’s very critical for us to configure all correct parameters while running your application in Production environment or even in development env.

In this tutorial we will go over steps on how to configure -Xms, -Xmx and -XX:PermSize value for Tomcat server. Let’s first understand few terms.


Specifies the maximum size, in bytes, of the memory allocation pool. This value must a multiple of 1024 greater than 2MB. Append the letter k or Kto indicate kilobytes, or m or M to indicate megabytes. The default value is 64MB. The upper limit for this value will be approximately 4000m on Solaris 7 and Solaris 8 SPARC platforms and 2000m on Solaris 2.6 and x86 platforms, minus overhead amounts. So, in simple words, you are saying Java to use Maximum of 1024 MB from available memory.

NOTE: there is NO SPACE between -Xmx and 1024m


It’s a size of the heap for the young generation.


It’s used to set size for Permanent Generation. It is where class files are kept.

Another must readChange -Xmx value of Tomcat in Eclipse IDE

Let’s get started:

Below are the simple steps to change -Xmx / -Xms values or other JVM parameters if you are running Tomcat from command prompt.


Download Apache Tomcat.


Go to Apache Tomcat /bin directory.

Create file for Tomcat Xmx and Xmn value - Crunchify Tips


By default you wont see (for Linux/Mac) or setenv.bat (for windows) file under /bin directory. You have to create one with below parameters.


  1. Go to command prompt.
  2. Go to <Tomcat Directory>/bin directory
  3. Execute command: ./ run

Run Apache Tomcat using run command - Crunchify


Monitor logfile and you should see your Tomcat started with all your specified parameters in file.

Apache Tomcat Log with Xmx and Xmn value - Crunchify Tips

PS: For Windows environment you need to create setenv.bat file and run Tomcat with catalina.bat

Join the Discussion

Share & leave us some comments on what you think about this topic or if you like to add something.

How to stop Logging on Apache Tomcat6 or Tomcat7 solr server to catalina out

So, according to documentation all logging functionality can be manipulated in file which is usually located under apache tomcat root installation folder, which in ubuntu case is under /etc/tomcat6/…

Opening a file you’d probably spot logging level settings (set to FINE as default), well We want to get rid of logging at all, so, according to this helping post I needed to change ConsoleHandler level to OFF.

I changed;

java.util.logging.ConsoleHandler.level = FINE


java.util.logging.ConsoleHandler.level = OFF

And happily I got the result Apache Tomcat6 solr server stopped logging to catalina.out

Spring Boot Tomcat Configuration, migration from container to embedded

I’m migrating a Spring boot application that used to run in the Tomcat container to a Spring Boot application that runs an embedded Tomcat. My old Tomcat configuration has these configurations in the server.xml:
[code type=xml]

I was able to set up most of the properties using a bean
[code type=java]
public EmbeddedServletContainerFactory embeddedServletContainerFactory() {
TomcatEmbeddedServletContainerFactory tomcatEmbeddedServletContainerFactory = new TomcatEmbeddedServletContainerFactory();
tomcatEmbeddedServletContainerFactory.addConnectorCustomizers((TomcatConnectorCustomizer) connector -> {
AbstractHttp11JsseProtocol handler = (AbstractHttp11JsseProtocol)connector.getProtocolHandler();

return tomcatEmbeddedServletContainerFactory;

[code type=properties]
server.tomcat.accept-count = 500
server.tomcat.max-threads = 600
server.port = 8080
server.max-http-header-size = 32768
server.connection-timeout = 20000

However I cannot figure out how to set this part
[code type=properties]
server=”My server”

Can anyone help me please? Thank you

Try this:
[code type=java]
connector.setProperty(“useComet”, Boolean.toString(false));
connector.setProperty(“socket.appReadBufSize”, “87380”);
connector.setProperty(“socket.rxBufSize”, “87380”);
connector.setProperty(“socket.performanceConnectionTime”, “2”);
connector.setProperty(“socket.performanceLatency”, “0”);
connector.setProperty(“socket.performanceBandwidth”, “1”);
connector.setProperty(“server”, “My server”);