View previous topic :: View next topic |
Author |
Message |
chy168 n00b
Joined: 12 Mar 2005 Posts: 70
|
Posted: Tue Sep 27, 2005 4:44 pm Post subject: use mod_jk connector to tomcat5, The reque is not available |
|
|
Hi,
I use 'mod_jk' to process my JSP file.
my web server is apache2 and tomcat5
Apache2 and Tomcat5 can run well both.
I even try 'localhost:8080' to check tomcat is fine.
but when I try http://localhost/~chy168/test.jsp
I got some error message:
Code: | The requested resource (/~chy168/tesst.jsp) is not available. |
how could I help my tomcat ?
thank you |
|
Back to top |
|
|
dgaffuri Advocate
Joined: 05 Jun 2005 Posts: 2078 Location: Italy
|
Posted: Tue Sep 27, 2005 4:57 pm Post subject: |
|
|
May you check apache and tomcat error logs and post the relevant part of configuration files? |
|
Back to top |
|
|
chy168 n00b
Joined: 12 Mar 2005 Posts: 70
|
Posted: Tue Sep 27, 2005 6:15 pm Post subject: |
|
|
in the 'mod_jk.log',
there are a lot of mesg:
Code: |
[Wed Sep 28 02:08:57 2005] [0398:16384] [debug] map_uri_to_worker::jk_uri_worker_map.c (442): Attempting to map URI '/~chy168/test.jsp' from 2 maps
[Wed Sep 28 02:08:57 2005] [0398:16384] [debug] map_uri_to_worker::jk_uri_worker_map.c (454): Attempting to map context URI '/*.jsp'
[Wed Sep 28 02:08:57 2005] [0398:16384] [debug] map_uri_to_worker::jk_uri_worker_map.c (468): Found a wildchar match ajp13 -> /*.jsp
[Wed Sep 28 02:08:57 2005] [0398:16384] [debug] jk_handler::mod_jk.c (1814): Into handler jakarta-servlet worker=ajp13 r->proxyreq=0
[Wed Sep 28 02:08:57 2005] [0398:16384] [debug] wc_get_worker_for_name::jk_worker.c (111): found a worker ajp13
|
but in '/tomcat5/logs/' there has no new log about my request.
thank you a lot :p |
|
Back to top |
|
|
dgaffuri Advocate
Joined: 05 Jun 2005 Posts: 2078 Location: Italy
|
Posted: Tue Sep 27, 2005 9:22 pm Post subject: |
|
|
No errors in mod_jk.log? And please, let's see your configuration. |
|
Back to top |
|
|
chy168 n00b
Joined: 12 Mar 2005 Posts: 70
|
Posted: Wed Sep 28, 2005 6:00 am Post subject: |
|
|
yes, no error in my mod_jk.log
when I install mod_jk I just add this setting to my httpd.conf:
Code: | LoadModule jk_module modules/mod_jk.so |
modules.d/88_mod_jk.conf
Code: | <IfDefine JK>
LoadModule jk_module modules/mod_jk.so
###
### Where to find workers.properties
###
# JkWorkersFile specify the location where mod_jk will find
# the workers definitions.
JkWorkersFile conf/jk-workers.properties
###
### Where to put mod_jk logs
###
# specify the location where mod_jk is going to place its log file.
JkLogFile logs/mod_jk.log
###
### Set the jk log level [debug/error/info]
###
# info log will contains standard mod_jk activity (default).
# error log will contains also error reports.
# debug log will contains all informations on mod_jk activity
#JkLogLevel info
###
### Select the log format
###
# JkLogStampFormat will configure the date/time format found
# on mod_jk logfile. Using the strftime() format string it's
# set by default to "[%a %b %d %H:%M:%S %Y]"
#JkLogStampFormat "[%a %b %d %H:%M:%S %Y] "
###
### JkOptions indicate to send SSL KEY SIZE,
###
# The directive JkOptions allow you to set many forwarding
# options which will enable (+) or disable (-) following option.
#
#
# JkOptions ForwardKeySize , you ask mod_jk, when using ajp13, to
# forward also the SSL Key Size as required by Servlet API 2.3.
# This flag shouldn't be set when servlet engine is Tomcat 3.2.x
# (on by default).
#
#
# JkOptions ForwardURICompat , you told mod_jk to send the URI to
# Tomcat normally, which is less spec compliant but mod_rewrite
# compatible, use it for compatibility with Tomcat 3.2.x engines
# (on by default).
#
#
# JkOptions ForwardURICompatUnparsed , the forwarded URI is unparsed,
# it's spec compliant but broke mod_rewrite.
#
#
# JkOptions ForwardURIEscaped , the forwarded URI is escaped and
# Tomcat (since 3.3 rc2) will do the decoding part.
#
#
# JkOptions ForwardDirectories is used in conjunction with Directory-
# Index directive of Apache web server. As such mod_dir should be
# available to Apache, statically or dynamically (DSO)
#
# When DirectoryIndex is configured, Apache will create sub-requests
# for each of the local-url's specified in the directive, to determine
# if there is a local file that matches (this is done by stat-ing the file).
#
# If ForwardDirectories is set to false (default) and Apache doesn't
# find any files that match, Apache will serve the content of the
# directory (if directive Options specifies Indexes for that directory)
# or a 403 Forbidden response (if directive Options doesn't specify
# Indexes for that directory).
#
# If ForwarDirectories is set to true and Apache doesn't find any
# files that match, the request will be forwarded to Tomcat for
# resolution. This is used in cases when Apache cannot see the index
# files on the file system for various reasons: Tomcat is running on
# a different machine, the JSP file has been precompiled etc.
#
# Note that locally visible files will take precedence over the ones
# visible only to Tomcat (i.e. if Apache can see the file, that's
# the one that's going to get served). This is important if there is
# more then one type of file that Tomcat normally serves - for
# instance Velocity pages and JSP pages.
#
JkOptions +ForwardKeySize +ForwardURICompat -ForwardDirectories
###
### JkEnvVar forward environment vars
###
# The directive JkEnvVar allow you to forward an environment vars
# from Apache server to Tomcat engine.
#
#JkEnvVar SSL_CLIENT_V_START
###
### JkRequestLogFormat set the request format
###
# JkRequestLogFormat will configure the format of mod_jk individual
# request logging. Request logging is configured and enabled on a
# per virtual host basis. To enable request logging for a virtual
# host just add a JkRequestLogFormat config. The syntax of the
# format string is similiar to the Apache LogFormat command, here
# is a list of the available request log format options:
#
# Options Description
# %b Bytes sent, excluding HTTP headers (CLF format)
# %B Bytes sent, excluding HTTP headers
# %H The request protocol
# %m The request method
# %p The canonical Port of the server serving the request
# %q The query string (prepended with a ? if a query string exists, otherwise an empty string)
# %r First line of request
# %s Request HTTP status code
# %T Request duration, elapsed time to handle request in seconds '.' micro seconds
# %U The URL path requested, not including any query string.
# %v The canonical ServerName of the server serving the request
# %V The server name according to the UseCanonicalName setting
# %w Tomcat worker name
#
JkRequestLogFormat "%w %V %T"
###
### JkMount assign specific URLs to Tomcat
###
# JkMount directive assign specific URLs to Tomcat. In general the
# structure of a JkMount directive is:
#
# send all requests ending in .jsp to worker1
# JkMount /*.jsp worker1
#
# send all requests ending /servlet to worker1
# JkMount /*/servlet/ worker1
#
# send all requests jsp requests to files located in /otherworker will go worker2
# JkMount /otherworker/*.jsp worker2
#
#
# You can use the JkMount directive at the top level or inside
# <VirtualHost> sections of your httpd.conf file.
#
# We specify an autoalias, that makes it possible that apache is still
# reponsible for serving static html files. All requests of files with
# the ending .jsp will be redirected to a default Tomcat installation which
# uses the default profile. Change this to fit your needs.
jkAutoAlias /var/lib/tomcat-5/default/webapps/
jkMount /*.jsp ajp13
jkMount /app/* ajp13
</IfDefine>
|
any other configure file should show here ?
thanks you a lot. :p |
|
Back to top |
|
|
dgaffuri Advocate
Joined: 05 Jun 2005 Posts: 2078 Location: Italy
|
Posted: Wed Sep 28, 2005 7:07 am Post subject: |
|
|
Please,
Code: | conf/jk-workers.properties |
And where you've placed the jsp you're trying to reach and the related webapp definition in Tomcat. |
|
Back to top |
|
|
chy168 n00b
Joined: 12 Mar 2005 Posts: 70
|
Posted: Wed Sep 28, 2005 7:22 am Post subject: |
|
|
conf/jk-workers.properties
Code: | # workers.properties -
#
# This file provides jk derived plugins with the needed information to
# connect to the different tomcat workers. Note that the distributed
# version of this file requires modification before it is usable by a
# plugin.
#
# As a general note, the characters $( and ) are used internally to define
# macros. Do not use them in your own configuration!
# The list of Tomcat workers
#
worker.list=ajp13
#------ DEFAULT ajp13 WORKER DEFINITION ------------------------------
#---------------------------------------------------------------------
#
# Defining a worker named ajp13 and of type ajp13
# Note that the name and the type do not have to match.
#
worker.ajp13.port=8009
worker.ajp13.host=localhost
worker.ajp13.type=ajp13
#
# Specifies the load balance factor when used with
# a load balancing worker.
# Note:
# ----> lbfactor must be > 0
# ----> Low lbfactor means less work done by the worker.
worker.ajp13.lbfactor=1
#
# Specify the size of the open connection cache.
worker.ajp13.cachesize=10 |
I put my jsp in ~user/public_html
it is apache's default user directory.
didn't the jsp put in there ? >"< |
|
Back to top |
|
|
dgaffuri Advocate
Joined: 05 Jun 2005 Posts: 2078 Location: Italy
|
Posted: Wed Sep 28, 2005 9:18 am Post subject: |
|
|
Putting a single jsp under the Apache document root is not enough. Tomcat (and all application servers) wants jsp in web applications, deployed by default under the directory webapps and described at least by a web.xml deployment descriptor under the WEB-INF subdirectory of the application root. The webapp is assigned a context path (that is the first directory after the host:port in the URL) when you deploy the application. So your jsp would work if you deploy a webapp with context path /~user pointing to ~user/public_html, and you create a WEB-INF directory with a valid web.xml in there. But this is not the reccomended way to do it.
I suggest that you use the examples webapp as a starting point, before you try to deploy your own. For mod_jk configuration details you may look at
http://jakarta.apache.org/tomcat/connectors-doc/howto/apache.html
For an introduction to webapps you may look at
http://jakarta.apache.org/tomcat/tomcat-5.5-doc/appdev/index.html
Sorry if I've explained something you already knew. Hope this may help anyway. |
|
Back to top |
|
|
|