How to secure or encrypt Data Source Passwords in Tomcat ?

Solution Verified - Updated -


  • Is there a supported way to encrypt the database password that is specified on a DataSource definition within context.xml?
  • I know that you can extend the DataSource Factory that Tomcat uses to provide decryption of the password before calling the under lying factory, but is there a more robust way similar to what is provided within EAP?
  • Mask / encrypt passwords Tomcat -7?
  • Is it possible to encrypt or mask passwords for Database mentioned in context.xml and keystore password mentioned in server.xml.


  • JBoss Enterprise Web Server 1.x, 2.x
  • Tomcat 5.x, 6.x,7.x

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.

Current Customers and Partners

Log in for full access

Log In

New to Red Hat?

Learn more about Red Hat subscriptions

Using a Red Hat product through a public cloud?

How to access this content