I am trying to avoid putting passwords inside both the version-controlled files and the packaged files. In order to do this, I can’t have a context.xml (which contains my DB information) inside my project.
I am currently deploying my war file with the Tomcat 7.0.35 Manager because it allows to specify the file path to the context.xml file on the server.
This all works fine except that I haven’t found a way to do that in development from Netbeans 7.2.1. Therefore when I am trying to run my project in Netbeans, I get the following message
In-place deployment at (...)/trace
(...)/trace/target/trace/META-INF/context.xml (No such file or directory)
Any help for configuring Netbeans or for another way to fulfill my goal would be greatly appreciated.
I have found a suitable way to work that out for my specific situation. I have kept the
context.xmlbut used the Apache Ant-style variable substitution which is supported by Tomcat.There are several ways to define the environment variables but I chose to use the
$CATALINA_BASE/conf/catalina.propertiesfile, which seems more mainteanable to me. I also enclose acatalina.example.propertiesin my source files to document the variables expected by the application.Hope this helps someone else.