For the specific case of a JDBC connection string, I would recommend using a Tomcat-managed connection pool instead. You can read more about doing this here: tomcat.apache.org/tomcat-5.5-doc/jndi-da....
For the specific case of a JDBC connection string, I would recommend using a Tomcat-managed connection pool instead. You can read more about doing this here: tomcat.apache.org/tomcat-5.5-doc/jndi-da... It's more work, but I think in the long run it will serve you better.
Thanks... you're probably right about the long run, but this is probably the only Tomcat app I will be working on for a long time + I don't have too much spare time to figure out how to tweak my application. The apache docs aren't very clear. – Jason S Oct 5 '09 at 20:41 this makes a little more sense now after spending time pulling my hair out (alas...) and after looking at the JIRA server.xml.
How do I access the DataSource from within my Java app, though? The example page gives an example of JSP but not of Java code. – Jason S Oct 6 '09 at 15:52 They include a couple examples further down (e.g.In the PostgreSQL section, step 4).
– Matt Solnit Oct 6 '09 at 19:25 There's another example within this question: stackoverflow. Com/questions/1119817/… – Matt Solnit Oct 6 '09 at 19:26.
For web app configuration you can place the config on the classpath somewhere. Then you can get to it from your application with getResourceAsStream or if you prefer Spring: classpath:my-config. Properties There are a number of places you can put the properties on the classpath in Tomcat.In order it looks at: /WEB-INF/classes of your web application /WEB-INF/lib/*.
Jar of your web application $CATALINA_HOME/common/classes $CATALINA_HOME/common/endorsed/*. Jar $CATALINA_HOME/common/i18n/*. Jar $CATALINA_HOME/common/lib / *.
Jar $CATALINA_BASE/shared/classes $CATALINA_BASE/shared/lib/*. Jar For example, if you put my-config. Properties both in a .
Jar file and in WEB-INF/classes the one in WEB-INF/classes will be used. You could use this mechanism to default to test config and override prod config on prod servers.
Hmm. It looks like the easiest path to getting what I want on the Java side of the application is to use Servlet. GetServletConfig().
GetInitParameter(parameterName) e.g. GetInitParameter("myApp. ConnectionString"); But I don't know where to set this. The Tomcat docs talk about various permutations of context.
Xml but I want to make sure this parameter only affects my servlet and not any others. I also don't want to locate it within my . War file so that I can keep this parameter independent of the applications (for instance if I install an upgrade).
Update: I figured it out, key/value parameters accessible by ServletContext. GetInitParameter() go here (or can go here) in ${CATALINA_HOME}/conf/server. Xml: ... ... ... This sets two parameters, "foo" = "123", "bar" = "456" for the servlet myWarFile.
War (or more accurately with the URL path /myWarFile) and I can get at them in Java with Servlet. GetServletConfig(). GetInitParameter("foo") or Servlet.
GetServletConfig(). GetInitParameter("bar"). I also looked at JIRA's server.
Xml entry (and what they tell you to set it to for MySQL), they use a Resource rather than a Parameter, not quite sure of the subtleties of this but it seems like it could be more appropriate method.
Those parameters are configured inside the servlet tag of the web. Xml file, using: init-param, param-name and param-value. Orionserver.Com/docs/web.xml.
Html – rodrigoap Oct 6 '09 at 15:23 which web. Xml file? The one in my .
War file or in ${CATALINA_HOME}/conf? If the former, I need to not do that, if the latter I don't understand the appropriate syntax. – Jason S Oct 6 '09 at 15:28.
You can add the path to your properties files in your CATALINA_HOME/conf/catalina. Properties in the "common" classloader common.loader.
I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.