I am having some trouble connecting with mod_jk to my Tomcat instance. The
requests seem to be processed by mod_jk but are never forwarded to Tomcat. I
keep getting this trace message from mod_jk.log file "missing uri map for
127.0.0.1:/hello".

(see formatted config listings at
http://www.jroller.com/RickHigh/entry/problem_configuring_mod_jk_apache)


I can access /hello context directly from Tomcat using localhost:8080/hello
or 127.0.0.0/hello. I'd like to be able to access it through Apache2 from
localhost/hello or 127.0.0.0/hello, but I get a 404 and then the above trace
message instead.

I get no errors in the Apache error.log or Tomcat logs or mod_jk.log. I just
get a 404 and when I turn on tracing, I get the above message which
indicates that mod_jk is alive and communicating with Apache, but not
recognizing the URI I mapped for my worker.

Here are the versions:

Tomcat 6.0.20, mod_jk 1.2.28, Apache HTTPD 2.2.11, Ubuntu 9.0.9, java
version "1.6.0_16"


mod_jk.log log shown as follows:

csmad...@csm-dev:/etc/apache2$ tail -n 5 -f  /var/log/apache2/mod_jk.log
[Thu Jan 14 12:03:47 2010] [27585:3066162064] [debug]
jk_map_to_storage::mod_jk.c (3579): missing uri map for 127.0.0.1:/examples
[Thu Jan 14 14:15:19 2010] [27584:3066162064] [debug] jk_translate::mod_jk.c
(3419): missing uri map for 127.0.0.1:/hello
[Thu Jan 14 14:15:19 2010] [27584:3066162064] [debug]
jk_map_to_storage::mod_jk.c (3579): missing uri map for 127.0.0.1:/hello
[Thu Jan 14 14:15:19 2010] [27584:3066162064] [debug] jk_translate::mod_jk.c
(3419): missing uri map for 127.0.0.1:/favicon.ico
[Thu Jan 14 14:15:19 2010] [27584:3066162064] [debug]
jk_map_to_storage::mod_jk.c (3579): missing uri map for 127.0.0.1:
/favicon.ico
__________________________________________________________


Included below is server.xml for tomcat, httpd.conf for Apache2, mod_jk.conf
for Apache2, workers.properties for mod_jk, uriworkermap.properties.

(I tried this with and without uriworkermap.properties.)


Here is my server.xml setup for tomcat:

csmad...@csm-dev:~/tools/tomcat/apache-tomcat-6.0.20/conf$ cat server.xml

<?xml version='1.0' encoding='utf-8'?>
<Server port="8005" shutdown="SHUTDOWN">

  <Listener className="org.apache.catalina.core.AprLifecycleListener"
SSLEngine="on" />
  <Listener className="org.apache.catalina.core.JasperListener" />
  <Listener className="org.apache.catalina.mbeans.ServerLifecycleListener"
/>
  <Listener
className="org.apache.catalina.mbeans.GlobalResourcesLifecycleListener" />


  <GlobalNamingResources>
    <Resource name="UserDatabase" auth="Container"
              type="org.apache.catalina.UserDatabase"
              description="User database that can be updated and saved"
              factory="org.apache.catalina.users.MemoryUserDatabaseFactory"
              pathname="conf/tomcat-users.xml" />
  </GlobalNamingResources>


  <Service name="Catalina">

    <Connector port="8080" protocol="HTTP/1.1"
               connectionTimeout="20000"
               redirectPort="8443" />


    <Connector protocol="org.apache.coyote.http11.Http11NioProtocol"
           port="8443" minSpareThreads="5" maxSpareThreads="75"
           enableLookups="true" disableUploadTimeout="true"
           acceptCount="100"  maxThreads="200"
           scheme="https" secure="true" SSLEnabled="true"

keystoreFile="/home/csmadmin/tools/tomcat/apache-tomcat-6.0.20/conf/certs/key.cert"
   keystorePass="corventis"
           clientAuth="false" sslProtocol="TLS"/>


    <Connector port="8009" protocol="AJP/1.3" redirectPort="8443" />


    <Engine name="Catalina" defaultHost="localhost">


      <Realm className="org.apache.catalina.realm.UserDatabaseRealm"
             resourceName="UserDatabase"/>

      <Host name="localhost"  appBase="webapps"
            unpackWARs="true" autoDeploy="true"
            xmlValidation="false" xmlNamespaceAware="false">
      </Host>
 <Listener className="org.apache.jk.config.ApacheConfig"
             modJk="/usr/lib/apache2/modules/mod_jk.so" />
    </Engine>
  </Service>
</Server>
Please notice that I have the Connector setup to 8009

<Connector port="8009" protocol="AJP/1.3" redirectPort="8443" />
Please also noticed that I have the listener configured.

<Listener className="org.apache.jk.config.ApacheConfig"
             modJk="/usr/lib/apache2/modules/mod_jk.so" />


____________________________________________________


Apache setup for mod_jk is as follows:

httpd.conf

csmad...@csm-dev:/etc/apache2$ cat httpd.conf

LoadModule jk_module /usr/lib/apache2/modules/mod_jk.so
JkWorkersFile /etc/apache2/workers.properties
JkShmFile     /var/log/apache2/mod_jk.shm
JkLogFile     /var/log/apache2/mod_jk.log
JkOptions +ForwardKeySize +ForwardURICompat -ForwardDirectories
JkMountFile /etc/apache2/uriworkermap.properties
JkLogLevel    trace
JkLogStampFormat "[%a %b %d %H:%M:%S %Y] "
JkMount  /hello/* worker1

# Send servlet for context /examples to worker named worker1
JkMount  /examples/servlet/* worker1
# Send JSPs  for context /examples to worker named worker1
JkMount  /examples/*.jsp worker1

Alias /examples /tools/tomcat/apache-tomcat-6.0.20/webapps/examples

_______________________________________________________-

Notice that I have a small webapp that runs standalone called hello. I would
like to manage this webapp such that Apache serves the static data. (We have
real apps, but hello is just a test app for documenting our configuration).

(I tried this without/with Alias /examples
/tools/tomcat/apache-tomcat-6.0.20/webapps/examples Examples are also 404
through Apache, but work through Tomcat directly.)

Here is the workers.properties file.

/etc/apache2/workers.properties

csmad...@csm-dev:/etc/apache2$ cat workers.properties
# Define 1 real worker using ajp13
worker.list=worker1
# Set properties for worker1 (ajp13)
worker.worker1.type=ajp13
worker.worker1.host=127.0.0.0
worker.worker1.port=8009

_______________________________________________________

The above is fairly vanilla, pretty much cut & paste out of the how-to guide
for the impatient. I tried with worker.worker1.host=localhost. This did not
work either.


Here is the /etc/apache2/uriworkermap.properties

csmad...@csm-dev:/etc/apache2$ cat uriworkermap.properties
/hello=worker1
/hello/*=worker1

_______________________________________

And just for prosperity and completeness here is the Apache2.conf file


csmad...@csm-dev:/etc/apache2$ cat apache2.conf
ServerRoot "/etc/apache2"
LockFile /var/lock/apache2/accept.lock
PidFile ${APACHE_PID_FILE}
Timeout 300
KeepAlive On
MaxKeepAliveRequests 100
KeepAliveTimeout 15

<IfModule mpm_prefork_module>
    StartServers          5
    MinSpareServers       5
    MaxSpareServers      10
    MaxClients          150
    MaxRequestsPerChild   0
</IfModule>


<IfModule mpm_worker_module>
    StartServers          2
    MaxClients          150
    MinSpareThreads      25
    MaxSpareThreads      75
    ThreadsPerChild      25
    MaxRequestsPerChild   0
</IfModule>


User ${APACHE_RUN_USER}
Group ${APACHE_RUN_GROUP}

AccessFileName .htaccess


<Files ~ "^\.ht">
    Order allow,deny
    Deny from all
</Files>

DefaultType text/plain


HostnameLookups Off


ErrorLog /var/log/apache2/error.log

LogLevel debug


Include /etc/apache2/mods-enabled/*.load
Include /etc/apache2/mods-enabled/*.conf

# Include all the user configurations:
Include /etc/apache2/httpd.conf

# Include ports listing
Include /etc/apache2/ports.conf


LogFormat "%v:%p %h %l %u %t \"%r\" %>s %b \"%{Referer}i\"
\"%{User-Agent}i\"" vhost_combined
LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\""
combined
LogFormat "%h %l %u %t \"%r\" %>s %b" common
LogFormat "%{Referer}i -> %U" referer
LogFormat "%{User-agent}i" agent


CustomLog /var/log/apache2/other_vhosts_access.log vhost_combined


# Include generic snippets of statements
Include /etc/apache2/conf.d/

# Include the virtual host configurations:
Include /etc/apache2/sites-enabled/

-- 
Rick Hightower
http://www.google.com/profiles/RichardHightower

Reply via email to