Saturday, June 6, 2009

Setup a Tomcat server in Ubuntu

Install the required packages (either using "apt-get install" in the terminal or from the package manager), then follow the instructions to configure it:
  • tomcat5.5
  • tomcat5.5-admin
  • tomcat5.5-webapps
  • sun-java6-jdk
Tomcat needs to know where the jdk is.
Open /etc/default/tomcat5.5 in a text editor.
Change the line that starts:

#JAVA_HOME.

to read:

JAVA_HOME=/usr/lib/jvm/java-6-sun

** This assumes that you have java 6 installed. Check that you have that folder.


Update the tomcat security policy:

sudo gedit /etc/tomcat5.5/policy.d/03catalina.policy

At the very end of the file, add the lines:

grant {
permission java.net.AllPermission;
permission java.net.SocketPermission "localhost:3306", "connect";
};


Next you need to import a .jar into your Tomcat. To do so go to http://dev.mysql.com/downloads/connector/j/5.1.html and download the tar file. When it asks if you have registered look below and where it says 'No Thanks'. Double click on the downloaded tar file and extract. Go into the newly created folder and run:

sudo cp mysql-connector-java-5.1.5-bin.jar /usr/share/tomcat5.5/server/lib/

This will copy that jar file into the library for jsp.

Restart your tomcat server:

sudo /etc/init.d/tomcat5.5 restart

No comments:

Post a Comment