Re: Update virtual hosts when server is running

2004-07-21 Thread Daniel J. Obregon
If you are running on linux/unix systems, find the pid for the parent
server process and send it a kill -USR1.  This will force the parent
server to reread the configuration file without actually shutting down or
forcefully killing its children.

- Dan Obregon -

 Hi.

 How do I update the lists of virtual hosts when the server is running
 (Apache Tomcat) - without restarting the servers?


 Lars Nielsen Lind


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



Re: Setting up mod_jk for Tomcat 5.0.27 under Apache 1.3.x

2004-07-21 Thread Daniel J. Obregon
I have been able to get the following to work too:
Solaris 5.6 + Apache 1.3.x + mod_jk + Tomcat

Had to search everywhere for the binaries that would run on Solaris, since
I had no luck building them myself.  So far, they work just fine

- Dan Obregon -


 On Tue, Jul 20, 2004 at 04:55:36PM -0700, Wendy Smoak wrote:
 : My initial thought is that Apache 1.3 and Tomcat 5 are probably getting
 too
 : far apart to be compatible, but that's just a suspicion.

 Good hunch, but the JK plugin abstracts Tomcat from the remote Apache
 (or IIS, etc) server.  Tomcat will talk to anything that speaks the JK
 protocol, be that mod_jk v1 or v2.


 : If someone's really bored, maybe a grid that shows what
 : OS/Apache/connector/Tomcat combinations are known to work would be a
 good
 : project. :)

 Here's a data point, for interested parties:

   RedHat 9 + Apache 2.x + mod_jk 1.2 + Tomcat 5
   FC1  + Apache 2.x + mod_jk 1.2 + Tomcat 5

 work like a charm.

 -QM


 --

 software  -- http://www.brandxdev.net
 tech news -- http://www.RoarNetworX.com


 -
 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: Tomcat and openSSL

2004-07-20 Thread Daniel J. Obregon
I would recommend using Apache to handle the ssl connections for you. 
I've been using apache as the ssl connection point in our production
environment and using mod_jk to send things on to tomcat.

I had tried using the ssl connector bundled with tomcat, but after awhile,
it just seemed to reach a point where it no longer served up web pages. 
Perhaps it was just a config thing...  At any rate, if you've already got
apache ssl working correctly, you just have to add a line to your conf
file:

Before:
Files ~ \.(cgi|shtml|phtml?)$
SSLOptions +StdEnvVars
/Files

After:
Files ~ \.(cgi|shtml|jsp|phtml|php3?)$
SSLOptions +StdEnvVars
/Files

Good Luck!

- Dan -


 Hi all,

 I'm new to this list and although I read the instructions on how to use
 the list, I'd like to apologize in advance if I ever misuse the list!

  -
 |Question|
  -
 I'm currently working on security with Apache Tomcat and openssl under
 Windows 2000. I'd like to set up Tomcat to be able to use it with SSL. I
 installed openssl on Windows and I'm now trying to create a CA and
 certificates.

 How am I exactly supposed to configure Tomcat and how does it relate to
 openssl? Did I even need to download openssl in the first place?
 Instructions on the web are unclear and several relate to older versions
 of Tomcat. (I'm running Tomcat 5.0.25).

 Thanks to all,
 David.

 -
 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: Tomcat 5: how do you set up logging as a stand-alone webserver?

2004-07-19 Thread Daniel J. Obregon
Add a line similar to the following to your application Context.

Logger className=org.apache.catalina.logger.FileLogger
debug=0
directory=logs
prefix=MyOwnLogFile.
suffix=.log
timestamp=true
verbosity=1/

- Dan -

 I would like to use Tomcat 5 as a stand-alone webserver (ie NOT with
 Apache). Can anyone point me in the right direction to the appropriate
 documentation? I got the O'Reilly Definitive Guide (which covers Tomcat 4,
 but I assume from a management point of view there is little difference
 between that and 5), and in there it shows how to dump detailed HTTP
 traffic
 using the RequestDumperValve. But this is clearly overkill!

 What I would like is to generate the sort of logs that the Apache
 webserver
 creates (ie its access and error logs). It seems the logs you get by
 default
 only push out Java stack traces. I would like to be able to see who is
 trying to connect to the Tomcat server, their web/IP address and the URL
 they are using (there are doubtless script-kiddies out there who are
 determined to blow my webserver away, and I can't seem to pick this info
 up!).

 I'm sure my answer is staring me in the face, but I can't just see what it
 is!

 Thanks,

 Joe.

 _
 MSN 8 helps eliminate e-mail viruses. Get 2 months FREE*.
 http://join.msn.com/?page=features/virus


 -
 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: Wildcard virtual hosts help

2004-07-16 Thread Daniel J. Obregon
What I'm thinking here is using a virtual host within an apache
configuration file:

*** With apache 2 (not sure if it's in apache 1.3x) you can have
virtual hosts defined in separate files and then include them in the
main httpd.conf file by saying Include path/to/foo.conf.  Apache 1.3
will let you include virtual hosts in the main httpd.conf file.

VirtualHost 1.2.3.4:80
   DirectoryIndex index.html index.jsp index.php
   ServerAdmin [EMAIL PROTECTED]
   DocumentRoot /usr/local/tomcat/webapps/App1
   ServerName foo.mydomain.com
   ServerAlias bar.mydomain.com
   ErrorLog logs/App1.error.log
   CustomLog logs/App1.access.log common
/VirtualHost

VirtualHost 1.2.3.4:80
   DirectoryIndex index.html index.jsp index.php
   ServerAdmin [EMAIL PROTECTED]
   DocumentRoot /usr/local/tomcat/webapps/App2
   ServerName foo2.mydomain.com
   ServerAlias bar2.mydomain.com
   ErrorLog logs/App2.error.log
   CustomLog logs/App2.access.log common
/VirtualHost

Again, this is just the approach I would take to map several domains to
the webapps.  I know you said it was thousands, which is why i thought
using a script to generate the virtual host config files would be a
possible solution.

- Dan -

 On Thu, 2004-07-15 at 13:15, Daniel J. Obregon wrote:
 Have you considered using apache/mod_jk?

 If you are mapping thousands of domains to a few webapps, it might be
 better to use apache.  Then, *worst* case you can write a script to
 generate and/or maintain a set of virtual hosts

 Actually, I am using Apache/mod_jk. How does that help me map domains to
 particular webapps ?  I hope I'm missing something simple. ;)

 thanks!



 -
 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: How to set JVM Max Memory

2004-07-16 Thread Daniel J. Obregon
Add one or both of the following to your start up scripts as
java command line options:

-mx1024M (or -Xmx1024M) to set the max to 1024 Mb
-ms256M  (or -Xms256M)  to set the min to 256 Mb

in my startup script I use this line:

setenv JAVA_OPTS -ms256M -mx1024M -Djava.awt.headless=true

- Dan Obregon -

 I have several sites running on Tomcat 5.0.19 and I only have one
 problem.  A couple of the sites keep running out of memory during peak
 traffic times.  It looks like the Tomcat server JVM is set to a default
 of 128M and I would like to increase that.  My box has plenty of memory
 available and I would like to use it.



 How do I set the JVM Max Memory?



 Thanks,

 Ben




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



Re: Memory settings and thread management

2004-07-15 Thread Daniel J. Obregon
Jim,

How are you doing mail?

If you are not shelling out to do email, you can probably disregard this
email, though it may be of use later

If you are shelling out from java to execute something locally, there's
something you should be aware of:

In this code snippet, I shell out to execute a program with arguments:

Process p = null;
try{
   Runtime runtime = Runtime.getRuntime();
   p = runtime.exec(arr_sCommands);
   int nStatus = p.waitFor();
} catch (Exception ex) {
   System.err.println(Caught this exception + ex.getMessage());
}

That will execute the command/arguments in arr_sCommands and wait for it to
return.

When running standalone, this is fine, but in a tomcat environment, there
is a pretty big problem.  Process opens up 3 file handles and DOES NOT
close them.  So that means every time you shell out to execute something,
you have 3 dangling file handles that could be eating up resources. 
Before long, you run into too many files open and all kinds of seemingly
unrelated errors.

to fix this, you should add this code:
try {
...
} catch (Exception ex) {
...
} finally {
   if ( p != null) {
  p.getErrorStream().close();
  p.getInputStream().close();
  p.getOutputStream().close();
  p.destroy();
  p = null;
   }
}


This is a bug in jdk's as recent as 1.4.2 (bugs # 4191034, 4637504)and has
no signs of being fixed soon, so beware of it!

Good Luck!

- Dan Obregon -

 I'm in a little over my head with a task I've got brewing in production
 land.  I'm a junior developer that was hired to be an entire team.

 Roughly ten times as many people are registered to use the project than
 I was told, so I purchased more RAM.  That makes the machine stats these.

 Pentium IV 2.4Ghz
 2GB DDR ECC RAM
 Debian Linux 2 stable
 Tomcat 4.1.30

 A segment of the system is designed to send e-mail to everyone on a
 list.  Each e-mail is sent by starting a thread that terminates when the
 sending is complete.  The upper bound of emails in this list is about a
 thousand, but will rarely exceed five hundred.  The system was running
 as expected (e.g. capable of sending multiple hundreds of messages)
 before at 512MB of RAM with the following options appended to JAVA_OPTS
 in catalina.sh

 -Xms 220M -Xmx 440M

 Now that the products have gotten the RAM upgrade, I changed these
 options to

 -Xms220m -Xmx1536m

 The result was a drop to about forty messages before I got an Out of
 Memory- unable to start new native thread error.

 As a result of looking around, particularly at the links like
 http://h21007.www2.hp.com/cmdspp/QuestionAnswer/1,1764,4AF428BF-32E1-4297-938A-0A1F93DE31B1,00.html
 and
 http://jboss.org/wiki/Wiki.jsp?page=OutOfMemoryExceptionWhenCannotCreateThread

 I changed the options to these

 -Xss1024K -Xms1536m -Xmx1536m

 but this only gets the boundary to about one hundred before thread
 creation fails.  We're nowhere near the process limit for Linux, running
 at approximately 400 or so.

 Should I just keep tweaking the configuration settings hoping to find
 something that works?  Give up a little bit more maximum heap size?  The
 one similar post I've seen since March had the user going down to 16k
 stack size.  Is that safe?  I can't be blowing my stack on the
 production machine, that's worse than the problem I have now!  I don't
 have any recursion going on, but I've seen some pretty deep stack traces.

 Is there something programmatically I could do, like having the call
 that starts the thread wait for awhile then try again if it fails?

 I've tried to do my homework, but I think I actually passed my limits on
 this project some time ago.  :-) Thanks and good karma in advance for
 any and all help.


 Cheers,

 Jim


 -
 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: Wildcard virtual hosts help

2004-07-15 Thread Daniel J. Obregon
Have you considered using apache/mod_jk?

If you are mapping thousands of domains to a few webapps, it might be
better to use apache.  Then, *worst* case you can write a script to
generate and/or maintain a set of virtual hosts

Just a thought...

- Dan Obregon -

 I have a specific problem that requires that I map hundreds of thousands
 (yes, hundreds of thousands) of domain names to a dozen or so different
 web-apps based on domain name. I currently use Resin to handle this, but
 really wish to abandon Resin for Tomcat for a variety of reasons.

 Uniquely defining each one as a web app isn't practical due to the sheer
 number involved, and the fact that hundreds of domain names come and go
 during the day.

 I've googled and searched the archives, and I can't seem to find an
 answer to how to do this with Tomcat 5, if it's even possible. I've seen
 several people asked, and the only one I found a number of responses to
 was chided for his decision to use wildcards. :)

 I would immensely appreciate it if anyone could point me in the
 direction of how to implement something like:

 Host name='*.mydomain.com'

 (which I've tried to no avail)

 thanks!



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