Re: Options to prevent web app from being available if DB not available?

2005-09-26 Thread Steve Dodge

Mike,

Doing this with pure J2EE Servlet  code, I would use three components.  
First, use the Context Listener to check the Database on start up, if no 
DB connectivity set a ApplicationContext attribute to that effect.  The 
second part would be a javax.servlet.Filter which checks the status of 
the ApplicationContext attribute forwarding to an error page if the 
attribute indicates database connectivity issues.  Third, instead of 
just a String, I'd use a self-updating object as the attribute in the 
ApplicationContext.  This self updating object runs an internal timer 
thread which tests connectivity at a fixed interval setting the DB 
status to up or down.  This third component is optional.


Regarding your issue not wanting to start certain servlets if the 
Database is down, you could carry out a DB connectivity test in the base 
class to all your servlets, skipping initialization if no connectivity.


Steve

Mike Miller wrote:

Hi, 


I am looking for options to prevent my web application from being
available if our database is not available. I've used context listeners
in the past, but since you can return a bad return code they don't like
the cleanest approach.  




I have tried registering a context listener and then throwing a
RuntimeException if the database is not available but that seems like a
kludge.

Any other options?



Thanks in advance,

Mike


 




-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: classloader issue on jboss3.2.2 for tomcat4.1

2005-09-16 Thread Steve Dodge
It doesn't see any classes in any of your jars?  I was using JBoss 3.2.2 
back in 2003 and had the same issue.  Once I set the web loader to 
false, I realized that some utility classes were getting loaded from 
jars deployed in other wars.   Effectively, now each webapp has its own 
classloader.  So, I had to add those same jars into all my wars. 


On a side note, JBoss 4.0.x does a much better job with this.

Steve

lio tomcat wrote:


Hello world,
For some reason, i had to change default conf of my jboss 3.2.2 in order to 
avoid the use of jboss class loader.

It's now set in [jboss]\deploy\jbossweb-
tomcat41.sar\META-INF\jboss-service.xml in this way :

attribute name=UseJBossWebLoaderfalse/attribute 

The problem is now my webapp does not even see/load my jars in my 
war/WEB-INF/lib


What's the hint?

Please help,

thx

 




-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Two Service elements problems

2005-09-15 Thread Steve Dodge
I couldn't find it in your post, so let me ask.  Do you have 2 network 
interfaces on the machine?  How are you establishing 2 ip addresses?


This topic sparked my interest because I will also be doing the same 
thing. Now, to answer your question more definitively.I put together 
a mock setup using a 5.0.30 distro I had laying around (WinXP).
I took the default server.xml listening on localhost and added the 
following service element:


Service name=Catalina2
   Connector port=8081 address=littlehost
  maxThreads=150 minSpareThreads=25 maxSpareThreads=75
  enableLookups=false redirectPort=8443 acceptCount=100
  debug=0 connectionTimeout=2
  disableUploadTimeout=true /
   
   !-- Define the top level container in our container hierarchy --

   Engine name=Catalina2 defaultHost=littlehost debug=0

 !-- Global logger unless overridden at lower levels --
 Logger className=org.apache.catalina.logger.FileLogger
 prefix=catalina_log. suffix=.txt
 timestamp=true/

 Host name=littlehost debug=0 appBase=l_webapps
  unpackWARs=true autoDeploy=true
  xmlValidation=false xmlNamespaceAware=false

   Logger className=org.apache.catalina.logger.FileLogger
directory=logs  prefix=littlehost_log. suffix=.txt
   timestamp=true/

 /Host

   /Engine
/Service
I don't have a second network interface, so created a second host name 
littlehost to my actual ip address through /etc/hosts. 
Started tomcat . , my netstat confirmed that I was listening to port 
8080 on localhost and port 8081 on littlehost.
But, when I go to http://littlehost:8081/ nothing happened.  Then I 
followed the directions at 
http://www.ex-parrot.com/~pete/tomcat-vhost.html for setting up a 
virtual host. 


Using that reference I did this:
1. Added a ROOT.xml file in conf/Catalina2/littlehost
2  Created the l_webapps directory specified by my Host element.
3. Created a web application deployment structure in the l_webapps directory
4. Created an index.jsp at the root of l_webapps

Restarted tomcat .. now http://littlehost:8081/ servers up content.

Good Luck
Steve

Barnett, Brian W. wrote:


netstat -an results (snippet)

Proto  Local Address  Foreign AddressState
TCP166.70.163.138:80  0.0.0.0:0  LISTENING
TCP166.70.163.138:139 0.0.0.0:0  LISTENING
TCP166.70.163.138:2109166.70.163.131:2433ESTABLISHED
TCP166.70.163.138:2110166.70.163.138:8093ESTABLISHED
TCP166.70.163.138:2113166.70.163.138:8093ESTABLISHED
TCP166.70.163.138:2115166.70.163.138:8093ESTABLISHED
TCP166.70.163.138:2117166.70.163.138:8093ESTABLISHED
TCP166.70.163.138:2119166.70.163.138:8093ESTABLISHED
TCP166.70.163.138:2122166.70.163.138:8093ESTABLISHED
TCP166.70.163.138:2125166.70.163.131:2433ESTABLISHED
TCP166.70.163.138:338963.253.57.180:4881 ESTABLISHED
TCP166.70.163.138:8093166.70.163.138:2110ESTABLISHED
TCP166.70.163.138:8093166.70.163.138:2113ESTABLISHED
TCP166.70.163.138:8093166.70.163.138:2115ESTABLISHED
TCP166.70.163.138:8093166.70.163.138:2117ESTABLISHED
TCP166.70.163.138:8093166.70.163.138:2119ESTABLISHED
TCP166.70.163.138:8093166.70.163.138:2122ESTABLISHED
UDP166.70.163.138:123 *:*
UDP166.70.163.138:137 *:*
UDP166.70.163.138:138 *:*
UDP166.70.163.138:520 *:*
UDP166.70.163.140:123 *:*
UDP166.70.163.140:520 *:*
UDP166.70.163.140:1900*:*

No TCP info for 166.70.163.140, only UDP info. Not sure where to turn for
help on this one. I'm not a network guy :(
Any suggestions?


-Original Message-
From: Steve Dodge [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, September 14, 2005 12:32 PM

To: Tomcat Users List
Subject: Re: Two Service elements problems


If you do a netstat -ln (cygwin)  do you see two network sockets 
listening on port 80? 


166.70.163.138:80
166.70.163.140:80

If not, the problem is at a lower level than tomcat.

Steve




Barnett, Brian W. wrote:

 

I have two Service elements defined like this in my server.xml file, 
each one listening to a different IP address and serving requests for 
different web sites. (Using 5.0.28)


Service name=MyService1 
	Connector port=80 
		maxThreads=150 minSpareThreads=25 maxSpareThreads=75 
		enableLookups=false redirectPort=443 acceptCount=100 
		debug=0 connectionTimeout=2 
		disableUploadTimeout=true 
		address=166.70.163.138 / 
	Connector port=443 
		maxThreads=150 minSpareThreads=25 maxSpareThreads=75 
		enableLookups=false disableUploadTimeout=true 
		acceptCount=100 debug=0 scheme=https secure=true 
		clientAuth=false sslProtocol=TLS 
		address=166.70.163.138 / 
	Engine name=Catalina1 defaultHost=host1 debug=0 
		Host name=host1 debug=0 appBase=/webapps/host1 
			unpackWARs=true autoDeploy=true

Re: Virtual Hosts

2005-09-15 Thread Steve Dodge
You probably want to change the appBase. You can control the contexts by 
creating a context snippet in conf/[Engine name]/[Host name]  or add it 
to META-INF/context.xml in each war.


Hope that helps,
Steve

Durfee, Bernard wrote:


Okay, so I created two host elements in my server.xml...

 Host name=app01.myserver.com
   appBase=webapps
   autoDeploy=true
   deployOnStartup=true
   deployXML=true
   unpackWARs=true
   xmlValidation=false
   xmlNamespaceAware=false /

 Host name=app02.myserver.com
   appBase=webapps
   autoDeploy=true
   deployOnStartup=true
   deployXML=true
   unpackWARs=true
   xmlValidation=false
   xmlNamespaceAware=false /

...but how do I tell Tomcat which context to process? There will be no
context correct? Do I need a separate appBase directory for each host
element?

Thanks,
Bernie



 


-Original Message-
From: Allistair Crossley [mailto:[EMAIL PROTECTED] 
Sent: Thursday, September 15, 2005 12:10 PM

To: Tomcat Users List
Subject: RE: Virtual Hosts


Simplistically ...

Configure Host elements inside your Engine. Create a folder 
for each application within webapps. Set the Host docBase to each. 


Check out the online ref.

   


-Original Message-
From: Durfee, Bernard [mailto:[EMAIL PROTECTED]
Sent: 15 September 2005 17:07
To: tomcat-user@jakarta.apache.org
Subject: Virtual Hosts


I am having trouble configuring virtual hosts in Tomcat 
 

5.5.9. I have 
   

two applications app01 and app02. I have 2 DNS entries 
app01.myserver.com and app02.myserver.com that both point to the 
machine on which Tomcat is running. How do I configure 
 

Tomcat to serve 
   


from app01.war when app01.myserver.com is hit and app02.war when
app02.myserver.com is hit.

Thanks,
Bernie



 


-
   


To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


 

FONT SIZE=1 FACE=VERDANA,ARIAL COLOR=BLUE 
---

QAS Ltd.
Registered in England: No 2582055
Registered in Australia: No 082 851 474
---
/FONT FONT SIZE=1 FACE=VERDANA,ARIAL COLOR=BLACK 
Disclaimer:  The information contained within this e-mail is 
confidential and may be privileged. This email is intended 
solely for the named recipient only; if you are not 
authorised you must not disclose, copy, distribute, or retain 
this message or any part of it. If you have received this 
message in error please contact the sender at once so that we 
may take the appropriate action and avoid troubling you 
further.  Any views expressed in this message are those of 
the individual sender.  QAS Limited has the right lawfully to 
record, monitor and inspect messages between its employees 
and any third party.  Your messages shall be subject to such 
lawful supervision as QAS Limited deems to be necessary in 
order to protect its information, its interests and its reputation.  

Whilst all efforts are made to safeguard Inbound and Outbound 
emails, QAS Limited cannot guarantee that attachments are 
virus free or compatible with your systems and does not 
accept any liability in respect of viruses or computer 
problems experienced. /FONT



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


   



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




 




-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Two Service elements problems

2005-09-15 Thread Steve Dodge

Brian,

On more follow up.  I found a usb wireless network adapter that I forgot 
I had.  The server.xml snippet below stayed the same, except I had to 
add the address attribute on the original http connector element.  I 
opted to use the Ip addresses instead of messing with /etc/hosts this time.


Now I have .

Service name=Catalina
   Connector port=8080 address=192.168.0.2
  etc etc...

Service name=Catalina2
   Connector port=8080 address=192.168.0.5
  etc etc...

netstat -an (snippet)
 TCP192.168.0.2:8080   0.0.0.0:0  LISTENING
 TCP192.168.0.5:1390.0.0.0:0  LISTENING
 TCP192.168.0.5:8080   0.0.0.0:0  LISTENING

It serves content on both IP addresses with the same port.

Steve

Barnett, Brian W. wrote:


Thanks Steve. I will try that. Regarding your question to me, I have tried
two different approaches. My first approach was to bind an additional IP
address to the one NIC I had in the XP box using the Advanced button in
TCP/IP setup for the NIC. I struggled through that for a few days, then
decided to put in a second NIC. I struggled to get that working for a few
days and ended up going to back to two IPs bound to a single NIC.

Since I have not yet got it working the way I want it to work, I can not say
definitively whether either of those approaches worked, although from my
research either *should* work. There are advantages/disadvantages to each.
Things to consider are bandwidth sharing, if a NIC goes down you lose both
IPs or just one, etc.

Again, thanks for your input!

Brian

-Original Message-
From: Steve Dodge [mailto:[EMAIL PROTECTED] 
Sent: Thursday, September 15, 2005 2:40 PM

To: Tomcat Users List
Subject: Re: Two Service elements problems


I couldn't find it in your post, so let me ask.  Do you have 2 network 
interfaces on the machine?  How are you establishing 2 ip addresses?


This topic sparked my interest because I will also be doing the same 
thing. Now, to answer your question more definitively.I put together 
a mock setup using a 5.0.30 distro I had laying around (WinXP). I took the
default server.xml listening on localhost and added the 
following service element:


Service name=Catalina2
   Connector port=8081 address=littlehost
  maxThreads=150 minSpareThreads=25 maxSpareThreads=75
  enableLookups=false redirectPort=8443 acceptCount=100
  debug=0 connectionTimeout=2
  disableUploadTimeout=true /
   
   !-- Define the top level container in our container hierarchy --

   Engine name=Catalina2 defaultHost=littlehost debug=0

 !-- Global logger unless overridden at lower levels --
 Logger className=org.apache.catalina.logger.FileLogger
 prefix=catalina_log. suffix=.txt
 timestamp=true/

 Host name=littlehost debug=0 appBase=l_webapps
  unpackWARs=true autoDeploy=true
  xmlValidation=false xmlNamespaceAware=false

   Logger className=org.apache.catalina.logger.FileLogger
directory=logs  prefix=littlehost_log. suffix=.txt
   timestamp=true/

 /Host

   /Engine
/Service
I don't have a second network interface, so created a second host name 
littlehost to my actual ip address through /etc/hosts. 
Started tomcat . , my netstat confirmed that I was listening to port 
8080 on localhost and port 8081 on littlehost.
But, when I go to http://littlehost:8081/ nothing happened.  Then I 
followed the directions at 
http://www.ex-parrot.com/~pete/tomcat-vhost.html for setting up a 
virtual host. 


Using that reference I did this:
1. Added a ROOT.xml file in conf/Catalina2/littlehost
2  Created the l_webapps directory specified by my Host element. 3.
Created a web application deployment structure in the l_webapps directory 4.
Created an index.jsp at the root of l_webapps

Restarted tomcat .. now http://littlehost:8081/ servers up content.

Good Luck
Steve

Barnett, Brian W. wrote:

 


netstat -an results (snippet)

Proto  Local Address  Foreign AddressState
TCP166.70.163.138:80  0.0.0.0:0  LISTENING
TCP166.70.163.138:139 0.0.0.0:0  LISTENING
TCP166.70.163.138:2109166.70.163.131:2433ESTABLISHED
TCP166.70.163.138:2110166.70.163.138:8093ESTABLISHED
TCP166.70.163.138:2113166.70.163.138:8093ESTABLISHED
TCP166.70.163.138:2115166.70.163.138:8093ESTABLISHED
TCP166.70.163.138:2117166.70.163.138:8093ESTABLISHED
TCP166.70.163.138:2119166.70.163.138:8093ESTABLISHED
TCP166.70.163.138:2122166.70.163.138:8093ESTABLISHED
TCP166.70.163.138:2125166.70.163.131:2433ESTABLISHED
TCP166.70.163.138:338963.253.57.180:4881 ESTABLISHED
TCP166.70.163.138:8093166.70.163.138:2110ESTABLISHED
TCP166.70.163.138:8093166.70.163.138:2113ESTABLISHED
TCP166.70.163.138:8093166.70.163.138:2115

Re: Two Service elements problems

2005-09-14 Thread Steve Dodge
If you do a netstat -ln (cygwin)  do you see two network sockets 
listening on port 80? 


166.70.163.138:80
166.70.163.140:80

If not, the problem is at a lower level than tomcat.

Steve




Barnett, Brian W. wrote:


I have two Service elements defined like this in my server.xml file, each
one listening to a different IP address and serving requests for different
web sites. (Using 5.0.28)

Service name=MyService1 
	Connector port=80 
		maxThreads=150 minSpareThreads=25 maxSpareThreads=75 
		enableLookups=false redirectPort=443 acceptCount=100 
		debug=0 connectionTimeout=2 
		disableUploadTimeout=true 
		address=166.70.163.138 / 
	Connector port=443 
		maxThreads=150 minSpareThreads=25 maxSpareThreads=75 
		enableLookups=false disableUploadTimeout=true 
		acceptCount=100 debug=0 scheme=https secure=true 
		clientAuth=false sslProtocol=TLS 
		address=166.70.163.138 / 
	Engine name=Catalina1 defaultHost=host1 debug=0 
		Host name=host1 debug=0 appBase=/webapps/host1 
			unpackWARs=true autoDeploy=true 
			xmlValidation=false xmlNamespaceAware=false 
		/Host 
	/Engine 
/Service


Service name=MyService2 
	Connector port=80 
		maxThreads=150 minSpareThreads=25 maxSpareThreads=75 
		enableLookups=false redirectPort=443 acceptCount=100 
		debug=0 connectionTimeout=2 
		disableUploadTimeout=true 
		address=166.70.163.140 / 
	Connector port=443 
		maxThreads=150 minSpareThreads=25 maxSpareThreads=75 
		enableLookups=false disableUploadTimeout=true 
		acceptCount=100 debug=0 scheme=https secure=true 
		clientAuth=false sslProtocol=TLS 
		address=166.70.163.140 / 
	Engine name=Catalina2 defaultHost=host2 debug=0 
		Host name=host2 debug=0 appBase=/webapps/host2 
			unpackWARs=true autoDeploy=true 
			xmlValidation=false xmlNamespaceAware=false 
		/Host 
	/Engine 
/Service 


My Tomcat folder structure looks like this:

conf
--Catalina1
host1
--[various .xml files (context files)]
--Catalina2
host2
--[various .xml files (context files)]
webapps
--host1
[various webapps]
--host2
[various webapps]

I can browse successfully to all the web apps that are deployed in
webapps/host1 but when I browse to host 2 I get the following error:

(Error message from Firefox when browsing to http://166.70.163.140)

The connection was refused when attempting to contact 166.70.163.140.

In the stdout.log file, mention is made of the context files in
/Catalina1/host1 but no mention is made of context files in
/Catalina2/host2.

Sep 14, 2005 10:53:04 AM org.apache.catalina.core.StandardHostDeployer
install
INFO: Processing Context configuration file URL file:C:\Program Files\Apache
Software Foundation\Tomcat 5.0\conf\Catalina1\host1\admin.xml
Sep 14, 2005 10:53:12 AM org.apache.struts.util.PropertyMessageResources
init
INFO: Initializing, config='org.apache.struts.util.LocalStrings',
returnNull=true
Sep 14, 2005 10:53:12 AM org.apache.struts.util.PropertyMessageResources
init
INFO: Initializing, config='org.apache.struts.action.ActionResources',
returnNull=true
Sep 14, 2005 10:53:13 AM org.apache.struts.util.PropertyMessageResources
init
INFO: Initializing, config='org.apache.webapp.admin.ApplicationResources',
returnNull=true
Sep 14, 2005 10:53:18 AM org.apache.catalina.core.StandardHostDeployer
install
INFO: Processing Context configuration file URL file:C:\Program Files\Apache
Software Foundation\Tomcat 5.0\conf\Catalina1\host1\balancer.xml
Sep 14, 2005 10:53:19 AM org.apache.catalina.core.StandardHostDeployer
install
INFO: Processing Context configuration file URL file:C:\Program Files\Apache
Software Foundation\Tomcat 5.0\conf\Catalina1\host1\gapay.xml
Sep 14, 2005 10:53:23 AM org.apache.catalina.core.StandardHostDeployer
install
INFO: Processing Context configuration file URL file:C:\Program Files\Apache
Software Foundation\Tomcat 5.0\conf\Catalina1\host1\manager.xml
Sep 14, 2005 10:53:23 AM org.apache.catalina.core.StandardHostDeployer
install
INFO: Processing Context configuration file URL file:C:\Program Files\Apache
Software Foundation\Tomcat 5.0\conf\Catalina1\host1\webshare.xml

I wondered if 166.70.163.140 was accessible at all, so I just tried having
one Service defined without specifying an IP address. Both IPs were
accessible in this case, so I assumed 166.70.163.140 was configured
correctly.

I tried it with and without Windows XP firewall enabled and got same
results.

Can someone shed some light on what could be the problem(s)?

Thanks,
Brian Barnett

 
This email may contain confidential material. 
If you were not an intended recipient, 
Please notify the sender and delete all copies. 
We may monitor email to and from our network. 



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




 





Re: workers.properties load balancing

2005-09-10 Thread Steve Dodge
Thanks for the answer.  In the future, I'm wondering if you know where I 
could find some debug output that will tell me my workers.properties was 
misconfigured.   The only output I was getting was through the 
mod_jk.log which told me JkMount was handling the request but could not 
find the worker.


Thanks,
Steve

Rainer Jung wrote:


Hi Steve,

not a bug in 1.2.6 either:

You have used the attribute balance_workers:

 


worker.router.balance_workers=worker1,worker2
   



Version 1.2.6 only knew about balanced_workers. See the tiny difference?
In 1.2.14 you can use either of both and balance_workers take precendence.

 


Steve Dodge wrote:

   


JK 1.2.14 with Tomcat 5.0.28 and Apache 2.0.52 on Linux RH AS4,
Tomcats are installed on different machines.   I cannot get a load
balancing worker to work. mod_jk forwards request to tomcat just fine
as long as I don't try and use a load balancing worker in my
worker.list. The mod_jk.log says did not find a worker.

==workers.properties
worker.list=router

# Set properties for worker1 (ajp13)
worker.worker1.type=ajp13
worker.worker1.host=server.ip1
worker.worker1.port=8009
worker.worker1.lbfactor=1
worker.worker1.cachesize=10

# Set properties for worker2 (ajp13)
worker.worker2.type=ajp13
worker.worker2.host=server.ip2
worker.worker2.port=8009
worker.worker2.lbfactor=1
worker.worker2.cachesize=10


worker.router.type=lb
worker.router.balance_workers=worker1,worker2
#worker.router.sticky_seesion=True

worker.status.type=status

=mod_jk.config==
JkWorkersFile /etc/httpd/conf.d/workers.properties
JkLogFile /var/log/httpd/mod_jk.log
JkLogLeveltrace
JkLogStampFormat [%a %b %d %H:%M:%S %Y] 
JkOptions +ForwardKeySize +ForwardURICompat -ForwardDirectories
JkRequestLogFormat %w %V %T

JkMount /jmx-console/*.jsp router
JkMount /jkstatus/* status


When I use worker.list=worker1,worker1 and replace JkMount
/jmx-console/*.jsp worker1 requests are forwarded, but I loose load
balancing.  Its like the minute I put the load balancer worker into
the list, the whole workers configuration is bad.

Thanks in advance,
Steve


 


I have some clarification on my workers.properties issue.  It's not an
Issue!  The version of JK connectors was not JK 1.2.14, it was JK
1.2.6.  Sorry to leave anyone scratching their head.   I told my system
admin to build from source JK 1.2.14, but to save time he found a
pre-packaged rpm from RedHat containing JK 1.2.6.  I wasn't aware of the
fact that I had debugged version 6 instead of 14.  So for those who are
interested, JK 1.2.6 had BUGS.

-Building mod_jk 
On another note, compiling JK connectors went very smooth on a stock
redhat box with RPM devel packages.  All we had to do was install the
httpd-devel-2.0.52-12.2.ent.i386.rpm and any rpm's required by it (to
get a list type  rpm -qp --requires httpd-devel-2.0.52-12.2.ent.i386.rpm
)  Then download and extract the JK source code.  Navigate to the native
directory type in |*./configure --with-apxs=/usr/sbin/apxs, the
corresponding Apache2.0.x mod_jk.so resulted. Instructions are found at
http://jakarta.apache.org/tomcat/connectors-doc/howto/apache.html

Steve
*|

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

   





-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




 




-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: JSP on RHEL4 with Apache httpd RPM?

2005-09-09 Thread Steve Dodge

Peter Flynn wrote:


On Fri, 2005-09-09 at 06:13, Nikola Milutinovic wrote:
 


Peter Flynn wrote:

   


I need to add JSP ability to a RHEL4 server running the
current Apache httpd from the Red Hat RPM. 
 


[...]
 


Has anyone managed to serve JSP with Tomcat on a RHEL4
machine running their stock httpd? 
 

You're looking for mod_jk RPM or mod_jk2 (which has been dropped from 
development). 
   



I found mod_jk-ap20-1.2.10-1jpp.i386.rpm at http://www.jpackage.org and
It installed without error on RHEL4 running stock httpd-2.0.52-9.ent.rpm

So far, so good. So I added the suggested element

   Listener className=org.apache.jk.config.ApacheConfig 
 modJk=/usr/lib/httpd/modules/mod_jk.so /


to the Engine name=Catalina ... container in server.xml and 
restarted Tomcat. 

This created /usr/local/jakarta-tomcat-5.5.9/conf/auto/mod_jk.conf 
(NOT mod_jk.conf.auto as the Jakarta Tomcat Connector Apache HowTo 
documentation says). 


The mod_jk.conf was pretty skeletal, so I added:

  JkWorkersFile /usr/local/jakarta-tomcat-5.5.9/conf/workers.properties

and edited workers.properties to reflect the locations

  workers.tomcat_home=/usr/local/jakarta-tomcat-5.5.9
  workers.java_home=/usr/java/jdk1.5.0_03

and added this line to /etc/httpd/conf/httpd.conf

  Include /usr/local/jakarta-tomcat-5.5.9/conf/auto/mod_jk.conf

and finally restarted Apache. No error, but it doesn't do anything
meaningful with my JSP files: it just serves them through Apache. 

Looking in mod_jk.conf I see it mentions all the subdirectories in 
Tomcat's webapps directory, but nowhere does it reference any 
directories in my Apache document tree. 

I've obviously missed how to get it configured to serve JSP files 
from the Apache web server directories. I have no interest in serving 
any JSPs from the Tomcat directories, as all I use Tomcat:8080 for is 
serving Cocoon, which already works fine.


The JkMount directives in mod_jk.conf all refer to /directory being
in Tomcat's webapps directory. How do I reference directories which
are actually below /var/www/html so that they get handled by Tomcat?

In mod_jk.conf, what does this refer to:

  VirtualHost localhost
   ServerName localhost

The Tomcat:8080 server or the Apache httpd:80 server? 

If it's Tomcat, then I can understand why JkMount /directory refers 
to Tomcat's webapps, but it seems very weird that the autoconf should 
configure mod_jk.conf to mount only Tomcat's directories, when the 
entire point of the operation is to enable serving of Apache's own

JSP files.

If it's Apache's httpd, which it is presumably intended for, as this
file gets Include'd from Apache's httpd.conf, then why does it still
refer to localhost instead of picking up the ServerName from the
httpd.conf?

Should I change both localhost's to my server's FQDN?

///Peter


 


Peter,

1. VirtualHostis an apache http server directive.
2. With JkMount you're not actually mapping a physical directory, it's a 
url pattern.  If you have a tomcat webapp that serves jsp's such as 
http://localhost:8080/mywebapp, then you can map jsp requests to that 
webapp using JkMount /mywebapp/*.jsp


Hope that helps,
Steve

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: workers.properties load balancing

2005-09-09 Thread Steve Dodge

Steve Dodge wrote:

JK 1.2.14 with Tomcat 5.0.28 and Apache 2.0.52 on Linux RH AS4, 
Tomcats are installed on different machines.   I cannot get a load 
balancing worker to work. mod_jk forwards request to tomcat just fine 
as long as I don't try and use a load balancing worker in my 
worker.list. The mod_jk.log says did not find a worker.


==workers.properties
worker.list=router

# Set properties for worker1 (ajp13)
worker.worker1.type=ajp13
worker.worker1.host=server.ip1
worker.worker1.port=8009
worker.worker1.lbfactor=1
worker.worker1.cachesize=10

# Set properties for worker2 (ajp13)
worker.worker2.type=ajp13
worker.worker2.host=server.ip2
worker.worker2.port=8009
worker.worker2.lbfactor=1
worker.worker2.cachesize=10


worker.router.type=lb
worker.router.balance_workers=worker1,worker2
#worker.router.sticky_seesion=True

worker.status.type=status

=mod_jk.config==
JkWorkersFile /etc/httpd/conf.d/workers.properties
JkLogFile /var/log/httpd/mod_jk.log
JkLogLeveltrace
JkLogStampFormat [%a %b %d %H:%M:%S %Y] 
JkOptions +ForwardKeySize +ForwardURICompat -ForwardDirectories
JkRequestLogFormat %w %V %T

JkMount /jmx-console/*.jsp router
JkMount /jkstatus/* status


When I use worker.list=worker1,worker1 and replace JkMount 
/jmx-console/*.jsp worker1 requests are forwarded, but I loose load 
balancing.  Its like the minute I put the load balancer worker into 
the list, the whole workers configuration is bad.


Thanks in advance,
Steve


I have some clarification on my workers.properties issue.  It's not an 
Issue!  The version of JK connectors was not JK 1.2.14, it was JK 
1.2.6.  Sorry to leave anyone scratching their head.   I told my system 
admin to build from source JK 1.2.14, but to save time he found a 
pre-packaged rpm from RedHat containing JK 1.2.6.  I wasn't aware of the 
fact that I had debugged version 6 instead of 14.  So for those who are 
interested, JK 1.2.6 had BUGS. 


-Building mod_jk 
On another note, compiling JK connectors went very smooth on a stock 
redhat box with RPM devel packages.  All we had to do was install the  
httpd-devel-2.0.52-12.2.ent.i386.rpm and any rpm's required by it (to 
get a list type  rpm -qp --requires httpd-devel-2.0.52-12.2.ent.i386.rpm 
)  Then download and extract the JK source code.  Navigate to the native 
directory type in |*./configure --with-apxs=/usr/sbin/apxs, the 
corresponding Apache2.0.x mod_jk.so resulted. Instructions are found at

http://jakarta.apache.org/tomcat/connectors-doc/howto/apache.html

Steve
*|

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



workers.properties load balancing

2005-09-08 Thread Steve Dodge
JK 1.2.14 with Tomcat 5.0.28 and Apache 2.0.52 on Linux RH AS4, Tomcats 
are installed on different machines.   I cannot get a load balancing 
worker to work. mod_jk forwards request to tomcat just fine as long as I 
don't try and use a load balancing worker in my worker.list. The 
mod_jk.log says did not find a worker.


==workers.properties
worker.list=router

# Set properties for worker1 (ajp13)
worker.worker1.type=ajp13
worker.worker1.host=server.ip1
worker.worker1.port=8009
worker.worker1.lbfactor=1
worker.worker1.cachesize=10

# Set properties for worker2 (ajp13)
worker.worker2.type=ajp13
worker.worker2.host=server.ip2
worker.worker2.port=8009
worker.worker2.lbfactor=1
worker.worker2.cachesize=10


worker.router.type=lb
worker.router.balance_workers=worker1,worker2
#worker.router.sticky_seesion=True

worker.status.type=status

=mod_jk.config==
JkWorkersFile /etc/httpd/conf.d/workers.properties
JkLogFile /var/log/httpd/mod_jk.log
JkLogLeveltrace
JkLogStampFormat [%a %b %d %H:%M:%S %Y] 
JkOptions +ForwardKeySize +ForwardURICompat -ForwardDirectories
JkRequestLogFormat %w %V %T

JkMount /jmx-console/*.jsp router
JkMount /jkstatus/* status


When I use worker.list=worker1,worker1 and replace JkMount 
/jmx-console/*.jsp worker1 requests are forwarded, but I loose load 
balancing.  Its like the minute I put the load balancer worker into the 
list, the whole workers configuration is bad.


Thanks in advance,
Steve


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]