HOWTO : Apache/Tomcat (at last !!)

nebukazar

Verified User
Joined
Sep 28, 2003
Messages
130
- Where can I see the tomcat online manager? I see that tomcat uses 8005 but I cannot get a connection on it.
-- You can get to the manager by using the URL : http://somedomain.com/manager/list
However, I think I forgot to enable the HTML gui for the manager. It is quite simple to enable the HTML GUI. I will write the 2 steps needed when I will be at home.

- Can I use JSP on my normal apache? My server-version-string doesn't show anythig about tomcat now, and it doesn't parse .jsp pages.
-- You won't be able to serve JSP pages with apache. You need to make sure mod_jk is enabled.

Can anybody tell me how to use it? I just want to have my .jsp parsing working.
-- If you follow the howto, you should be able to install tomcat correctly. If it doesn't work, you can PM me and I will take a look at it.
 

jep

Verified User
Joined
Nov 12, 2003
Messages
79
Hi,

Thanks for you response, this is my server.xml:

<Server port="8005" shutdown="SHUTDOWN" debug="0">
<Service name="Tomcat-Standalone">
<!-- Define a Coyote/JK2 AJP 1.3 Connector on port 8009 -->
<Connector className="org.apache.coyote.tomcat4.CoyoteConnector" port="8009" minProcessors="5"
maxProcessors="75" enableLookups="true" redirectPort="8443" acceptCount="10" debug="0"
connectionTimeout="20000" useURIValidationHack="false"
protocolHandlerClassName="org.apache.jk.server.JkCoyoteHandler"/>
<Engine name="Standalone" defaultHost="localhost" debug="0">
<Logger className="org.apache.catalina.logger.FileLogger" prefix="catalina_log." suffix=".txt"
timestamp="true"/>
<Realm className="org.apache.catalina.realm.MemoryRealm"/>
<!-- Define the default virtual host -->
<Host name="localhost" debug="0" appBase="webapps" unpackWARs="true" autoDeploy="true"/>
<Host name="zichtbc.exonet.nl">
<Alias>some-site.com</Alias>
<Context path="" docBase="/home/zichtbc/public_html/" debug="0"/>
<Context path="/manager" docBase="/usr/local/jakarta-tomcat-4.1.30/server/webapps/manager" debug="0" privileged="true"/>
<Logger className="org.apache.catalina.logger.FileLogger" directory="/home/username/logs"
prefix="context_log." suffix=".log" timestamp="true"/>
</Host>
</Engine>
</Service>
</Server>

When I surf to zichtbc.exonet.nl, I just see the default page for that ip. That means that this virtualhost (?) doesn't work.

What did I do wrong? Or, what can be wrong?
 

nebukazar

Verified User
Joined
Sep 28, 2003
Messages
130
hi,

Context path="" docBase="/home/zichtbc/public_html/" debug="0"/

Try to remove the "/" at the end of public_html.

Does the public_html directory exist ?
Did you created a JSP file to test it out ?

regards,
 

jep

Verified User
Joined
Nov 12, 2003
Messages
79
As you can see, http://zichtbc.exonet.nl/ still goes to my default host/ip. It doesn't work as an virtualhost.

I've removed the trailing slash..

This is my include in httpd.conf:

# JK!!
Loadmodule jk_module /usr/lib/apache/mod_jk.so
AddModule mod_jk.c
Include "/usr/local/jakarta-tomcat-4.1.30/conf/mod_jk.conf"

And this is that mod_jk.conf:

<IfModule !mod_jk.c>
LoadModule jk_module /usr/lib/apache/mod_jk.so
</IfModule>

JkWorkersFile "/usr/local/jakarta-tomcat-4.1.30/conf/jk/workers.properties"
JkLogFile "/usr/local/jakarta-tomcat-4.1.30/logs/mod_jk.log"

JkMount /*.jsp ajp13
JkMount /servlet/* ajp13
JkMount /servlets/* ajp13
JkMount /*.do ajp13
JkMount /manager/* ajp13
JkLogLevel emerg

What can be wrong? :)
 

jep

Verified User
Joined
Nov 12, 2003
Messages
79
P.s mod_jk.log is not there, and .jsp does nothing. It seems what apache doesn't do much with the tomcat include. However, the file is correctly included.
 

magaf

Verified User
Joined
Jul 20, 2004
Messages
54
Location
PL
question

does anyone has managed to run tomcat 5 and mod_jk on da machine ?:)
 

nebukazar

Verified User
Joined
Sep 28, 2003
Messages
130
Hi,

I didn't tried to install tomcat5 yet, but it shouldn't be too difficult to install it since it uses the same backend.
 

nebukazar

Verified User
Joined
Sep 28, 2003
Messages
130
hi,

make sure you created the tomcat user.

If it doesn't work, pm me and I will take a look at it.
 

itman21

Verified User
Joined
Jan 3, 2004
Messages
24
Location
Korea
Hello, Many thanks for the time

This is the thing I would like to share...

SITUATION root@server bin]# ./startup.sh
The JAVA_HOME environment variable is not defined
This environment variable is needed to run this program

SOLUTION : open /usr/local/tomcat/bin/catalina.sh and make it look like below. Bold is the added one. This is in addition to /etc/profile insertion.

# $Id: catalina.sh,v 1.35 2003/05/08 08:19:58 jfclere Exp $
# -----------------------------------------------------------------------------

JAVA_HOME=/usr/local/java/java

# OS specific support. $var _must_ be set to either true or false.
cygwin=false
os400=false
case "`uname`" in
CYGWIN*) cygwin=true;;
OS400*) os400=true;;


Now, all in good shape :)
 
Last edited:

nebukazar

Verified User
Joined
Sep 28, 2003
Messages
130
bublers said:
tomcatd -Xmx256m -Xms128m
will this do the trick ?
Unfortunately, it will not work. You have to edit the startup script so it can use the $JAVA_OPTS var with the specified value.

As for tomcat under freeBSD, I didn't had the chance to give it a try. However, I think some DA users were able to compile tomcat with some tweaks.
 
Last edited:

Chrysalis

Verified User
Joined
Aug 25, 2004
Messages
1,584
Location
uk
I posted the changes for getting this to work on FreeBSD it is possible to do. Read the whole thread.
 

noose

Verified User
Joined
Jun 28, 2004
Messages
39
Location
Gdynia [Poland]
Hi !
I just install the tomact with your patches ;)
But I have problems with start :(

sserver# cat /usr/sbin/tomcatd
#!/usr/local/bin/bash
#
# Startup script for Tomcat
#
# chkconfig: 345 84 16
# description: Tomcat jakarta JSP server



TOMCAT_HOME=/usr/local/tomcat
TOMCAT_START=$TOMCAT_HOME/bin/startup.sh
TOMCAT_STOP=$TOMCAT_HOME/bin/shutdown.sh

#Necessary environment variables
export JAVA_HOME="/usr/local/java/java"
export CATALINA_HOME="/usr/local/tomcat"
#export LD_KERNEL_ASSUME="2.2.5"

# Source function library.
. /usr/local/etc/rc.d/functions

# Source networking configuration.
. /etc/networks ## THAT ISN'T CORRECT PATH :(

# Check that networking is up.
[ ${NETWORKING} = "no" ] && exit 0

#Check for tomcat script
if [ ! -f $TOMCAT_HOME/bin/catalina.sh ]
then
echo "Tomcat not available..."
exit
fi

start() {
echo -n "Starting Tomcat: "
$TOMCAT_START
echo
touch /var/lock/subsys/tomcatd
# We may need to sleep here so it will be up for apache
sleep 3
#Instead should check to see if apache is up by looking for httpd.pid
}

stop() {
echo -n $"Shutting down Tomcat: "
su - tomcat -c $TOMCAT_STOP
rm -f /var/lock/subsys/tomcatd
echo
}

status() {
ps ax --width=1000 | grep "[o]rg.apache.catalina.startup.Bootstrap start" | awk '{printf $1 " "}' | wc | awk '{print $2}' > /tmp/tomcat_process_count.txt
read line < /tmp/tomcat_process_count.txt
if [ $line -gt 0 ]; then
echo -n "tomcatd ( pid "
ps ax --width=1000 | grep "[o]rg.apache.catalina.startup.Bootstrap start" | awk '{printf $1 " "}'
echo -n ") is running..."
echo
else
echo "Tomcat is stopped"
fi
}

case "$1" in
start)
start
;;
stop)
stop
;;
restart)
stop
sleep 3
start
;;
status)
status
;;
*)
echo "Usage: tomcatd {start|stop|restart|status}"
exit 1
esac
touch: /var/lock/subsys/tomcatd: No such file or directory
server# mkdir /var/lock
server# mkdir /var/lock/subsys
server# mkdir /var/lock/subsys/tomcatd
server# tomcatd start
/usr/sbin/tomcatd: line 6: your-net: command not found
/usr/sbin/tomcatd: line 7: your-netmask: command not found
/usr/sbin/tomcatd: line 12: subnet1: command not found
/usr/sbin/tomcatd: line 13: subnet2: command not found
/usr/sbin/tomcatd: line 26: [: =: unary operator expected
Starting Tomcat: The JAVA_HOME environment variable is not defined correctly
This environment variable is needed to run this program
In catalina.sh I wrote JAVA_HOME=....
:(
Please... HELP !

system:
FreeBSD 4.10-RELEASE-p5
 
Last edited:

webquarry

Verified User
Joined
Mar 19, 2004
Messages
177
did the install and apache won't start now.

Starting httpd: Syntax error on line 72 of /etc/httpd/conf/httpd.conf:
Cannot load /usr/lib/apache/mod_jk.so into server: /usr/lib/apache/mod_jk.so: undefined symbol: stricmp

Any ideas anyone?
 

tklaver

Verified User
Joined
Dec 25, 2004
Messages
9
gcc -I/usr/include/apache -g -O2 -DLINUX=22 -DHAVE_SET_DUMPABLE -I/usr/include/gdbm -DMOD_SSL=208122 -DUSE_HSREGEX -DEAPI -DJK_PREFORK -g -O2 -I /include -I /include/ -c jk_connect.c -fPIC -DPIC -o .libs/jk_connect.o
jk_connect.c: In function `jk_shutdown_socket':
jk_connect.c:485: error: `SD_SEND' undeclared (first use in this function)
jk_connect.c:485: error: (Each undeclared identifier is reported only once
jk_connect.c:485: error: for each function it appears in.)
gmake[1]: *** [jk_connect.lo] Error 1
gmake[1]: Leaving directory `/usr/local/java/jakarta-tomcat-connectors/jk/native/common'
gmake: *** [all-recursive] Error 1
what can be wrong?
 
Top