Configuration Resources often need to be stored with your web application. These are consumed either by your application server, or libraries in your application (such as Hibernate).

  • These locations are based on using a directory structure generated by Maven Tapestry 5 Archetype. At the time of this writing, this is the typical way to start working on a Tapestry 5 project. If your structure looks different, you will need to make changes accordingly.
  • Things that can go in
    src/main/resources
    1. hibernate.cfg.xml or hibernate.properties when using Hibernate. 2. log4j.properties when using Log4J as your logger. 3. applicationContext.xml, when using Spring. (can also go in web.xml) 4. applicationContext-acegisecurity.xml, when using Spring to configure Acegi. (can also go in web.xml)

  • Things that can go in
    src/main/webapp/META-INF
    1. context.xml, as used for Tomcat. In here you can put your JNDI resource settings as referenced in your web.xml. These will get appended to the server.xml file in the %Tomcat_Home%/conf directory. If you want a different context.xml for different servers you deploy to, keep reading.

  • Things that can go in
    src/main/webapp/WEB-INF
    1. web.xml, as used by web application containers (Tomcat/Jetty, etc) In here you can put your context parameters, filters and filter mappings, and JNDI resource references. 2. app.properties, the application wide message catalog. Use this for defining the labels for buttons, field labels and more.

  • Different Context.xmls for different servers
    For Tomcat 5+ it is not recommended to put contextual information in the %Tomcat_Home%/conf/server.xml
    Instead, you should create a separate context.xml and place it in %Tomcat_Home%/conf/context.xml
    In some cases (Such as Eclipse Ganymede), the "%Tomcat_Home%/conf/context.xml" will get overwritten on deployment, if you are deploying straight to the Tomcat installation. So it is actually preferable to put the contents of context.xml into a file
    "%Tomcat_Home%\conf\Catalina\localhost\context.xml.default"
    Note that this means the contents will be shared for all web apps served by Tomcat, which may be good for things like JNDI references.



  • No labels