Tuesday, June 20, 2006

tomcat 5.x onwards - context element

There are probably tons of documentations available on tomcat's site regarding the basic configuration of Tomcat.

One major change you may want to take note (and the documents seems to miss out on that) is that :
  • the <context> element does not exist in server.xml anymore.
    you can either:
    • create a context.xml document in your web app's META-INF folder. (yes, create a META-INF) folder
    • or under the /conf/Catalina/localhost folder, create a .xml
I will recommend the first method... seems neater
An e.g of context.xml

<context path="/test" docbase="${catalina.home}/webapps/test">

<!-- Link to the Datasource declared in the server.xml -->
<resourcelink name="jdbc/rhymesdb" global="rhymesdb"
type="javax.sql.DataSource">

</resourcelink>


I will talk about creating of datasources later

forewords......

I have gathered quite some notes over the years while I toiled and sweat in projects working with technologies like J2EE, web applications, java, j2me, databases, operating systems, app servers to the more recent RFID and ajax stuffs... I had my fair share of frustrations trying to solve problems; wasting endless hours searching high and low for solutions etc.... recently i realise that my ailing brain is having problem remembering everything...so I better start writing them down somewhere...