tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Gero Vermaas <Gero.Verm...@sun.com>
Subject Tomcat, Apache: JSP source code showed instead of generated HTML
Date Wed, 29 Aug 2001 07:31:59 GMT
Hi all!

I sent mail to this mailing list a while ago stating that I could not
get apache to work with tomcat... well I tried all kinds of solutions,
monitored the mailing list and unfortunately I still haven?t been able
to get it up and running. 

The problem:
- Requesting a JSP page by doing a request via port 8080 works fine
- Requesting a JSP page via apache and mod_jk returns the JSP source
code

Is seems that requests to JSPs are not directed to port 8007 of Tomcat.

I try to give a concise description below, hopefully somebody can tell
what I?m missing. It must be something simple...

Apache version: 1.3.14
Tomcat version: 3.2.3
Mod_jk version:  tomcat-mod-3.2.2-1.i386.rpm

The apache error.log states the following when apache is started:
[Wed Aug 29 08:59:23 2001] [notice] Apache-AdvancedExtranetServer/1.3.14
(Linux-M
andrake/2mdk) mod_ssl/2.7.1 OpenSSL/0.9.5a mod_jk configured -- resuming
normal o
perations

As you can see mod_jk is configured and seems to be fine.

I started TomCat before starting apache and this Tomcat reported the
following:

[root@gerodt gero]# 2001-08-29 09:02:12 - Ctx( /examples ): Set debug to
1
2001-08-29 09:02:12 - ContextManager: Adding context Ctx( /examples )
2001-08-29 09:02:12 - ContextManager: Adding context Ctx( /admin )
Starting tomcat. Check logs/tomcat.log for error messages 
2001-08-29 09:02:12 - ContextManager: Adding context Ctx(  )
2001-08-29 09:02:12 - ContextManager: Adding context Ctx( /test )
2001-08-29 09:02:12 - Ctx( /examples ): XmlReader - init  /examples
webapps/examp
les
2001-08-29 09:02:12 - Ctx( /examples ): Reading
/opt/jakarta-tomcat-3.2.3/webapps
/examples/WEB-INF/web.xml
2001-08-29 09:02:13 - Ctx( /examples ): Add user tomcat tomcat tomcat
2001-08-29 09:02:13 - Ctx( /examples ): Add user role1 tomcat role1
2001-08-29 09:02:13 - Ctx( /examples ): Add user both tomcat
tomcat,role1
2001-08-29 09:02:13 - Ctx( /examples ): Loading -2147483646 jsp
2001-08-29 09:02:13 - PoolTcpConnector: Starting HttpConnectionHandler
on 8080
2001-08-29 09:02:13 - PoolTcpConnector: Starting Ajp12ConnectionHandler
on 8007

Below I?ll include the mod_jk.conf and worker.properties file. I checked
all paths in these file and they all seem to be correct.

Doing a telnet to port 8007 reports:
[root@gerodt gero]# telnet localhost 8007
Trying 127.0.0.1...
Connected to localhost.localdomain.
Escape character is ?^]?.
HANDLER THREAD PROBLEM: java.io.IOException: Stream broken
java.io.IOException: Stream broken
        at
org.apache.tomcat.service.connector.AJP12RequestAdapter.readNextRequest(Ajp12ConnectionHa
ndler.java:426)
        at
org.apache.tomcat.service.connector.Ajp12ConnectionHandler.processConnection(Ajp12Connect
ionHandler.java:147)
        at
org.apache.tomcat.service.TcpWorkerThread.runIt(PoolTcpEndpoint.java:416)
        at
org.apache.tomcat.util.ThreadPool$ControlRunnable.run(ThreadPool.java:501)
        at java.lang.Thread.run(Thread.java:484)

So Tomcat is accepting requests on this port.

A strange this I discovered is that the /var/log/httpd/mod_jk.log file
remains empty when I do a:
/etc/rc.d/rc5.d/S85httpd stop
followed by a
/etc/rc.d/rc5.d/S85httpd start

However, when I do a:
/etc/rc.d/rc5.d/S85httpd restart

The mod_jk.log file contains:
[jk_uri_worker_map.c (335)]: jk_uri_worker_map_t::uri_worker_map_close,
NULL parameter
[jk_uri_worker_map.c (185)]: In
jk_uri_worker_map_t::uri_worker_map_free, NULL parameters
[jk_uri_worker_map.c (335)]: jk_uri_worker_map_t::uri_worker_map_close,
NULL parameter
[jk_uri_worker_map.c (185)]: In
jk_uri_worker_map_t::uri_worker_map_free, NULL parameters
[jk_uri_worker_map.c (335)]: jk_uri_worker_map_t::uri_worker_map_close,
NULL parameter
[jk_uri_worker_map.c (185)]: In
jk_uri_worker_map_t::uri_worker_map_free, NULL parameters
[jk_uri_worker_map.c (335)]: jk_uri_worker_map_t::uri_worker_map_close,
NULL parameter
[jk_uri_worker_map.c (185)]: In
jk_uri_worker_map_t::uri_worker_map_free, NULL parameters
[jk_uri_worker_map.c (335)]: jk_uri_worker_map_t::uri_worker_map_close,
NULL parameter
[jk_uri_worker_map.c (185)]: In
jk_uri_worker_map_t::uri_worker_map_free, NULL parameters
[jk_uri_worker_map.c (335)]: jk_uri_worker_map_t::uri_worker_map_close,
NULL parameter
[jk_uri_worker_map.c (185)]: In
jk_uri_worker_map_t::uri_worker_map_free, NULL parameters
[jk_uri_worker_map.c (335)]: jk_uri_worker_map_t::uri_worker_map_close,
NULL parameter
[jk_uri_worker_map.c (185)]: In
jk_uri_worker_map_t::uri_worker_map_free, NULL parameters
[jk_uri_worker_map.c (335)]: jk_uri_worker_map_t::uri_worker_map_close,
NULL parameter
[jk_uri_worker_map.c (185)]: In
jk_uri_worker_map_t::uri_worker_map_free, NULL parameters
[jk_uri_worker_map.c (335)]: jk_uri_worker_map_t::uri_worker_map_close,
NULL parameter
[jk_uri_worker_map.c (185)]: In
jk_uri_worker_map_t::uri_worker_map_free, NULL parameters
[jk_uri_worker_map.c (335)]: jk_uri_worker_map_t::uri_worker_map_close,
NULL parameter
[jk_uri_worker_map.c (185)]: In
jk_uri_worker_map_t::uri_worker_map_free, NULL parameters
[



The mod_jk.conf contains the following:
=============
###################################################################
# Auto generated configuration. Dated: Mon Jul 24 18:56:51 CEST 2000
###################################################################

JkWorkersFile /etc/httpd/conf/workers.properties
JkLogFile /var/log/httpd/mod_jk.log

#
# Log level to be used by mod_jk
#
JkLogLevel error

###################################################################
#                     SSL configuration                           #
# 
# By default mod_jk is configured to collect SSL information from
# the apache environment and send it to the Tomcat workers. The
# problem is that there are many SSL solutions for Apache and as
# a result the environment variable names may change.
#
# The following (commented out) JK related SSL configureation
# can be used to customize mod_jk?s SSL behaviour.
# 
# Should mod_jk send SSL information to Tomact (default is On)
# JkExtractSSL Off
# 
# What is the indicator for SSL (default is HTTPS)
# JkHTTPSIndicator HTTPS
# 
# What is the indicator for SSL session (default is SSL_SESSION_ID)
# JkSESSIONIndicator SSL_SESSION_ID
# 
# What is the indicator for client SSL cipher suit (default is
SSL_CIPHER)
# JkCIPHERIndicator SSL_CIPHER
# 
# What is the indicator for the client SSL certificated (default is
SSL_CLIENT_CERT)
# JkCERTSIndicator SSL_CLIENT_CERT
# 
#                                                                 #
###################################################################

#
# Root context mounts for Tomcat
#
JkMount /*.jsp ajp12
JkMount /servlet/* ajp12

#########################################################
# Auto configuration for the /examples context starts.
#########################################################

#
# The following line makes apache aware of the location of the /examples
context
#
Alias /examples ?/opt/jakarta-tomcat-3.2.3/webapps/examples?
<Directory ?/opt/jakarta-tomcat-3.2.3/webapps/examples">
    Options Indexes FollowSymLinks
</Directory>

#
# The following line mounts all JSP files and the /servlet/ uri to
tomcat
#
JkMount /examples/servlet/* ajp12
JkMount /examples/*.jsp ajp12

#
# The following line prohibits users from directly access WEB-INF
#
<Location ?/examples/WEB-INF/">
    AllowOverride None
    deny from all
</Location>

#######################################################
# Auto configuration for the /examples context ends.
#######################################################

#########################################################
# Auto configuration for the /admin context starts.
#########################################################

#
# The following line makes apache aware of the location of the /admin
context
#
Alias /admin ?/opt/jakarta-tomcat-3.2.3/webapps/admin?
<Directory ?/opt/jakarta-tomcat-3.2.3/webapps/admin">
    Options Indexes FollowSymLinks
</Directory>

#
# The following line mounts all JSP files and the /servlet/ uri to
tomcat
#
JkMount /admin/servlet/* ajp12
JkMount /admin/*.jsp ajp12

#
# The following line prohibits users from directly access WEB-INF_#
<Location ?/admin/WEB-INF/">
    AllowOverride None
    deny from all
</Location>

#######################################################
# Auto configuration for the /admin context ends.
#######################################################

#########################################################
# Auto configuration for the /test context starts.
#########################################################

#
# The following line makes apache aware of the location of the /test
context
#
Alias /test ?/opt/jakarta-tomcat-3.2.3/webapps/test?
<Directory ?/opt/jakarta-tomcat-3.2.3/webapps/test">
    Options Indexes FollowSymLinks
</Directory>

#
# The following line mounts all JSP files and the /servlet/ uri to
tomcat
#
JkMount /test/servlet/* ajp12
JkMount /test/*.jsp ajp12

#
# The following line prohibits users from directly access WEB-INF
#
<Location ?/test/WEB-INF/">
    AllowOverride None
    deny from all
</Location>

#######################################################
# Auto configuration for the /test context ends.
#######################################################
==============

The workers.properties contains the following:
========================
#
# $Header: /home/cvspublic/jakarta-tomcat/src/etc/workers.properties,v
1.3 2000/06/07 12:13:16 shachor Exp $
# $Revision: 1.3 $
# $Date: 2000/06/07 12:13:16 $
#
#
# workers.properties -
#
# This file provides jk deriven plugins with with the needed information
to
# connect to the different tomcat workers.
#
# As a general note, the characters $( and ) are used internally to
define
# macros. Do not use them in your own configuration!!!
#
# Whenever you see a set of lines such as:
# x=value
# y=$(x)\something
#
# the final value for y will be value\something
#
# Normaly all you will need to modify is the first properties, i.e.
# workers.tomcat_home, workers.java_home and ps. Most of the
configuration
# is derived from these.
#
# When you are done updating workers.tomcat_home, workers.java_home and
ps
# you should have 3 workers configured:
#
# - An ajp12 worker that connects to localhost:8007
# - An ajp13 worker that connects to localhost:8009
# - A jni inprocess worker.
# - A load balancer worker
#
# However by default the plugins will only use the ajp12 worker. To have
# the plugins use other workers you should modify the worker.list
property.
#
#

#
# workers.tomcat_home should point to the location where you
# installed tomcat. This is where you have your conf, webapps and lib
# directories.
#
workers.tomcat_home=/opt/jakarta-tomcat-3.2.3

#
# workers.java_home should point to your Java installation. Normally
# you should have a bin and lib directories beneath it.
#
workers.java_home=/usr/java/jdk1.3.0_02/

#
# You should configure your environment slash... ps=\ on NT and / on
UNIX
# and maybe something different elsewhere.
#
ps=/
# ps=/

#
#------ ADVANCED MODE ------------------------------------------------
#---------------------------------------------------------------------
#

#
#------ DEFAULT worket list ------------------------------------------
#---------------------------------------------------------------------
#
#
# The workers that your plugins should create and work with
#
worker.list=ajp12, ajp13

#
#------ DEFAULT ajp12 WORKER DEFINITION ------------------------------
#---------------------------------------------------------------------
#

#
# Defining a worker named ajp12 and of type ajp12
# Note that the name and the type do not have to match.
#
worker.ajp12.port=8007
worker.ajp12.host=localhost
worker.ajp12.type=ajp12
#
# 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.ajp12.lbfactor=1

#
#------ 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

#
#------ DEFAULT LOAD BALANCER WORKER DEFINITION ----------------------
#---------------------------------------------------------------------
#

#
# The loadbalancer (type lb) workers perform wighted round-robin
# load balancing with sticky sessions.
# Note:
#  ----> If a worker die the load balancer will check its state
#        once in a while. Until then all work is redirected to peer
#        workers.
worker.loadbalancer.type=lb
worker.loadbalancer.balanced_workers=ajp12, ajp13


#
#------ DEFAULT JNI WORKER DEFINITION---------------------------------
#---------------------------------------------------------------------
#

#
# Defining a worker named inprocess and of type jni
# Note that the name and the type do not have to match.
#
worker.inprocess.type=jni

#
#------ CLASSPATH DEFINITION -----------------------------------------
#---------------------------------------------------------------------
#

#
# Additional class path components.
#
worker.inprocess.class_path=$(workers.tomcat_home)$(ps)classes

#
# The exact identity of the XML parser used in unknown yet, so I put
# them all.
#
worker.inprocess.class_path=$(workers.tomcat_home)$(ps)lib$(ps)xml.jar
worker.inprocess.class_path=$(workers.tomcat_home)$(ps)lib$(ps)jaxp.jar
worker.inprocess.class_path=$(workers.tomcat_home)$(ps)lib$(ps)parser.jar

#
# Tomcat?s implementation
#
worker.inprocess.class_path=$(workers.tomcat_home)$(ps)lib$(ps)jasper.jar
worker.inprocess.class_path=$(workers.tomcat_home)$(ps)lib$(ps)servlet.jar
worker.inprocess.class_path=$(workers.tomcat_home)$(ps)lib$(ps)webserver.jar

#
# Javac as available from Java2SE
#
worker.inprocess.class_path=$(workers.java_home)$(ps)lib$(ps)tools.jar

#
# Setting the command line for tomcat
#
worker.inprocess.cmd_line=-config
worker.inprocess.cmd_line=$(workers.tomcat_home)/conf/jni_server.xml
worker.inprocess.cmd_line=-home
worker.inprocess.cmd_line=$(workers.tomcat_home)

#
# The JVM that we are about to use
#
# This is for Java2
#
worker.inprocess.jvm_lib=$(workers.java_home)$(ps)jre$(ps)bin$(ps)classic$(ps)libjvm.so

#
# And this is for jdk1.1.X
#
#worker.inprocess.jvm_lib=$(workers.java_home)$(ps)bin$(ps)javai.dll
#

#
# Setting the place for the stdout and stderr of tomcat
#
worker.inprocess.stdout=$(workers.tomcat_home)$(ps)inprocess.stdout
worker.inprocess.stderr=$(workers.tomcat_home)$(ps)inprocess.stderr

#
# Setting the tomcat.home Java property
#
worker.inprocess.sysprops=tomcat.home=$(workers.tomcat_home)

#
# Java system properties
#
# worker.inprocess.sysprops=java.compiler=NONE
# worker.inprocess.sysprops=myprop=mypropvalue

#
# Additional path components.
#
# worker.inprocess.ld_path=d:$(ps)SQLLIB$(ps)bin
#
=======================

Any help, suggestions is appreciated.....

Regards,
Gero




Mime
View raw message