Showing posts with label Tomcat. Show all posts
Showing posts with label Tomcat. Show all posts

05/09/2014

[Apache Tomcat] Find server version from command line

A quick way to find Tomcat's server version from command line is to run:

java -cp catalina.jar org.apache.catalina.util.ServerInfo

from the TOMCAT_INSTALL_DIR/tomcat/lib folder

12/11/2012

Enable Tomcat remote access

To reach an application published inside Apache Tomcat using the host's IP (localhost does not work for remote access), you need to modify the server.xml file which is located under Tomcat's conf/ directory.

Look for this piece:

 <Valve className="org.apache.catalina.valves.AccessLogValve"  
 directory="logs" prefix="localhost_access_log." suffix=".txt"  
 pattern="common" resolveHosts="false"/>  


and set resolveHosts parameter to true. You may also need to add a line to the client machines' hosts file so that the IP can be resolved.

04/07/2012

[Java] JSP Jasper/Tomcat code too large for try statement error

While working on a rather large JSP with Java and Tomcat, you may have Jasper sooner or later raise the "code too large for try statement" error.

This happens if your JSP contains a lot of code, especially Java code (incapsulated in the <% %> tags) or very very long comments.
In fact, before being presented as an HTML page, the JSP is compiled and in the process, it is enclosed in a try-catch statement which, like any method, has a maximum bytecode size of 64KB (65535 bytes).

The only way to avoid this issue is to split the JSP into multiple pages and then include them using the:

<jsp:include page="file.jsp"/>

directive which compiles the page BEFORE including it instead of:

<% @include file="file.jsp" %>

which embeds the page "as is"