Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 18279 - several problems with tomcat 4.1.24 during install and during running
Summary: several problems with tomcat 4.1.24 during install and during running
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: x86 Linux
: High normal (vote)
Assignee: Dylan Carlson (RETIRED)
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: 18352
  Show dependency tree
 
Reported: 2003-03-26 22:54 UTC by Clemens Schwaighofer
Modified: 2003-04-15 16:18 UTC (History)
1 user (show)

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


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Clemens Schwaighofer 2003-03-26 22:54:34 UTC
after first install ebuild didn't create a tomcat user and group. But I think
that has bin fixed already.

Anyway, I had already tomcat running with logs in /var/log/tomcat (from previus
ebuild), but due the user change, after restart tomcat couldn't write to this
directory & files. I had to change th user/group to tomcat. This should be done
with the ebuild.

Thought the whole user running thing is buggy, when I start tomcat with the
init.d script and the java's are running as tomcat I can't connect to
localhost:8080.

when I start it with /opt/tomcat/catalina.sh start (or startup.sh) I can connect.

[thought in both there is no 8080 listener visible with lsof until I connect]

furthermore the JAVA_HOME is not set with the bash command, because in my case
the JAVA_HOME is either not set or set but couldn't be read. so I had to set it
manually.

second problem is with shutdown.

when I start with init.d script and I do stop I get this error:

Catalina.stop: java.net.ConnectException: Connection refused
java.net.ConnectException: Connection refused
        at java.net.PlainSocketImpl.socketConnect(Native Method)
        at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:305)
        at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:171)
        at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:158)
        at java.net.Socket.connect(Socket.java:426)
        at java.net.Socket.connect(Socket.java:376)
        at java.net.Socket.<init>(Socket.java:291)
        at java.net.Socket.<init>(Socket.java:119)
        at org.apache.catalina.startup.Catalina.stop(Catalina.java:581)
        at org.apache.catalina.startup.Catalina.execute(Catalina.java:402)
        at org.apache.catalina.startup.Catalina.process(Catalina.java:180)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:324)
        at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:203

same error I get when I start with catalina.sh from /opt/tomcat/bin and without
connecting to the server stop it.

Thought this is an tomcat problem, as I get the same error on my RedHat Box too
(binary tomcat with Sun Java 1.4.1)

Reproducible: Always
Steps to Reproduce:
1. upgrade/install tomcat 4.1.24
2. try to 'lynx localhost:8080'
3.

Actual Results:  
could not conenct to server

Expected Results:  
index.jsp should appear

Portage 2.0.47-r10 (default-x86-1.4, gcc-3.2.2, glibc-2.3.2-r0)
=================================================================
System uname: 2.4.20-gentoo-r1 i686 Intel(R) Pentium(R) 4 CPU 1.60GHz
GENTOO_MIRRORS="http://gentoo.oregonstate.edu/ http://distro.ibiblio.org/pub/Lin
ux/distributions/gentoo"
CONFIG_PROTECT="/etc /var/qmail/control /usr/kde/2/share/config /usr/kde/3/share
/config /usr/X11R6/lib/X11/xkb /usr/kde/3.1/share/config /usr/share/config"
CONFIG_PROTECT_MASK="/etc/gconf /etc/env.d"
PORTDIR="/usr/portage"
DISTDIR="/usr/portage/distfiles"
PKGDIR="/usr/portage/packages"
PORTAGE_TMPDIR="/var/tmp"
PORTDIR_OVERLAY=""
USE="oss 3dnow apm avi cups encode mikmod mpeg pdflib quicktime xmms xv gdbm svg
a guile sdl esd oggvorbis gnome qt motif opengl mozilla pic ungif apache2 berkdb
 canna cjk crypt ethereal gd gif gpm freewnn ipv6 imap imlib innodb java jpeg ke
rberos ldap libg++ libwww mmx nls ncurses pam png readline perl python ruby sasl
 ssl samba slang snmp sse spell tiff truetype wmf tcpd zlib x86 mysql postgres m
aildir mbox xml xml2 X arts kde gtk gtk2 doc"
COMPILER="gcc3"
CHOST="i686-pc-linux-gnu"
CFLAGS="-march=pentium4 -O3 -pipe -DHAVE_ERRNO_AS_DEFINE=1"
CXXFLAGS="-march=pentium4 -O3 -pipe -DHAVE_ERRNO_AS_DEFINE=1"
ACCEPT_KEYWORDS="x86 ~x86"
MAKEOPTS="-j2"
AUTOCLEAN="yes"
SYNC="rsync://rsync.gentoo.org/gentoo-portage"
FEATURES="sandbox ccache"
Comment 1 Tony Murray 2003-03-28 00:22:34 UTC
The java home path variable should use /bin/sed , not just sed...

When you get that java error when trying to stop tomcat (connection refused) that   means that it never actually started...

/etc/init.d/tomcat from the command line usually works for me, but almost never on startup...

The problems you are having aren't from being run as not root, but from problems with the init script, which still needs some polishing obviously...
Comment 2 Dylan Carlson (RETIRED) gentoo-dev 2003-03-28 02:38:04 UTC

1) Clemens:

4.1.24 differs from previous versions in that, yes, it does run as a user now.  This is a good thing.  But the ebuild will not touch your existing files that ran in /opt/jakarta/tomcat.  Users (you) will have to move them and repermission them manually.  Ebuilds do not, as a practice, touch user files... 

For users who are installing Tomcat for the first time, this works fine.  I'll say it again so it's clear -- Ebuilds will never touch user files or permissions.

As for your JAVA_HOME problem, you need to run 'java-config' and make sure your system environment is configured right with that tool.  See the Gentoo Java Guide for help.  http://www.gentoo.org/doc/en/java.xml

Regarding your connection errors -- sounds like you have hosed your system.  I suggest 
 - back up your /opt/tomcat directory if you need to
 - unmerge tomcat
 - # rm -rf /opt/tomcat
 - remerge tomcat 4.1.24

I've tested this across approximately 50 systems in two production environments so... it should work for you.  If it doesn't please report back and we'll take it from there.

2) I have put in Tony's init "fix" though I doubt this would have caused problems with anyone.
Comment 3 Clemens Schwaighofer 2003-03-28 06:32:13 UTC
Well thanks for your help. The JAVA_HOME problem was pure my fault, I didn't search and read the Java documentation.

removing the /opt/tomcat dir did help. I before just unmerged tomcat. So it rewrote the file permissions, but I think there was still something left, with wrong permissions.
Comment 4 Dylan Carlson (RETIRED) gentoo-dev 2003-03-28 16:24:04 UTC
No problem.  Things to check:  

1.  /var/log/tomcat permissions 
    (just do 'chown -R tomcat.tomcat /var/log/tomcat)

2.  Make sure you don't have config/init files that need to be updated.
    (look for ._cfgXXXX_tomcat in /etc/conf.d and /etc/init.d, or just
    'etc-update')

3.  Make sure you don't already have something running on port 8080.
    Many other servlet engines (Orion for example) also default to 8080.

Last but not least, I have not done testing with Tomcat on anything but the Sun JDKs... if you have done testing with Blackdown or IBM, there's a potential for problems there.  If you are using those JVMs please let me know so that I can note these problems in the ebuild.
Comment 5 Clemens Schwaighofer 2003-03-28 18:27:33 UTC
I checked 1 - 3, these where not the problems.

Anyway, I had a Tomcat 3 with blackdown Java running on a production machnie for now around one and a half years without any problems.

I will do tests with tomcat 4 & blackdown (I also have an installation with suns JDK) and see if there are any troubles.
Comment 6 Ed O'Loughlin 2003-04-15 06:44:12 UTC
I've just emerged 4.1.24 and can't start it. 
I've got JAVA_HOME set. If I run /bin/grep -e "JAVA_HOME" /etc/profile.env | 
/bin/sed -e "s/^.*'\(.*\)'$/\1/" (from /etc/conf.d/tomcat) then I get 
 
  /opt/blackdown-jre-1.3.1 
 
If I try /etc/init.d/tomcat start, I get: 
 
  The JAVA_HOME environment variable is not defined correctly! 
  This environment variable is needed to run this program. 
  See the /etc/conf.d/tomcat file for details. 
 
I've tried explicitly setting JAVA_HOME in /etc/conf.d/tomcat to no avail. 
Comment 7 Clemens Schwaighofer 2003-04-15 07:52:21 UTC
did u do the java-config stuff mentioned above?
Comment 8 Dylan Carlson (RETIRED) gentoo-dev 2003-04-15 16:18:41 UTC
Ed:

You have a couple of issues, probably, but first and foremost, you need to use JDK instead.  Servlet engines need to compile.  

As indicated in the Tomcat RUNNING.txt docs, you need to use JDK 1.2 or later.  I suggest sticking to the Sun JDK for maximum predictability since it is the reference VM, but do let me know if you have problems with the others (Blackdown, IBM, et al).

Secondarily, your java environment is probably not set correctly.  Please read the Gentoo Java Guide to make sure you are setting up your environment correctly.

http://www.gentoo.org/doc/en/java.xml

I'm closing out this bug, as it should have been closed out.  Ed, please open a new bug if you need further assistance after following my suggestions.

Cheers