Showing posts with label tomcat. Show all posts
Showing posts with label tomcat. Show all posts

Monday, May 23, 2016

Make web application start up faster

To make web application start up faster in Tomcat, you may consider the following tuning:

  1. Add metadata-complete="true" as an attribute in <web-app> tag
  2. Add <absolute-ordering/> inside <web-app> </web-app>

Tuesday, July 15, 2014

Setting Tomcat JVM in service mode

Running Tomcat (Service mode) with default Java Virtual Machine (JVM) could cause some strange problem sometimes. It's because your own development may depends on a particular VM (e.g. the HotSpot VM). In this case, you will need to specify the JVM instead of using the default one.

To do this, run the tomcat7w.exe in TOMCAT_HOME\bin\, and select the the Java tab. You will find the Java Virtual Machine option as shown below:


Monday, May 28, 2012

JSP too large for Tomcat

A long JSP just worked in Tomcat 6.0.29. Somehow when we put it in 6.0.35, it got error "Unresolved compilation problem".

It seems that the new Jasper (/lib/ecj-3.7.jar) just not work for large JSP. One of the solution will be using the Jasper from 6.0.29 (/lib/jasper-jdt.jar) instead.

Or.. keep using the 6.0.29 for some while...

Wednesday, February 8, 2012

Solution for java.io.NotSerializableException error when Tomcat reloads

To solve the Tomcat restart error, add <Manager> setting in <Context> section:

<Manager className="org.apache.catalina.session.PersistentManager" 
         saveOnRestart="false">
    <Store className="org.apache.catalina.session.FileStore"/>
</Manager>


References:

Thursday, January 5, 2012

Determine user in Tomcat

To determine user authentication info in Tomcat, we can use the following:

getRemoteUser()
isUserInRole(String role)

Both methods are under javax.servlet.http.HttpServletRequest.

Tuesday, November 29, 2011

Some options for Tomcat 6

Not much options found, but I drop down the useful ones for reference. Note that those options should be assigned to the CATALINA_OPTS. Actually, you may put them in catalina.bat.

  • Startup memory size
    -Xms256m
  • Maximum memory size
    -Xmx256m
  • Garbage collection path
    -Xloggc:/gc.log
  • Disable DNS caching
    -Dsun.net.inetaddr.ttl=0
  • Skip quote escape checking (If you have tag like this <mytags:tag value="<%= "hi!" %>" /> , which is validate in Tomcat 5 before. In Tomcat 6, you may need to turn on the following option to prevent running into error. Ref: http://www.andowson.com/posts/list/346.page)
    -Dorg.apache.jasper.compiler.Parser.STRICT_QUOTE_ESCAPE=false
  • Turn on JMX remote
    -Dcom.sun.management.jmxremote
    -Dcom.sun.management.jmxremote.port=9004
    -Dcom.sun.management.jmxremote.authenticate=false
    -Dcom.sun.management.jmxremote.ssl=false
  • Set default Tomcat language / locale to English
    -Duser.language=en

Wednesday, November 2, 2011

Debug mode in Eclipse and Tomcat

For Tomcat:
  set JPDA_ADDRESS=8000
  set JPDA_TRANSPORT=dt_socket
  catalina.bat jpda start

For Eclipse:
  Set Connection Port (8000) and Connection Host (localhost) in "Run > Debug Configurations"
  Configuration Type: "Remote Java Application"
  Set connection port to "8000"
  Set connection host to "localhost"

CSP on Apache

To add CSP to root if sort of funny. The following will NOT work for most cases !!     <LocationMatch "^/$">        Header s...