Best Practices while Using Tomcat
Below article will help you understand the Top best practices that are in use while utilizing Tomcat
Best Practice 1:
- Installation of Tomcat is pretty straight-forward but a point to note is to use a suitable path (the %CATALINA_HOME% that we set on the environment variables) which do not contain white spaces.
- Reason to honor this practice is that it might cause issues when you try starting Tomcat as a Web Server.
Best Practice 2:
- Tomcat should never be run as a PRIVILEGED user on any operating system (root on UNIX/LINUX, or Local System on Windows), it should be run as a low privilege user ONLY.
- Ideally, it should be run as a user created only for the purpose of running only one application.
Best Practice 3:
- It is a considered a good practice not to load any libraries/packages other than the standard ones that are distributed along with Tomcat using the Commons loader.
- Can cause loads of compatibility issues on a longer run.
- If there is a need that you need to share a single jar/library amongst several other applications, it is a good idea to create a “shared/lib” or a “shared/classes” directory and configure under the SHARED Loader in the properties.
Best Practice 4:
- Place your JDBC drivers as a shared library.
- These should be directly placed under the %CATALINA_HOME%/lib folder only.
Best Practice 5:
- If you’re finding yourself configuring CLASSPATH rather frequently, then we suggest you rethink your development process.
- It is suggested to use Tomcat, which is recommended by Apache.
I hope this article has helped you in terms of refreshing your knowledge. Please subscribe to our newsletter to stay up to date with the technology trends.
Read more on: