Saturday, December 6, 2008

Changing appBase in Tomcat 6

AppBase is the location where the Tom cat server searches for jsp files when called by a client. Default location is the webapps folder in tom cat home.

Changing this appBase involves bit of identifying the architecture of tom cat.

First thing you should remember is that every web application you are going to deploy should be in a separate folder. You cannot directly use that folder as the appBase. Instead you have to use parent folder.

eg: If your web application is at C:/myWebApps/firstwebApp, you have to use C:/myWebApps as the appBase.

Then calling the file C:/myWebApps/firstwebApp/hello.jsp can be done by http://localhost:8080/firstwebApp/hello.jsp


If you want to call the file C:/myWebApps/firstwebApp/hello.jsp just typing the URL http://localhost:8080/hello.jsp you have to rename the folder 'firstwebApp' with 'ROOT'.

Sorry for the lengthy description but first things first.

Then how to change the appBase.

  • Open conf/server.xml file in the tomcat home foulder.
  • Find the line containing Host name="localhost" appBase="webApps"
  • Change webApps with the parent folder of your web application folder.
  • Restart tomCat

No comments: