How to avoid storing passwords in the clear for tomcat’s server.xml Resource definition of a DataSource?

As said before encrypting passwords is just moving the problem somewhere else. Anyway, it’s quite simple. Just write a class with static fields for your secret key and so on, and static methods to encrypt, decrypt your passwords. Encrypt your password in Tomcat’s configuration file (server.xml or yourapp.xml…) using this class. And to decrypt the … Read more

Enabling SSL on tomcat using pem file

While most answers concentrate on versions 7.0 and 8.0 of Tomcat that were supported at the time of the question, since version 8.5.2 (May 2016) it is possible to use PEM files directly without conversion to a PKCS12 file. You can either: put the PEM encoded private key and all certificates in the order from … Read more

tomcat auto start servlet [duplicate]

you could use the servlet context listener. More specifically you could start your thread in the contextInitialized method: import javax.servlet.ServletContextEvent; import javax.servlet.ServletContextListener; public class MyListener implements ServletContextListener { public void contextInitialized(ServletContextEvent sce) { // start the thread } public void contextDestroyed(ServletContextEvent sce) { // stop the thread } } then add: <listener> <description>ServletContextListener</description> <listener-class>MyListener</listener-class> </listener> … Read more

SSL, Tomcat and Grails

How to set this up depends how you are deploying your grails app. If you are deploying to a container like tomcat, install and configure SSL as you normally would. Then just build a war file with grails war and deploy normally. For tomcat in particular, open the top level tomcat server.xml and add an … Read more

How does Tomcat find the HOME PAGE of my Web App?

In any web application, there will be a web.xml in the WEB-INF/ folder. If you dont have one in your web app, as it seems to be the case in your folder structure, the default Tomcat web.xml is under TOMCAT_HOME/conf/web.xml Either way, the relevant lines of the web.xml are <welcome-file-list> <welcome-file>index.html</welcome-file> <welcome-file>index.htm</welcome-file> <welcome-file>index.jsp</welcome-file> </welcome-file-list> so … Read more

What is the difference between Tomcat’s BIO Connector and NIO Connector?

NIO and Comet are completely unrelated: you can mix-and-match them. Using the NIO (or APR for that matter) connector allows you to handle more requests with fewer threads due to the threading model. See http://tomcat.apache.org/tomcat-7.0-doc/config/http.html#Connector_Comparison for a comparison between the Connectors. Comet (and Websocket) have a completely different dispatch model which requires a different application … Read more

JBoss vs Tomcat again [closed]

First the facts, neither is better. As you already mentioned, Tomcat provides a servlet container that supports the Servlet specification (Tomcat 7 supports Servlet 3.0). JBoss AS, a ‘complete’ application server supports Java EE 6 (including Servlet 3.0) in its current version. Tomcat is fairly lightweight and in case you need certain Java EE features … Read more