0

I'm trying to configure Apache2 + Tomcat using the mod_jk on an Ubuntu 10.04. I installed everything and configured, but it always returns the source code of my JSP files. I've read around that the most possible problem is that Httpd isn't redirecting the requests to Tomcat as it should. So, tried to fix it using many tutorials and explanations, none worked for me.

The page is this one: http://dev.geradorboletos.doois.com.br/index.jsp

The httpd.conf:

Include /etc/apache2/mods-available/jk.conf

The /etc/apache2/mods-available/jk.conf:

JkWorkersFile   /etc/libapache2-mod-jk/workers.properties
JkLogFile       /var/log/apache2/mod_jk.log
JkLogLevel      info
JkMount /*.jsp geradorboletos
JkMount /* geradorboletos

The /etc/libapache2-mod-jk/workers.properties:

workers.tomcat_home=/usr/share/tomcat6
workers.java_home=/usr/lib/jvm/java-6-openjdk/jre/

ps=/

worker.list=geradorboletos
worker.geradorboletos.port=8009
worker.geradorboletos.host=localhost
worker.geradorboletos.type=ajp13
worker.geradorboletos.lbfactor=1

worker.loadbalancer.type=lb
worker.loadbalancer.balance_workers=geradorboletos

And the /etc/apache2/sites-available/geradorboletos:

<VirtualHost *:80>
        ServerAdmin webmaster@localhost
        ServerName dev.geradorboletos.doois.com.br

        DocumentRoot /var/lib/tomcat6/webapps/geradorboletos/
        <Directory />
                Options FollowSymLinks
                AllowOverride None
        </Directory>

        <Directory /var/lib/tomcat6/webapps/geradorboletos/>
                Options Indexes FollowSymLinks MultiViews
                AllowOverride All
                Order allow,deny
                allow from all
        </Directory>

        ErrorLog /var/log/apache2/geradorboletos-error.log

        # Possible values include: debug, info, notice, warn, error, crit,
        # alert, emerg.
        LogLevel warn

        CustomLog /var/log/apache2/geradorboletos-access.log combined

</VirtualHost>

Does anyone know how to solve this?

Thanks in advance!

1 Answer 1

1

mod_jk directives aren't inherited by virtual hosts by default. Either move the mod_jk directives inside the virtual host or use the JkMountCopy directive. See the mod_jk docs for details.

If that still doesn't work, take a look at the mod_jk log. You may wish to turn it up to debug level until things are working as required. While you are at it, cleaning up your workers.properties wouldn't hurt:

  • remove the workers.* properties that don't do anything
  • remove the ps=/ line
  • remove the load balancing entries you aren't using

They are probably not causing the problem but they certainly aren't helping. Keep things as simple as possible until it works.

3
  • Which directives? All of them? If you said about JkMount, the result is the same.. =/ May 9, 2012 at 15:53
  • As per the docs I linked you to, it varies by directive but JkMount and JkUnmount are the main ones. I'll update the answer with some further info. May 9, 2012 at 16:09
  • The docs were the first place I went, but they just say what which directive do, not how. The examples they provide, when provide, are horrible, just make sense to users experienced on it. =/ I still trying to make things work, but they still, actually, the same... >< May 9, 2012 at 18:22

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .