take 2: apache 2, tomcat 5.5

Ok, well heres the nice stuff

i have apache 2 working nicely now

i have tomcat5.5 working

i have the modjk connector compiled and working

i have in my apache2 virtualhost set up and telling stuff to juse JkMount.

i was hoping for a way to make apache2 automaticly configure tomcat, ie so that i dont have to write a server.xml

or soemthing like that, or a way that the server.xml is auto generated based on the apachevhosts or some sort of configuration?

suggestions on how to do it?

cheers

NF

5 Replies

With older tomcat versions you could have it generate apache config files automatically from server.xml. Try googling tomcat, apache-config, apacheconfig. I never used it, but I know used to be there, and it may still be in 5.5. You'd enable the option, tomcat generates an apache config file when it starts, and apache would need to include that file from its main config.

As far as apache generating the tomcat config, I think you'd need to write some scripts, unfortunately. The web app model is really geared toward web apps driving other config stuff. For example you couldn't back out data source settings from an apache config. Maybe there's something out there that will generate server.xml for a fixed web app model, but I haven't seen anything.

yeah i came to that conclusion unfortunatly, thats kewl, i dont really need it to generate files, i was just hoping for the best but expecting the worst :D

tho knowing how the hell to make it limit its theads would be nice.. even tho my server .xml file looks like this

 <server port="8005" shutdown="SHUTDOWN"><service name="Catalina"><connector port="8009" enablelookups="false" maxthreads="1" maxsparethreads="1" minsparethreads="1" redirectport="8443" protocol="AJP/1.3"><engine name="Catalina" defaulthost="our-lan.com"><host name="themetacity.com"><alias>www.themetacity.com</alias></host></engine></connector></service></server> 

ps aux shows that i still have a crapload running :S

nf@broken:~$ ps aux | grep jav     
tomcat    2016  0.0 33.0 286140 30120 ?        S    17:53   0:01 /usr/lib/j2sdk1.5-sun/bin/java -Djava.util.logging.manager=org.apache.juli.ClassLoaderL
tomcat    2017  0.0 33.0 286140 30120 ?        S    17:53   0:00 /usr/lib/j2sdk1.5-sun/bin/java -Djava.util.logging.manager=org.apache.juli.ClassLoaderL
tomcat    2018  0.0 33.0 286140 30120 ?        S    17:53   0:00 /usr/lib/j2sdk1.5-sun/bin/java -Djava.util.logging.manager=org.apache.juli.ClassLoaderL
tomcat    2019  0.0 33.0 286140 30120 ?        S    17:53   0:00 /usr/lib/j2sdk1.5-sun/bin/java -Djava.util.logging.manager=org.apache.juli.ClassLoaderL
tomcat    2020  0.0 33.0 286140 30120 ?        S    17:53   0:00 /usr/lib/j2sdk1.5-sun/bin/java -Djava.util.logging.manager=org.apache.juli.ClassLoaderL
tomcat    2021  0.0 33.0 286140 30120 ?        S    17:53   0:00 /usr/lib/j2sdk1.5-sun/bin/java -Djava.util.logging.manager=org.apache.juli.ClassLoaderL
tomcat    2022  0.0 33.0 286140 30120 ?        S    17:53   0:00 /usr/lib/j2sdk1.5-sun/bin/java -Djava.util.logging.manager=org.apache.juli.ClassLoaderL
tomcat    2023  0.0 33.0 286140 30120 ?        S    17:53   0:00 /usr/lib/j2sdk1.5-sun/bin/java -Djava.util.logging.manager=org.apache.juli.ClassLoaderL
tomcat    2024  0.0 33.0 286140 30120 ?        S    17:53   0:00 /usr/lib/j2sdk1.5-sun/bin/java -Djava.util.logging.manager=org.apache.juli.ClassLoaderL
tomcat    2025  0.0 33.0 286140 30120 ?        S    17:53   0:02 /usr/lib/j2sdk1.5-sun/bin/java -Djava.util.logging.manager=org.apache.juli.ClassLoaderL
tomcat    2026  0.0 33.0 286140 30120 ?        S    17:53   0:00 /usr/lib/j2sdk1.5-sun/bin/java -Djava.util.logging.manager=org.apache.juli.ClassLoaderL
tomcat    2027  0.0 33.0 286140 30120 ?        S    17:53   0:00 /usr/lib/j2sdk1.5-sun/bin/java -Djava.util.logging.manager=org.apache.juli.ClassLoaderL

nf        6673  0.0  0.4   1516   452 pts/1    R+   23:08   0:00 grep jav
nf@broken:~$ 

any suggestions for limiting the ammount of threads created?

You should confirm that it is indeed creating too may threads. You can do this by checking the tomcat status page if you have it enabled. The status page will show the thread settings and how many are actually in use.

Also try "kill -3 [pid]" and java will dump current thread stats to stdout.

Your extra ps proccesses are probably some of the "normal" threads, like the tomcat shutdown hook. You can check you don't have a connector listening on :8080, no RMI/JMX stuff listening, etc. "netstat -n -l -p" might help figure which other ports java is listening on. Each port java listens on probably has at least one thread associated with it.

If you have a java IDE with a debugger, you could also just run Tomcat on your local machine in the debugger, with the same settings, and examine the threads by hand. That's what I'd do.

kill -3 on any of the pids output'd nothing

only listening is 8005 and 8009.. the shutdown and the ajp connector ports

i cant imagine how about 9 proccess are shown even with assuming ecah 8005,8009 + processing threasd.. creates to 9.. theres njust not logical reason

kill -3 will cause java to output to its stdout, probably a tomcat log file, depending how you have it set up.

Did you check the tomcat status page?

I'm not at all surprised to see it create 9 threads. Just starting plain old java with a hello world type of program will cause java to create several threads, if you watch in a debugger. You may be able to trim down though if you find out exactly which tomcat features are using threads.

Reply

Please enter an answer
Tips:

You can mention users to notify them: @username

You can use Markdown to format your question. For more examples see the Markdown Cheatsheet.

> I’m a blockquote.

I’m a blockquote.

[I'm a link] (https://www.google.com)

I'm a link

**I am bold** I am bold

*I am italicized* I am italicized

Community Code of Conduct