Java Mailing List Archive

http://www.junlu.com/

Google
Google
Mailing List
Home
Forum Home
JBoss - Java Application Server
Struts - A MVC web framework
Tomcat - JSP/Servlet container
iText - An open source PDF Java Library
JDOM - JDOM XML Parser
J2EE - A mailing list for Java(tm) 2 Platform, Enterprise Edition
J2EE Pattern - An interest list for Sun Java Center J2EE Pattern Catalog
Servlet - A mailing list for discussion about Sun Microsystem's Java Servlet API Technology
JSP - A mailing list about Java Server Pages specification and reference
Struts & Hibernate
Subjects
JSP editor plugin for eclipse ?
org apache jasper JasperException: Unable to compile class for JSP
Tomcat: Connection reset by peer: socket write error
Cannot retrieve definition for form bean null
Struts Tiles Tutorial (free Struts training)
Where do I download Tomcat 4 0 6?
Data Access Object (DAO) pattern, example DAO 's
Where to download Tomcat v 4 1 24 from?
Tomcat 5 0 16 Requested resource not available
Oracle Connection Pooling in 3 2 2
Servlet : Session invalidate
Servlet action is currently unavailable
Tomcat/Struts Unicode Encoding/Decoding problems
Tomcat and webapplication specific java library path
Running a Simple JMS Example
Mapping in workers2 properties
org apache jasper JasperException
Cannot find message resources under key org apache struts action
   MESSAGE
problem with html:text bean throwing exception
Cannot find message resources under key org apache struts action MESSAGE
invalid direct reference problem with solution
Tool for jsp debug Try Sysdeo Eclipse Plugin
Tomcat 5 Cannot load JDBC driver class 'null ' SQL state: null
weblogic ejbc
java properties file
Jboss 3 2 3 Coyote Can 't re
Tomcat 5, Apache2 and mod jk2 integration problem
JBoss example problem new to J2EE
url string for connecting jboss to oracle
Value attribute of <html:checkbox
javax servlet ServletException: BeanUtils populate
HTTP Status 404 The requested resource is not available
5 0 18: Windows XP Pro vs Windows 2000
 
Apache2 with JK2 with Tomcat5 multiple sendings from Apache to
Tomcat5

Apache2 with JK2 with Tomcat5 multiple sendings from Apache to
Tomcat5

2004-01-16       - By Oscar Serrano

 Back
Hi:
I've installed withou problems an Apache talking to a Tomcat via the jk2
connector.
Everything seems to work fine but sometimes I click on a link and I get no
response. Then I take a look at the logs and I see a very strange thing.
Apache is sending the request to Tomcat many times. Here is the log of
mod_jk.log:

First you can see what is a normal connection:

[Fri Jan 16 17:14:00 2004]  [jk_uri_worker_map.c (486)]: Into
jk_uri_worker_map_t::map_uri_to_worker
[Fri Jan 16 17:14:00 2004]  [jk_uri_worker_map.c (500)]: Attempting to map
URI '/jsp-examples/jsp2/simpletag/book.jsp'
[Fri Jan 16 17:14:00 2004]  [jk_uri_worker_map.c (524)]:
jk_uri_worker_map_t::map_uri_to_worker, Found a context match worker_principal
[Fri Jan 16 17:14:00 2004]  [mod_jk.c (1717)]: Into handler r->proxyreq=0
r->handler=jakarta-servlet r->notes=135484688 worker=worker_pr
[Fri Jan 16 17:14:00 2004]  [jk_worker.c (132)]: Into
wc_get_worker_for_name worker_principal
[Fri Jan 16 17:14:00 2004]  [jk_worker.c (136)]: wc_get_worker_for_name,
done  found a worker
[Fri Jan 16 17:14:00 2004]  [mod_jk.c (505)]: agsp=80 agsn=10.0.0.102
hostn=10.0.0.102 shostn=www.androlinux.com cbsport=80 sport=80
[Fri Jan 16 17:14:00 2004]  [jk_ajp_common.c (1686)]: Into
jk_worker_t::get_endpoint
[Fri Jan 16 17:14:00 2004]  [jk_ajp_common.c (1319)]: Into
jk_endpoint_t::service
[Fri Jan 16 17:14:00 2004]  [jk_ajp_common.c (295)]: Into
ajp_marshal_into_msgb
[Fri Jan 16 17:14:00 2004]  [jk_ajp_common.c (463)]: ajp_marshal_into_msgb
- Done
[Fri Jan 16 17:14:00 2004]  [jk_connect.c (188)]: Into jk_open_socket
[Fri Jan 16 17:14:00 2004]  [jk_connect.c (195)]: jk_open_socket, try to
connect socket = 10
[Fri Jan 16 17:14:00 2004]  [jk_connect.c (204)]: jk_open_socket, after
connect ret = 0
[Fri Jan 16 17:14:00 2004]  [jk_connect.c (213)]: jk_open_socket, set
TCP_NODELAY to on
[Fri Jan 16 17:14:00 2004]  [jk_connect.c (230)]: jk_open_socket, return,
sd = 10
[Fri Jan 16 17:14:00 2004]  [jk_ajp_common.c (738)]: In
jk_endpoint_t::ajp_connect_to_endpoint, connected sd = 10
[Fri Jan 16 17:14:00 2004]  [jk_ajp_common.c (774)]: sending to ajp13 #474
[Fri Jan 16 17:14:00 2004]  [jk_ajp_common.c (1064)]: ajp_send_request 2:
request body to send 0 - request body to resend 0
[Fri Jan 16 17:14:00 2004]  [jk_ajp_common.c (885)]: received from ajp13 #60
[Fri Jan 16 17:14:00 2004]  [jk_ajp_common.c (515)]:
ajp_unmarshal_response: status = 200
[Fri Jan 16 17:14:00 2004]  [jk_ajp_common.c (521)]:
ajp_unmarshal_response: Number of headers is = 2
[Fri Jan 16 17:14:00 2004]  [jk_ajp_common.c (575)]:
ajp_unmarshal_response: Header[0] [Content-Type] = [text/html]
[Fri Jan 16 17:14:00 2004]  [jk_ajp_common.c (575)]:
ajp_unmarshal_response: Header[1] [Content-Length] = [896]
[Fri Jan 16 17:14:00 2004]  [jk_ajp_common.c (885)]: received from ajp13 #900
[Fri Jan 16 17:14:00 2004]  [mod_jk.c (406)]: writing 896 (896) out of 896
[Fri Jan 16 17:14:00 2004]  [jk_ajp_common.c (885)]: received from ajp13 #2
[Fri Jan 16 17:14:00 2004]  [jk_ajp_common.c (1661)]: Into
jk_endpoint_t::done, recycling connection


And this is a failed request:

[Fri Jan 16 17:14:07 2004]  [jk_uri_worker_map.c (486)]: Into
jk_uri_worker_map_t::map_uri_to_worker
[Fri Jan 16 17:14:07 2004]  [jk_uri_worker_map.c (500)]: Attempting to map
URI '/jsp-examples/jsp2/simpletag/book.jsp'
[Fri Jan 16 17:14:07 2004]  [jk_uri_worker_map.c (524)]:
jk_uri_worker_map_t::map_uri_to_worker, Found a context match worker_principal
[Fri Jan 16 17:14:07 2004]  [mod_jk.c (1717)]: Into handler r->proxyreq=0
r->handler=jakarta-servlet r->notes=135484688 worker=worker_pr
[Fri Jan 16 17:14:07 2004]  [jk_worker.c (132)]: Into
wc_get_worker_for_name worker_principal
[Fri Jan 16 17:14:07 2004]  [jk_worker.c (136)]: wc_get_worker_for_name,
done  found a worker
[Fri Jan 16 17:14:07 2004]  [mod_jk.c (505)]: agsp=80 agsn=10.0.0.102
hostn=10.0.0.102 shostn=www.androlinux.com cbsport=80 sport=80
[Fri Jan 16 17:14:07 2004]  [jk_ajp_common.c (1686)]: Into
jk_worker_t::get_endpoint
[Fri Jan 16 17:14:07 2004]  [jk_ajp_common.c (1730)]: In
jk_endpoint_t::ajp_get_endpoint, time elapsed since last request = 7 seconds
[Fri Jan 16 17:14:07 2004]  [jk_ajp_common.c (1319)]: Into
jk_endpoint_t::service
[Fri Jan 16 17:14:07 2004]  [jk_ajp_common.c (295)]: Into
ajp_marshal_into_msgb
[Fri Jan 16 17:14:07 2004]  [jk_ajp_common.c (463)]: ajp_marshal_into_msgb
- Done
[Fri Jan 16 17:14:07 2004]  [jk_ajp_common.c (774)]: sending to ajp13 #313
[Fri Jan 16 17:14:07 2004]  [jk_ajp_common.c (774)]: sending to ajp13 #313
[Fri Jan 16 17:14:07 2004]  [jk_ajp_common.c (774)]: sending to ajp13 #313
[Fri Jan 16 17:14:07 2004]  [jk_ajp_common.c (774)]: sending to ajp13 #313
[Fri Jan 16 17:14:07 2004]  [jk_ajp_common.c (774)]: sending to ajp13 #313
[Fri Jan 16 17:14:07 2004]  [jk_ajp_common.c (774)]: sending to ajp13 #313
[Fri Jan 16 17:14:07 2004]  [jk_ajp_common.c (774)]: sending to ajp13 #313
[Fri Jan 16 17:14:07 2004]  [jk_ajp_common.c (774)]: sending to ajp13 #313
[Fri Jan 16 17:14:07 2004]  [jk_ajp_common.c (774)]: sending to ajp13 #313
[Fri Jan 16 17:14:07 2004]  [jk_ajp_common.c (774)]: sending to ajp13 #313
[Fri Jan 16 17:14:07 2004]  [jk_ajp_common.c (774)]: sending to ajp13 #313
[Fri Jan 16 17:14:07 2004]  [jk_ajp_common.c (774)]: sending to ajp13 #313
[Fri Jan 16 17:14:07 2004]  [jk_ajp_common.c (774)]: sending to ajp13 #313
[Fri Jan 16 17:14:07 2004]  [jk_ajp_common.c (774)]: sending to ajp13 #313
[Fri Jan 16 17:14:07 2004]  [jk_ajp_common.c (774)]: sending to ajp13 #313
[Fri Jan 16 17:14:07 2004]  [jk_ajp_common.c (774)]: sending to ajp13 #313
[Fri Jan 16 17:14:07 2004]  [jk_ajp_common.c (774)]: sending to ajp13 #313
[Fri Jan 16 17:14:07 2004]  [jk_ajp_common.c (774)]: sending to ajp13 #313
[Fri Jan 16 17:14:07 2004]  [jk_ajp_common.c (774)]: sending to ajp13 #313
[Fri Jan 16 17:14:07 2004]  [jk_ajp_common.c (774)]: sending to ajp13 #313
[Fri Jan 16 17:14:07 2004]  [jk_ajp_common.c (774)]: sending to ajp13 #313
[Fri Jan 16 17:14:07 2004]  [jk_ajp_common.c (774)]: sending to ajp13 #313
[Fri Jan 16 17:14:07 2004]  [jk_ajp_common.c (774)]: sending to ajp13 #313
[Fri Jan 16 17:14:07 2004]  [jk_ajp_common.c (774)]: sending to ajp13 #313
[Fri Jan 16 17:14:07 2004]  [jk_ajp_common.c (774)]: sending to ajp13 #313
[Fri Jan 16 17:14:07 2004]  [jk_ajp_common.c (774)]: sending to ajp13 #313
[Fri Jan 16 17:14:07 2004]  [jk_ajp_common.c (774)]: sending to ajp13 #313
[Fri Jan 16 17:14:07 2004]  [jk_ajp_common.c (774)]: sending to ajp13 #313
[Fri Jan 16 17:14:07 2004]  [jk_ajp_common.c (774)]: sending to ajp13 #313
[Fri Jan 16 17:14:07 2004]  [jk_ajp_common.c (774)]: sending to ajp13 #313
[Fri Jan 16 17:14:07 2004]  [jk_ajp_common.c (774)]: sending to ajp13 #313
[Fri Jan 16 17:14:07 2004]  [jk_ajp_common.c (774)]: sending to ajp13 #313
[Fri Jan 16 17:14:07 2004]  [jk_ajp_common.c (774)]: sending to ajp13 #313
[Fri Jan 16 17:14:07 2004]  [jk_ajp_common.c (774)]: sending to ajp13 #313
[Fri Jan 16 17:14:07 2004]  [jk_ajp_common.c (774)]: sending to ajp13 #313
[Fri Jan 16 17:14:07 2004]  [jk_ajp_common.c (774)]: sending to ajp13 #313
[Fri Jan 16 17:14:07 2004]  [jk_ajp_common.c (774)]: sending to ajp13 #313
[Fri Jan 16 17:14:07 2004]  [jk_ajp_common.c (774)]: sending to ajp13 #313
[Fri Jan 16 17:14:07 2004]  [jk_ajp_common.c (774)]: sending to ajp13 #313


And in the tomcat access_log I see many request like this:

10.0.0.23 - - [16/Jan/2004:17:14:07 +0100] "GET
/jsp-examples/jsp2/simpletag/book.jsp HTTP/1.1" 200 89
10.0.0.23 - - [16/Jan/2004:17:14:07 +0100] "GET
/jsp-examples/jsp2/simpletag/book.jsp HTTP/1.1" 200 89
10.0.0.23 - - [16/Jan/2004:17:14:07 +0100] "GET
/jsp-examples/jsp2/simpletag/book.jsp HTTP/1.1" 200 89
10.0.0.23 - - [16/Jan/2004:17:14:07 +0100] "GET
/jsp-examples/jsp2/simpletag/book.jsp HTTP/1.1" 200 89
[and so on until 100 or more request]

As I've said not always fails :-?


Here I put my configuration files:
__ ____ ____ ____ ____ ____ ____ ____ ____ ____ ___

workers.properties:


workers.tomcat_home=/opt/tomcat5
workers.java_home=/opt/jdk_nb/j2sdk1.4.2
ps=/
worker.list=worker_principal

worker.worker_principal.port=8009
worker.worker_principal.host=localhost
worker.worker_principal.type=ajp13
worker.worker_principal.lbfactor=100

__ ____ ____ ____ ____ ____ ____ ____ ____ ____ ______

server.xml

<!-- Example Server Configuration File -->
<!-- Note that component elements are nested corresponding to their
     parent-child relationships with each other -->

<!-- A "Server" is a singleton element that represents the entire JVM,
     which may contain one or more "Service" instances.  The Server
     listens for a shutdown command on the indicated port.

     Note:  A "Server" is not itself a "Container", so you may not
     define subcomponents such as "Valves" or "Loggers" at this level.
 -->

<Server port="8005" shutdown="SHUTDOWN" debug="0">


  <Listener className="org.apache.catalina.mbeans.ServerLifecycleListener Source code of org.apache.catalina.mbeans.ServerLifecycleListener"
            debug="0"/>
  <Listener
className="org.apache.catalina.mbeans.GlobalResourcesLifecycleListener Source code of org.apache.catalina.mbeans.GlobalResourcesLifecycleListener"
            debug="0"/>

  <!-- Global JNDI resources -->
  <GlobalNamingResources>

    <!-- Test entry for demonstration purposes -->
    <Environment name="simpleValue" type="java.lang.Integer Source code of java.lang.Integer" value="30"/>

    <!-- Editable user database that can also be used by
         UserDatabaseRealm to authenticate users -->
    <Resource name="UserDatabase" auth="Container"
              type="org.apache.catalina.UserDatabase Source code of org.apache.catalina.UserDatabase"
       description="User database that can be updated and saved">
    </Resource>
    <ResourceParams name="UserDatabase">
      <parameter>
        <name>factory</name>
        <value>org.apache.catalina.users.MemoryUserDatabaseFactory Source code of org.apache.catalina.users.MemoryUserDatabaseFactory</value>
      </parameter>
      <parameter>
        <name>pathname</name>
        <value>conf/tomcat-users.xml</value>
      </parameter>
    </ResourceParams>

  </GlobalNamingResources>


  <Service name="Catalina">

    <!-- Define a non-SSL Coyote HTTP/1.1 Connector on port 8080 -->
    <Connector port="8080"
               maxThreads="150" minSpareThreads="25" maxSpareThreads="75"
               enableLookups="false" redirectPort="8443" acceptCount="100"
               debug="0" connectionTimeout="20000"
               disableUploadTimeout="true" />

    <!-- Define a Coyote/JK2 AJP 1.3 Connector on port 8009 -->
    <Connector port="8009"
               enableLookups="false" redirectPort="8443" debug="0"
               protocol="AJP/1.3" />

    <Engine name="Catalina" defaultHost="localhost" debug="0">
       <Logger className="org.apache.catalina.logger.FileLogger"
              prefix="catalina_log." suffix=".txt"
              timestamp="true"/>

       <Realm className="org.apache.catalina.realm.UserDatabaseRealm Source code of org.apache.catalina.realm.UserDatabaseRealm"
                 debug="0" resourceName="UserDatabase"/>

       <Host name="localhost" debug="0" appBase="webapps"
          unpackWARs="true" autoDeploy="true"
          xmlValidation="false" xmlNamespaceAware="false">

          <Valve className="org.apache.catalina.valves.AccessLogValve Source code of org.apache.catalina.valves.AccessLogValve"
                 directory="logs"  prefix="localhost_access_log."
suffix=".txt"
                 pattern="common" resolveHosts="false"/>

          <Logger className="org.apache.catalina.logger.FileLogger"
                 directory="logs"  prefix="localhost_log." suffix=".txt"
                 timestamp="true"/>
       </Host>
    </Engine>
  </Service>
</Server>


__ ____ ____ ____ __


httpd.conf


# Cargamos el modulo JK
#
LoadModule jk_module modules/mod_jk.so
#
# Configuramos el mod_jk
#
JkWorkersFile conf/workers.properties
JkLogFile logs/mod_jk.log
JkLogLevel debug


JkMount /jsp-examples/* worker_principal




__ ____ ____


Any help?


Thank you very much.



Oscar Serrano
http://www.andromedical.com


-- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ------
To unsubscribe, e-mail: tomcat-user-unsubscribe@(protected)
For additional commands, e-mail: tomcat-user-help@(protected)




©2008 junlu.com - Jax Systems, LLC, U.S.A.