• Willkommen im Linux Club - dem deutschsprachigen Supportforum für GNU/Linux. Registriere dich kostenlos, um alle Inhalte zu sehen und Fragen zu stellen.

Tomcat5 konfigurieren

Hallo,

habe bei 9.3 Apache2 am Laufen, funktioniert auch prima.

jetzt wollte ich Tomcat dazu installieren.
das habe ich auch über yast gemacht.

tomcat5
tomcat5-admin-webapps
mod_jk

jsp und servlets sollen über apache ausgeliefert werden
aber wie kann man nun tomcat konfigurieren und wie teste ich, ob er richtig eingrichtet ist?

wer kann mir helfen?

thx
 

Zyrus

Newbie
Hallo,

erstmal eine Datei '/etc/apache2/mod_jk.conf' anlegen:
<IfModule mod_jk.c>
JkWorkersFile /usr/share/tomcat5/conf/workers.properties
JkLogFile /usr/share/tomcat5/logs/mod_jk.log
JkLogLevel info
</IfModule>

dann '/usr/share/tomcat5/conf/workers.properties':
# workers.properties

#
# workers.tomcat_home should point to the location where you
# installed tomcat. This is where you have your conf, webapps and lib
# directories.
#
workers.tomcat_home=/usr/share/tomcat5

#
# workers.java_home should point to your Java installation. Normally
# you should have a bin and lib directories beneath it.
#
workers.java_home=/usr/lib/jvm/java

#
# You should configure your environment slash... ps=\ on NT and / on UNIX
# and maybe something different elsewhere.
#
ps=/

#
# The workers that your plugins should create and work with
#
worker.list=ajp13

#
# Defining a worker named ajp13 and of type ajp13
# Note that the name and the type do not have to match.
#
worker.ajp13.port=8009
worker.ajp13.host=localhost
worker.ajp13.type=ajp13

dann '/usr/share/tomcat5/conf/jk2.properties':
## THIS FILE MAY BE OVERRIDEN AT RUNTIME. MAKE SURE TOMCAT IS STOPED
## WHEN YOU EDIT THE FILE.

## COMMENTS WILL BE _LOST_

## DOCUMENTATION OF THE FORMAT IN JkMain javadoc.

# Set the desired handler list
# handler.list=apr,request,channelJni
handler.list=request
#
# Override the default port for the socketChannel
# channelSocket.port=8019
# Default:
# channelUnix.file=${jkHome}/work/jk2.socket
# Just to check if the the config is working
# shm.file=${jkHome}/work/jk2.shm

# In order to enable jni use any channelJni directive
# channelJni.disabled = 0
# And one of the following directives:

# apr.jniModeSo=/opt/apache2/modules/mod_jk2.so

# If set to inprocess the mod_jk2 will Register natives itself
# This will enable the starting of the Tomcat from mod_jk2
# apr.jniModeSo=inprocess

request.registerRequests=false

und zum Schluss noch die '/etc/apache2/httpd.conf' erweitern:
LoadModule jk_module /usr/lib/apache2/mod_jk.so
Include /etc/apache2/mod_jk.conf

Bei der Konfiguration eines virtuellen Hosts muss man auch noch ein paar Zeilen hinzufügen:
DocumentRoot "/usr/share/tomcat5/webapps"
JkMount /*.jsp ajp13
JkMount /*.do ajp13

JkMount /<Name der Web-Application>/<Name des Servlets> ajp13

Das war alles wichtige, hoffe ich habe nichts vergessen.

Gruss, Zyrus
 
OP
N

noboot4root

Newbie
danke erst mal für die ausführliche antwort.

habe alles so gemacht, wie angegeben

wenn ich jetzt z.b. eine start.jsp aufrufe, kommt folgende fehlermeldung:
________________________________________
Serverfehler!

Die Anfrage kann nicht beantwortet werden, da im Server ein interner Fehler aufgetreten ist. Der Server ist entweder überlastet oder ein Fehler in einem CGI-Skript ist aufgetreten.

Sofern Sie dies für eine Fehlfunktion des Servers halten, informieren Sie bitte den Webmaster hierüber.
Error 500

Wed Dec 21 21:22:28 2005
Apache/2.0.53 (Linux/SUSE)
__________________________________________
 

Zyrus

Newbie
Hallo,

da wird wohl die Web-Application falsch konfiguriert sein. Hier mal ein Beispiel, ich gehe mal davon aus, dass die App. 'test' heisst, also im Verz. '/usr/share/tomcat5/webapps/test' liegt (evt. mit Struts Framework und schon richtig konfigurierter web.xml).
Also muss nur noch '/usr/share/tomcat5/conf/server.xml' angepasst werden:

<Server port="8005" shutdown="SHUTDOWN" debug="0">
<Service name="Catalina">
<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"/>
<Host name="localhost" debug="0" appBase="webapps" unpackWARs="true" autoDeploy="true"
xmlValidation="false" xmlNamespaceAware="false">

<Context path="/test" docBase="test" debug="5" reloadable="true"
crossContext="true" cookies="false">
<Logger className="org.apache.catalina.logger.FileLogger" prefix="test_log."
suffix=".txt" timestamp="true"/>
</Context>
</Host>
</Engine>
</Service>
</Server>

Damit sollte es funktionieren. Evtl. den Hostnamen anpassen.

Gruss, Zyrus
 
OP
N

noboot4root

Newbie
danke für die antwort,

werde es leider erst in einer woche testen können, bin zur zeit unterwegs

werde mich melden und das ergebnis mitteilen


thx
 
Oben