Tuesday, November 9, 2010

Setting up Tomcat server adapter in Eclipse on Ubuntu

  • Tomcat 6 / Eclipse Galileo 3.5 / Ubuntu 10
  • Installed tomcat6-user (so that I've got user instance/control rather than a general ubuntu service).
  • Tomcat 'runtime' installed to '/usr/share/tomcat6'
  • Created local Tomcat instance in '~/tomcat/my-instance' using 'tomcat6-instance-create my-instance'; as per 'https://help.ubuntu.com/10.04/serverguide/C/tomcat.html'
  • Some Tomcat config in '/etc/tomcat6'
  • Eclipse doesn't recognise Tomcat 6 server adapter and won't create an instance of this server.
  1. To get Eclipse to recognise Tomcat 6 server adapter
  2. To create an instance of this server for use by Dynamic Web Projects.
What worked:
  1. Instead of 1 & 2 below, tried linking to the bin and lib directories in /usr/share/tomcat6 from my local app instance (~/tomcat/my-instance/conf) (i.e. cd ~/tomcat/my-instance; ln -s /usr/share/tomcat6/bin bin). Then 'sudo chmod -R +rx /usr/share/tomcat6'. Pointing the Eclipse server adapter at '~/tomcat/my-instance' now recognises this as a valid adapter. Mission #1 accomplished. However still doesn't let me create a server instance. Hmm.
  2. Checked the Error Log, which said "Could not load the Tomcat server configuration at ~/tomcat/my-instance/conf", which was caused by a FileNotFoundException on "conf/catalina.policy". Ah-ha! 'cd conf; touch catalina.policy'. Bingo! All good. Mission #2 accomplished.
  3. TODO - Got an empty security policy, will need locking down in production.
What else I tried:
  1. As per stackoverflow, tried linking to my local app instance (~/tomcat/my-instance/conf) from the tomcat runtime (/usr/share/tomcat6) but didn't help much. Undo.
  2. Looked at eclipse wiki and eclipse forums but my Tomcat install had 'lib/servlet-api.jar' so those didn't seem relevant.

No comments:

Post a Comment