Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 103925 - A fresh Tomcat 5.0.28-r4 doesn't work and the /etc/init.d/tomcat-5 script seems to be broken.
Summary: A fresh Tomcat 5.0.28-r4 doesn't work and the /etc/init.d/tomcat-5 script see...
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Server (show other bugs)
Hardware: All Linux
: High critical (vote)
Assignee: Java team
URL:
Whiteboard:
Keywords:
: 88002 106788 (view as bug list)
Depends on:
Blocks:
 
Reported: 2005-08-27 08:56 UTC by Andreas Schäfer
Modified: 2005-09-21 17:05 UTC (History)
5 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
Log of the installation/start trials (bugreport.txt,5.40 KB, text/plain)
2005-08-27 08:59 UTC, Andreas Schäfer
Details
When I apply this patch to the init script, it works pretty fine (patch_etc_init.d_tomcat-5,502 bytes, patch)
2005-08-27 09:01 UTC, Andreas Schäfer
Details | Diff
I neet to set the log4j config in /etc/conf.d/tomcat-5 (tomcat-5,2.63 KB, text/plain)
2005-08-27 09:06 UTC, Andreas Schäfer
Details
diff of /etc/init.d/tomcat-5 to use /sbin/start-stop-daemon (init.d_tomcat-5.diff,670 bytes, patch)
2005-09-12 17:30 UTC, Martin von Gagern
Details | Diff
fix for the 5.0.28-r5 ebuild making it install the log4j properties (tomcat-ebuild-fix,150 bytes, patch)
2005-09-16 07:24 UTC, f5d8fd51ed1e804c9e8d0357e8614e0493b06e96
Details | Diff
fix for 5.0.28-r5 (diff,909 bytes, patch)
2005-09-16 11:40 UTC, Gustavo Felisberto (RETIRED)
Details | Diff
${FILESDIR}/${PV}/tomcat.init (tomcat-5,741 bytes, text/plain)
2005-09-21 11:24 UTC, Martin Nowack
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Andreas Schäfer 2005-08-27 08:56:00 UTC
After emerging Tomcat, the init.d script didn't start the server.  There seem to
be two errors:

1. start-stop-daemon can't start the catalina.sh script properly.

2. The config file for log4j is not specified in /etc/conf.d/tomcat, thus
leading to the unlimited output of:

log4j:WARN No appenders could be found for logger
(org.apache.commons.digester.Digester.sax).
log4j:WARN Please initialize the log4j system properly.



Reproducible: Always
Steps to Reproduce:
1. emerge tomcat
2. set CATALINA_OPTS="-Dlog4j.configuration=file:/etc/log4j.properties" in
/etc/conf.d/tomcat-5
3. /etc/init.d/tomcat-5 start

Actual Results:  
Tomcat did'n start, the init.d stript did not terminate, http://127.0.0.1:8080
was not available.

Expected Results:  
Tomcat should produce a fine page at http://127.0.0.1:8080

I can get round of this trouble by setting the log4j config in
/etc/conf.d/tomcat-5 (a hint after emergin Tomcat to do this would have been
realy very nice) and patching the /etc/init.d/tomcat-5 script. I'll attach all
the modified files as well as a complete log file of my hacking.

Thanks for the attention!
Comment 1 Andreas Schäfer 2005-08-27 08:59:26 UTC
Created attachment 66982 [details]
Log of the installation/start trials
Comment 2 Andreas Schäfer 2005-08-27 09:01:37 UTC
Created attachment 66983 [details, diff]
When I apply this patch to the init script, it works pretty fine
Comment 3 Andreas Schäfer 2005-08-27 09:06:27 UTC
Created attachment 66984 [details]
I neet to set the log4j config  in /etc/conf.d/tomcat-5
Comment 4 Myles Goodwin 2005-09-09 16:58:13 UTC
This is very strange.  I had to use your fix on tomcat-5.0.27-r6 and
tomcat-5.0.28-r4 on my centrino notebook in order to get it to work, yet I
didn't have a single problem on my Athlon-XP box when I tried tomcat-5.0.27-r6.
Comment 5 Martin von Gagern 2005-09-12 17:30:56 UTC
Created attachment 68315 [details, diff]
diff of /etc/init.d/tomcat-5 to use /sbin/start-stop-daemon

OK, using a lot of strace, equery and grep, I think I solved this mystery. The
bad boy is /lib/rcscripts/sh/rc-daemon.sh. There start-stop-daemon is redefined
as a shell function, and does some additional work. Especially it checks if the
daemon is really started (using some pid file, which is not the tomcat way as
far as I know), and calls stop if this is not the case.

I changed my /etc/init.d/tomcat-5 to explicitly use /sbin/start-stop-daemon.
This allows me to make use of the chuid feature which was a problem with
attachment #66983 [details, diff] from comment #2.
Comment 6 Gustavo Felisberto (RETIRED) gentoo-dev 2005-09-14 15:03:28 UTC
*** Bug 88002 has been marked as a duplicate of this bug. ***
Comment 7 Gustavo Felisberto (RETIRED) gentoo-dev 2005-09-14 15:07:53 UTC
I commited tomcat-5.0.28-r5.ebuild to portage. That revision is masked untill
people report here.

In that revision (and also -r4) proper configuration is added to
/etc/conf.d/tomcat-5 and /etc/init.d/tomcat-5 as changed. Revision 5 gains a
/etc/tomcat-5/log4j.properties so that no errors are sent to the logs about not
finding the file.
Comment 8 f5d8fd51ed1e804c9e8d0357e8614e0493b06e96 2005-09-16 06:57:24 UTC
I unmasked and tested the -r5 ebuild - and it won't work for me.
Seems like it has been forgotten to install the included log4j.properties.

therion aaron # /etc/init.d/tomcat-5 start
 * Caching service dependencies ...                                            
                                   [ ok ]
 * Starting Tomcat ...
Using CATALINA_BASE:   /var/lib/tomcat-5/default
Using CATALINA_HOME:   /usr/share/tomcat-5
Using CATALINA_TMPDIR: /var/tmp/tomcat-5/default
Using JAVA_HOME:       /opt/sun-jdk-1.5.0.04
log4j:ERROR Could not read configuration file from URL
[file:/etc/tomcat-5/log4j.properties].
java.io.FileNotFoundException: /etc/tomcat-5/log4j.properties (No such file or
directory)
        at java.io.FileInputStream.open(Native Method)
        at java.io.FileInputStream.<init>(FileInputStream.java:106)
        at java.io.FileInputStream.<init>(FileInputStream.java:66)
Comment 9 f5d8fd51ed1e804c9e8d0357e8614e0493b06e96 2005-09-16 07:13:00 UTC
also I've noted the following line during the build:

>>> Install tomcat-5.0.28-r5 into /var/tmp/portage/tomcat-5.0.28-r5/image/
category www-servers
cp: target `/var/tmp/portage/tomcat-5.0.28-r5/image//etc/tomcat-5/' is not a
directory: No such file or directory
man:
Comment 10 f5d8fd51ed1e804c9e8d0357e8614e0493b06e96 2005-09-16 07:24:23 UTC
Created attachment 68582 [details, diff]
fix for the 5.0.28-r5 ebuild making it install the log4j properties

seems better to copy the file AFTER the folder has been created dodir.
also if we have ${TOMCAT_NAME} we should use it when copying, too
Comment 11 f5d8fd51ed1e804c9e8d0357e8614e0493b06e96 2005-09-16 07:27:09 UTC
oh no - after my patch the file permissions are messed up.

therion tomcat # /etc/init.d/tomcat-5 start
 * Caching service dependencies ...                                            
                                   [ ok ]
 * Starting Tomcat ...
Using CATALINA_BASE:   /var/lib/tomcat-5/default
Using CATALINA_HOME:   /usr/share/tomcat-5
Using CATALINA_TMPDIR: /var/tmp/tomcat-5/default
Using JAVA_HOME:       /opt/sun-jdk-1.5.0.04
log4j:ERROR Could not read configuration file from URL
[file:/etc/tomcat-5/log4j.properties].
java.io.FileNotFoundException: /etc/tomcat-5/log4j.properties (Permission denied)
        at java.io.FileInputStream.open(Native Method)



...but at least the file now exists and someone smarter than me might finally
fix the ebuild
Comment 12 Gustavo Felisberto (RETIRED) gentoo-dev 2005-09-16 11:40:46 UTC
Created attachment 68601 [details, diff]
fix for 5.0.28-r5

The privious probably had a typo in the ${TOMACAT_NAME} :) I changed that, the
location and fixed the file to be owned by the tomcat user.
Comment 13 f5d8fd51ed1e804c9e8d0357e8614e0493b06e96 2005-09-18 13:29:37 UTC
Ok, I tested the latest version of the ebuild and things improve - but still
aren't perfect.
The problems with log4j are gone by now, but the init.d script seems to cause
some final problems. When I try to start up tomcat via tomcat-5 init.d script it
hangs forever - if I directly use catalina.sh start tomcat starts up just fine.

Adding a --background to the start-stop-daemon calls in the tomcat-5 init.d
script solved this last problem for me - now I can finally use my tomcat again.

Thx for all your efforts and hope that this final fix will solve the problems
for everyone else, too.
Comment 14 Petteri Räty (RETIRED) gentoo-dev 2005-09-20 11:01:45 UTC
Added --background to the installed init script. Please reopen if the problem
still exists.
Comment 15 f5d8fd51ed1e804c9e8d0357e8614e0493b06e96 2005-09-20 16:40:34 UTC
the --background isn't only needed on start, but also on stop (or else it hangs
on shutdown)
Comment 16 Jakub Moc (RETIRED) gentoo-dev 2005-09-21 06:32:23 UTC
*** Bug 106788 has been marked as a duplicate of this bug. ***
Comment 17 Martin Nowack 2005-09-21 11:24:00 UTC
Created attachment 68951 [details]
${FILESDIR}/${PV}/tomcat.init

the infos you gave worked perfectly for me too.

just attached the new init-script for help
Comment 18 Petteri Räty (RETIRED) gentoo-dev 2005-09-21 17:05:55 UTC
all the 5.0.28 revisions now have --background in stop too.