Eclipse “Server Locations” section disabled and need to change to use Tomcat installation

Ok, sorry for my previous answer, I had never seen that Overview screen before. Here is how I did it: Right click on my tomcat server in “Servers” view, select “Properties…” In the “General” panel, click on the “Switch Location” button The “Location: [workspace metadata]” bit should have been replaced by something else. Open (or … Read more

Strip whitespace from jsp output

There is a trimWhiteSpaces directive that should accomplish this, In your JSP: <%@ page trimDirectiveWhitespaces=”true” %> Or in the jsp-config section your web.xml (Note that this works starting from servlet specification 2.5.): <jsp-config> <jsp-property-group> <url-pattern>*.jsp</url-pattern> <trim-directive-whitespaces>true</trim-directive-whitespaces> </jsp-property-group> </jsp-config> Unfortunately if you have a required space it might also need strip that, so you may need … Read more

CATALINA_OPTS vs JAVA_OPTS – What is the difference?

There are two environment variables – CATALINA_OPTS and JAVA_OPTS – which are both used in the catalina.sh startup and shutdown script for Tomcat. CATALINA_OPTS: Comment inside catalina.sh: # CATALINA_OPTS (Optional) Java runtime options used when the “start”, # “run” or “debug” command is executed. # Include here and not in JAVA_OPTS all options, that should … Read more

The infamous java.sql.SQLException: No suitable driver found

The infamous java.sql.SQLException: No suitable driver found This exception can have basically two causes: 1. JDBC driver is not loaded In case of Tomcat, you need to ensure that the JDBC driver is placed in server’s own /lib folder. Or, when you’re actually not using a server-managed connection pool data source, but are manually fiddling … Read more

What does “The APR based Apache Tomcat Native library was not found” mean?

It means exactly what it says: “The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path” The library referred to is bundled into an OS specific dll (tcnative-1.dll) loaded via JNI. It allows tomcat to use OS functionalities not provided in the Java Runtime (such … Read more

Recommended way to save uploaded files in a servlet application

Store it anywhere in an accessible location except of the IDE’s project folder aka the server’s deploy folder, for reasons mentioned in the answer to Uploaded image only available after refreshing the page: Changes in the IDE’s project folder does not immediately get reflected in the server’s work folder. There’s kind of a background job … Read more

Tomcat – CATALINA_BASE and CATALINA_HOME variables

If you are running multiple instances of Tomcat on a single host you should set CATALINA_BASE to be equal to the …/tomcat_instance1 or …/tomcat_instance2 directory as appropriate for each instance and the CATALINA_HOME environment variable to the common Tomcat installation whose files will be shared between the two instances. The CATALINA_BASE environment is optional if … Read more

Best TCP port number range for internal applications [closed]

I decided to download the assigned port numbers from IANA, filter out the used ports, and sort each “Unassigned” range in order of most ports available, descending. This did not work, since the csv file has ranges marked as “Unassigned” that overlap other port number reservations. I manually expanded the ranges of assigned port numbers, … Read more

Is Tomcat running?

On my linux system, I start Tomcat with the startup.sh script. To know whether it is running or not, i use ps -ef | grep tomcat If the output result contains the whole path to my tomcat folder, then it is running