Monday, February 21, 2011

Class needed by SvnTask cannot be found

problem:
getting this error when trying to build:

taskdef A class needed by class org.tigris.subversion.svnant.SvnTask cannot be found: org/tigris/subversion/svnclientadapter/SVNClientException

solution:

I didnt unzip all libs that came with svnant into my lib folder. Only unzipped svnant.jar. need to put them all in there.

Sunday, February 06, 2011

Multiple domains with tomcat behind apache

This is how you would host multiple domains/webapps on a single tomcat behind apache via mod-jk.

first setup tomcat behind apache

I am setting up a new domain called dogself.com:

in server.xml add this under last host:

<Host name="dogself.com"  appBase="webapps-dogself"
  unpackWARs="true" autoDeploy="true"
  xmlValidation="false" xmlNamespaceAware="false">
<alias>www.dogself.com<alias>
</Host> 
 
and also add another connector port:
<Connector port="8010" protocol="AJP/1.3" redirectPort="8443" /> 

create a webapps-dogself directory next to webapps and give it the same permissions

in your virtualhost apache config:
ServerName dogself.com 
JkMount  /* dogself 
 
in workers.properties add dogself worker to list:
worker.list=another,dogself

# Define dogself
worker.dogself.port=8010
worker.dogself.host=dogself.com
worker.dogself.type=ajp13 

If you want the manager app to work on the domain you need to:
mkdir /etc/tomcat6/Catalina/dogself.com 

and copy the manager.xml into it from /etc/tomcat6/Catalina/localhost

in /var/lib/tomcat6 create a webapps-dogself dir and give it 0775 perms and chown it to tomcat:tomcat

restart tomcat and apache

Troubleshooting:
if you get error:
worker dogself can't resolve tomcat address dogself.com
Check that your dns a/aaaa records point to your ip. Comment out the worker in workers.properties and see if you can get to the apache vhost.

if any of the domains seems to point to another domain, ie the war that is running on one domain is incorrect. check if you are in the www.domain and if you have aliased the www both in tomcat and in apache. if you dont alias the www correctly tomcat will send you the the defaultDomain as defined in server.xml

Thursday, February 03, 2011

Linode: how to install mod_jk, tomcat behind apache

This "tutorial" is for Ubuntu 10.04 LTS (Lucid).
This is how you would set up Tomcat6 behind Apache2 via mod_jk

I am assuming that you have apache2 installed and tomcat6 installed. I also assume you have deployed and can find your tomcat app possibly on port 8080 of your linode.

  1. Install mod_jk:
    apt-get install libapache2-mod-jk
  2. Create workers.properties in /etc/apache2/ and add the following into it:
    # this lives in /etc/apache2/workers.properties
    # workers.properties - ajp13
    #
    # List workers
    worker.list=worker1
    
    # Define worker1
    worker.worker1.port=8009
    worker.worker1.host=localhost
    worker.worker1.type=ajp13
    
  3.  Edit your apache2 config in /etc/apache2/apache2.conf and add this to the end:
    # tomcat connector stuff:
    JkWorkersFile /etc/apache2/workers.properties
    # Where to put jk shared memory
    JkShmFile     /var/log/apache2/mod_jk.shm
    # Where to put jk logs
    JkLogFile     /var/log/apache2/mod_jk.log
    # Set the jk log level [debug/error/info]
    JkLogLevel    info
    # Select the timestamp log format
    JkLogStampFormat "[%a %b %d %H:%M:%S %Y] 
    
  4. In your /etc/apache2/sites-enabled/ dir find the vhost you want to use tomcat and edit it, at the end of the vhost declaration put:
    #Everything under root goes to tomcat
    JkMount  /* worker1
    #html files should be served by apache2
    JkUnMount /*.html worker1
    
  5. Edit /etc/tomcat6/server.xml and make sure that the ajp connector is uncommented:
    <connector port="8009" protocol="AJP/1.3" redirectport="8443" />
    
  6. restart tomcat: /etc/init.d/tomcat6 restart
  7. restart apache: /etc/init.d/apache2 restart
  8. navigate to yourdomain.com/ and you should be all tomcatted