tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From André Warnier ...@ice-sa.com>
Subject Re: Trouble connecting Tomcat 7.0 with Apache Server 2.2 (reposting question - hopefully this formats better)
Date Thu, 03 Mar 2011 14:12:19 GMT
You are still having formatting issues, which makes it a bit difficult to follow.
But you seem to have found the issue :

the "worker name" used as the last item on a JkMount line, must match one named in the 
workers.properties file.
(The "worker" in this case meaning one background Tomcat to do the work).

typically :

httpd.conf :

JkMount /someURL someworker
JkMount /someOtherURL someotherworker

workers.properties

worker.list=someworker,someotherworker

worker.someworker.host=somehost
worker.someworker.port=8009
...

worker.someotherworker.host=someotherhost
worker.someotherworker.port=8009
...
etc..

and then on each of the "worker Tomcat hosts", in the Tomcat conf/server.xml, you should 
have a <Connector port="8009" protocol="AJP">



John C wrote:
> I fixed my own problem. I changed the workers.properties file to this:
> workers.tomcat_home=C:\Program Files (x86)\Apache Software Foundation\Tomcat 7.0workers.java_home=C:\Program
Files (x86)\Java\jdk1.6.0_17ps=\worker.list=myworkerworker.myworker.port=8009worker.myworker.host=localhostworker.myworker.type=ajp13worker.myworker.lbfactor=1
> And I changed the httpd.conf to this:
> # My mod_jk settings#Load mod_jk moduleLoadModule jk_module modules/mod_jk.so#Where to
find workers.propertiesJkWorkersFile conf/workers.properties#Where to put jk logsJkLogFile
logs/mod_jk.log#Set the jk log levelJkLogLevel debug# Select the log format#JkLogStampFormat
“[%a %b %d %H:%M:%S %Y]“#JkOptions indicate to send SSL KEY SIZEJkOptions +ForwardKeySize
+ForwardURICompat -ForwardDirectories#RequestLogFormat set the request format#JkRequestLogFormat
“%w %V %T”# Send JSPs for context /ROOT to worker named “myworker”JkMount /*.jsp myworker#
Send /ROOT to worker named “myworker”JkMount /* myworker
>> From: jac_legend_sas@hotmail.com
>> To: users@tomcat.apache.org
>> Subject: Trouble connecting Tomcat 7.0 with Apache Server 2.2 (reposting question
- hopefully this formats better)
>> Date: Fri, 4 Mar 2011 02:29:15 +1300
>>
>>
>> Reposting the same question I posted a minute ago due to weird formatting issues.
Hopefully this email fixes it.
>> I am trying to
>> connect Tomcat 7.0 and Apache Server 2.2 using Windows 7.0. I created a .jsp
>> file to test if my setup was correct under "C:\Program Files (x86)\Apache
>> Software Foundation\Tomcat 7.0\webapps\sitepoint\count.jsp". I can
>> successfully load the count.jsp file by entering
>> http://localhost:8080/sitepoint/count.jsp into Google Chrome, however when I
>> enter http://localhost/sitepoint/count.jsp into Chrome I get an "Opps!
>> This link appears to be broken." message. Therefore it appears to be an
>> error in my configurations. Unfortunately I'm puzzled as to the problem and
>> have been trying to look for a solution for the past 2 days without any luck.
>> Here are the details:
>>
>>  
>>
>> Platform: Windows
>> 7.0
>>
>> Tomcat: 7.0
>>
>> Apache Server:
>> 2.2
>>
>> JDK: C:\Program
>> Files (x86)\Java\jdk1.6.0_17
>>
>> Tomcat:
>> C:\Program Files (x86)\Apache Software Foundation\Tomcat 7.0
>>
>> Apache:
>> C:\Program Files (x86)\Apache Software Foundation\Apache2.2
>>
>>  
>>
>> This is the
>> process I went through.
>>
>> 1. Installed
>> Apache Server and Tomcat
>>
>> 2. Downloaded the
>> Apache Connector binaries: mod_jk-1.2.31-httpd-2.2.3.so. Renamed this to
>> mod_jk.so and put it in the modules directory of Apache2.2.
>>
>> 3. Downloaded the
>> source files for the same connector and extracted the workers.properties file
>> and placed that into the conf directory of Apache2.2. I left this file
>> unchanged, not sure if I am meant to alter it.
>>
>> 4. I then altered
>> the httpd.conf configurations file inside the conf directory of Apache2.2 and
>> added the following lines (not sure if /easywayserver/ should be used for my
>> example I described earlier) :
>>
>>  
>>
>>       LoadModule jk_module modules/mod_jk.so
>>
>>       JkWorkersFile conf/workers.properties
>>
>>       JkLogFile "logs/mod_jk.log"
>>
>>       JkLogLevel error
>>
>>       JkMount /easywayserver loadbalancer
>>
>>       JkMount /easywayserver/* loadbalancer
>>
>>  
>>
>>  
>>
>>  
>>
>> 5. Restarted
>> Apache server.
>>
>>  
>>
>>  
>>
>>  
>>
>> Here is a snipper
>> of my log modjk.log
>>
>>  
>>
>>  
>>
>>  
>>
>>  
>>
>> [Fri Mar 04
>> 02:19:51.436 2011] [2276:6344] [info] jk_handler::mod_jk.c (2635): Could not
>> find a worker for worker name=loadbalancer
>>
>>  
>>
>> [Fri Mar 04
>> 02:19:55.658 2011] [2368:3752] [info] init_jk::mod_jk.c (3198): mod_jk/1.2.31
>> (1026297) initialized
>>
>>  
>>
>> [Fri Mar 04
>> 02:19:55.658 2011] [2368:3752] [error] uri_worker_map_ext::jk_uri_worker_map.c
>> (506): Could not find worker with name 'loadbalancer' in uri map post
>> processing.
>>
>>  
>>
>> [Fri Mar 04
>> 02:19:55.658 2011] [2368:3752] [error] uri_worker_map_ext::jk_uri_worker_map.c
>> (506): Could not find worker with name 'loadbalancer' in uri map post
>> processing.
>>
>>  
>>
>> [Fri Mar 04
>> 02:19:55.737 2011] [5964:6660] [info] init_jk::mod_jk.c (3198): mod_jk/1.2.31
>> (1026297) initialized
>>
>>  
>>
>> [Fri Mar 04
>> 02:19:55.737 2011] [5964:6660] [error] uri_worker_map_ext::jk_uri_worker_map.c
>> (506): Could not find worker with name 'loadbalancer' in uri map post
>> processing.
>>
>>  
>>
>> [Fri Mar 04
>> 02:19:55.737 2011] [5964:6660] [error] uri_worker_map_ext::jk_uri_worker_map.c
>> (506): Could not find worker with name 'loadbalancer' in uri map post
>> processing.
>>
>>  
>>
>> [Fri Mar 04
>> 02:19:55.782 2011] [5964:6660] [info] init_jk::mod_jk.c (3198): mod_jk/1.2.31
>> (1026297) initialized
>>
>>  
>>
>> [Fri Mar 04
>> 02:19:55.782 2011] [5964:6660] [error] uri_worker_map_ext::jk_uri_worker_map.c
>> (506): Could not find worker with name 'loadbalancer' in uri map post
>> processing.
>>
>>  
>>
>> [Fri Mar 04
>> 02:19:55.782 2011] [5964:6660] [error] uri_worker_map_ext::jk_uri_worker_map.c
>> (506): Could not find worker with name 'loadbalancer' in uri map post
>> processing.
>>
>>  
>>
>>  
>>
>> Here is the
>> workers.properties file
>>
>>  
>>
>>  
>>
>>  
>>
>> ===Start of
>> workers.properties==========================
>>
>>  
>>
>>  
>>
>>  
>>
>>  
>>
>> # Licensed to the
>> Apache Software Foundation (ASF) under one or more
>>
>>  
>>
>> # contributor
>> license agreements.  See the NOTICE file
>> distributed with
>>
>>  
>>
>> # this work for
>> additional information regarding copyright ownership.
>>
>>  
>>
>> # The ASF
>> licenses this file to You under the Apache License, Version 2.0
>>
>>  
>>
>> # (the
>> "License"); you may not use this file except in compliance with
>>
>>  
>>
>> # the
>> License.  You may obtain a copy of the
>> License at
>>
>>  
>>
>> #
>>
>>  
>>
>> #     http://www.apache.org/licenses/LICENSE-2.0
>>
>>  
>>
>> #
>>
>>  
>>
>> # Unless required
>> by applicable law or agreed to in writing, software
>>
>>  
>>
>> # distributed under
>> the License is distributed on an "AS IS" BASIS,
>>
>>  
>>
>> # WITHOUT
>> WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
>>
>>  
>>
>> # See the License
>> for the specific language governing permissions and
>>
>>  
>>
>> # limitations
>> under the License.
>>
>>  
>>
>>  
>>
>>  
>>
>> # Note that the
>> distributed version of this file requires modification
>>
>>  
>>
>> # before it is
>> usable.
>>
>>  
>>
>> #
>>
>>  
>>
>> # Reference
>> documentation: http://tomcat.apache.org/connectors-doc/reference/workers.html
>>
>>  
>>
>> #
>>
>>  
>>
>> # 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
>>
>>  
>>
>>  
>>
>>  
>>
>> # Define two
>> status worker:
>>
>>  
>>
>> # - jk-status for
>> read-only use
>>
>>  
>>
>> # - jk-manager
>> for read/write use
>>
>>  
>>
>> worker.list=jk-status
>>
>>  
>>
>> worker.jk-status.type=status
>>
>>  
>>
>> worker.jk-status.read_only=true
>>
>>  
>>
>>  
>>
>>  
>>
>> worker.list=jk-manager
>>
>>  
>>
>> worker.jk-manager.type=status
>>
>>  
>>
>>  
>>
>>  
>>
>> # We define a
>> load balancer worker
>>
>>  
>>
>> # with name
>> "balancer"
>>
>>  
>>
>> worker.list=balancer
>>
>>  
>>
>> worker.balancer.type=lb
>>
>>  
>>
>> #
>> error_escalation_time: seconds, default = recover_time/2 (=30)
>>
>>  
>>
>> # Determines, how
>> fast a detected error should switch from
>>
>>  
>>
>> # local error
>> state to global error state
>>
>>  
>>
>> # Since: 1.2.28
>>
>>  
>>
>> worker.balancer.error_escalation_time=0
>>
>>  
>>
>>  
>>
>>  
>>
>> # -
>> max_reply_timeouts: number, default=0
>>
>>  
>>
>> #   If there are to many reply timeouts, a
>> worker
>>
>>  
>>
>> #   is put into the error state, i.e. it will
>> become
>>
>>  
>>
>> #   unavailable for all sessions residing on the
>> respective
>>
>>  
>>
>> #   Tomcat. The number of tolerated reply
>> timeouts is
>>
>>  
>>
>> #   configured with max_reply_timeouts. The
>> number of
>>
>>  
>>
>> #   timeouts occuring is divided by 2 once a
>> minute and the
>>
>>  
>>
>> #   resulting counter is compared against max_reply_timeouts.
>>
>>  
>>
>> #   If you set max_reply_timeouts to N and the
>> errors are
>>
>>  
>>
>> #   occuring equally distributed over time, you
>> will
>>
>>  
>>
>> #   tolerate N/2 errors per minute. If they
>> occur in a burst
>>
>>  
>>
>> #   you will tolerate N errors.
>>
>>  
>>
>> #   Since: 1.2.24
>>
>>  
>>
>> worker.balancer.max_reply_timeouts=10
>>
>>  
>>
>>  
>>
>>  
>>
>>  
>>
>>  
>>
>>  
>>
>>  
>>
>> # Now we add
>> members to the load balancer
>>
>>  
>>
>> # First member is
>> "node1", most
>>
>>  
>>
>> # attributes are
>> inherited from the
>>
>>  
>>
>> # template
>> "worker.template".
>>
>>  
>>
>> worker.balancer.balance_workers=node1
>>
>>  
>>
>> worker.node1.reference=worker.template
>>
>>  
>>
>> worker.node1.host=localhost
>>
>>  
>>
>> worker.node1.port=8109
>>
>>  
>>
>> # Activation
>> allows to configure
>>
>>  
>>
>> # whether this
>> node should actually be used
>>
>>  
>>
>> # A: active (use
>> node fully)
>>
>>  
>>
>> # D: disabled
>> (only use, if sticky session needs this node)
>>
>>  
>>
>> # S: stopped (do
>> not use)
>>
>>  
>>
>> #   Since: 1.2.19
>>
>>  
>>
>> worker.node1.activation=A
>>
>>  
>>
>>  
>>
>>  
>>
>> # Second member
>> is "node2", most
>>
>>  
>>
>> # attributes are
>> inherited from the
>>
>>  
>>
>> # template
>> "worker.template".
>>
>>  
>>
>> worker.balancer.balance_workers=node2
>>
>>  
>>
>> worker.node2.reference=worker.template
>>
>>  
>>
>> worker.node2.host=localhost
>>
>>  
>>
>> worker.node2.port=8209
>>
>>  
>>
>> # Activation
>> allows to configure
>>
>>  
>>
>> # whether this
>> node should actually be used
>>
>>  
>>
>> # A: active (use
>> node fully)
>>
>>  
>>
>> # D: disabled
>> (only use, if sticky session needs this node)
>>
>>  
>>
>> # S: stopped (do
>> not use)
>>
>>  
>>
>> #   Since: 1.2.19
>>
>>  
>>
>> worker.node2.activation=A
>>
>>  
>>
>>  
>>
>>  
>>
>> # Finally we put
>> the parameters
>>
>>  
>>
>> # which should
>> apply to all our ajp13
>>
>>  
>>
>> # workers into
>> the referenced template
>>
>>  
>>
>> # - Type is ajp13
>>
>>  
>>
>> worker.template.type=ajp13
>>
>>  
>>
>>  
>>
>>  
>>
>> # -
>> socket_connect_timeout: milliseconds, default=0
>>
>>  
>>
>> #   Since: 1.2.27
>>
>>  
>>
>> worker.template.socket_connect_timeout=5000
>>
>>  
>>
>>  
>>
>>  
>>
>> # -
>> socket_keepalive: boolean, default=false
>>
>>  
>>
>> #   Should we send TCP keepalive packets
>>
>>  
>>
>> #   when connection is idle (socket option)?
>>
>>  
>>
>> worker.template.socket_keepalive=true
>>
>>  
>>
>>  
>>
>>  
>>
>> # - ping_mode:
>> Character, default=none
>>
>>  
>>
>> #   When should we use cping/cpong connection
>> probing?
>>
>>  
>>
>> #   C = directly after establishing a new
>> connection
>>
>>  
>>
>> #   P = directly before sending each request
>>
>>  
>>
>> #   I = in regular intervals for idle
>> connections
>>
>>  
>>
>> #       using the watchdog thread
>>
>>  
>>
>> #   A = all of the above
>>
>>  
>>
>> #   Since: 1.2.27
>>
>>  
>>
>> worker.template.ping_mode=A
>>
>>  
>>
>>  
>>
>>  
>>
>> # - ping_timeout:
>> milliseconds, default=10000
>>
>>  
>>
>> #   Wait timeout for cpong after cping
>>
>>  
>>
>> #   Can be overwritten for modes C and P
>>
>>  
>>
>> #   Using connect_timeout and prepost_timeout.
>>
>>  
>>
>> #   Since: 1.2.27
>>
>>  
>>
>> worker.template.ping_timeout=10000
>>
>>  
>>
>>  
>>
>>  
>>
>> # -
>> connection_pool_minsize: number, default=connection_pool_size
>>
>>  
>>
>> #   Lower pool size when shrinking pool due
>>
>>  
>>
>> #   to idle connections
>>
>>  
>>
>> #   We want all connections to be closed when
>>
>>  
>>
>> #   idle for a long time in order to prevent
>>
>>  
>>
>> #   firewall problems.
>>
>>  
>>
>> #   Since: 1.2.16
>>
>>  
>>
>> worker.template.connection_pool_minsize=0
>>
>>  
>>
>>  
>>
>>  
>>
>> # -
>> connection_pool_timeout: seconds, default=0
>>
>>  
>>
>> #   Idle time, before a connection is eligible
>>
>>  
>>
>> #   for being closed (pool shrinking).
>>
>>  
>>
>> #   This should be the same value as
>> connectionTimeout
>>
>>  
>>
>> #   in the Tomcat AJP connector, but there it is
>>
>>  
>>
>> #   milliseconds, here seconds.
>>
>>  
>>
>> worker.template.connection_pool_timeout=600
>>
>>  
>>
>>  
>>
>>  
>>
>> # -
>> reply_timeout: milliseconds, default=0
>>
>>  
>>
>> #   Any pause longer than this timeout during
>> waiting
>>
>>  
>>
>> #   for a part of the reply will abort handling
>> the request
>>
>>  
>>
>> #   in mod_jk. The request will proceed running
>> in
>>
>>  
>>
>> #   Tomcat, but the web server resources will be
>> freed
>>
>>  
>>
>> #   and an error is send to the client.
>>
>>  
>>
>> #   For individual requests, the timeout can be
>> overwritten
>>
>>  
>>
>> #   by the Apache environment variable JK_REPLY_TIMEOUT.
>>
>>  
>>
>> #   JK_REPLY_TIMEOUT since: 1.2.27
>>
>>  
>>
>> worker.template.reply_timeout=300000
>>
>>  
>>
>>  
>>
>>  
>>
>> # -
>> recovery_options: number, default=0
>>
>>  
>>
>> #   Bit mask to configure, if a request, which
>> was send
>>
>>  
>>
>> #   to a backend successfully, should be retried
>> on another backend
>>
>>  
>>
>> #   in case there's a problem with the response.
>>
>>  
>>
>> #   Value "3" disables retries,
>> whenever a part of the request was
>>
>>  
>>
>> #   successfully send to the backend.
>>
>>  
>>
>> worker.template.recovery_options=3
>>
>>  
>>
>>  
>>
>>  
>>
>> ===End of
>> workers.properties=========================== 		 	   		  
>  		 	   		  


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Mime
View raw message