Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 445118 - www-sever/tomcat - Can't start more than one Java daemon (e.g. Tomcat) concurrently.
Summary: www-sever/tomcat - Can't start more than one Java daemon (e.g. Tomcat) concur...
Status: RESOLVED INVALID
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Server (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Java team
URL:
Whiteboard:
Keywords: PATCH
Depends on:
Blocks:
 
Reported: 2012-11-28 22:09 UTC by Mark H. Wood
Modified: 2012-12-05 20:15 UTC (History)
1 user (show)

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


Attachments
Patch to tomcat runscript (tomcat.patch,1.73 KB, text/plain)
2012-11-28 22:09 UTC, Mark H. Wood
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Mark H. Wood 2012-11-28 22:09:45 UTC
Created attachment 330858 [details]
Patch to tomcat runscript

start-stop-daemon checks for duplicate processes and refuses to start if it thinks this daemon is already running.  Every Java-based daemon is running the java runtime so start-stop-daemon only allows one of them.

Tomcat at least can be fixed.  It's set up to be started by jsvc from commons-daemon.  I've attached a patch to /etc/init.d/tomcat-7 that got Tomcat working again.
Comment 1 Mark H. Wood 2012-11-28 22:13:36 UTC
Portage 2.1.11.31 (default/linux/amd64/10.0/server, gcc-4.5.4, glibc-2.15-r3, 3.4.9-gentoo x86_64)
=================================================================
System uname: Linux-3.4.9-gentoo-x86_64-Dual-Core_AMD_Opteron-tm-_Processor_2218-with-gentoo-2.1
Timestamp of tree: Tue, 27 Nov 2012 23:15:01 +0000
ld GNU ld (GNU Binutils) 2.22
app-shells/bash:          4.2_p37
dev-java/java-config:     2.1.11-r3
dev-lang/python:          2.7.3-r2, 3.1.5, 3.2.3
dev-util/cmake:           2.8.9
dev-util/pkgconfig:       0.27.1
sys-apps/baselayout:      2.1-r1
sys-apps/openrc:          0.11.5
sys-apps/sandbox:         2.5
sys-devel/autoconf:       2.13, 2.68
sys-devel/automake:       1.9.6-r3, 1.10.3, 1.11.6
sys-devel/binutils:       2.22-r1
sys-devel/gcc:            4.4.5, 4.5.4
sys-devel/gcc-config:     1.7.3
sys-devel/libtool:        2.4-r1
sys-devel/make:           3.82-r3
sys-kernel/linux-headers: 3.6 (virtual/os-headers)
sys-libs/glibc:           2.15-r3
Repositories: gentoo
ACCEPT_KEYWORDS="amd64"
ACCEPT_LICENSE="* -@EULA"
CBUILD="x86_64-pc-linux-gnu"
CFLAGS="-O2 -pipe -march=opteron"
CHOST="x86_64-pc-linux-gnu"
CONFIG_PROTECT="/etc /usr/share/gnupg/qualified.txt /var/lib/hsqldb"
CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/env.d /etc/env.d/java/ /etc/fonts/fonts.conf /etc/gconf /etc/gentoo-release /etc/php/apache2-php5.3/ext-active/ /etc/php/apache2-php5.4/ext-active/ /etc/php/cgi-php5.3/ext-active/ /etc/php/cgi-php5.4/ext-active/ /etc/php/cli-php5.3/ext-active/ /etc/php/cli-php5.4/ext-active/ /etc/revdep-rebuild /etc/sandbox.d /etc/terminfo"
CXXFLAGS="-O2 -pipe -march=opteron"
DISTDIR="/usr/portage/distfiles"
FCFLAGS="-O2 -pipe"
FEATURES="assume-digests binpkg-logs config-protect-if-modified distlocks ebuild-locks fixlafiles merge-sync news parallel-fetch protect-owned sandbox sfperms strict unknown-features-warn unmerge-logs unmerge-orphans userfetch xattr"
FFLAGS="-O2 -pipe"
GENTOO_MIRRORS="ftp://ftp.ussg.iu.edu/pub/linux/gentoo http://csociety-ftp.ecn.purdue.edu/pub/gentoo/ http://distfiles.gentoo.org/ http://distro.ibiblio.org/pub/linux/distributions/gentoo"
LANG="en_US.UTF-8"
LDFLAGS="-Wl,-O1 -Wl,--as-needed"
MAKEOPTS="-j5"
PKGDIR="/usr/portage/packages"
PORTAGE_CONFIGROOT="/"
PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --compress --force --whole-file --delete --stats --human-readable --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages"
PORTAGE_TMPDIR="/var/tmp"
PORTDIR="/usr/portage"
PORTDIR_OVERLAY=""
SYNC="rsync://rsync.namerica.gentoo.org/gentoo-portage"
USE="3dnow acl amd64 apache2 berkdb bzip2 cjk cli cracklib crypt cups cxx dri fortran gd gdbm hal iconv ipv6 java6 ldap mmx modules mudflap multilib ncurses nptl nsplugin openmp pam pcre png postgres pppd readline sasl session snmp sse sse2 ssl svg tcpd truetype unicode xattr xml zlib" ALSA_CARDS="ali5451 als4000 atiixp atiixp-modem bt87x ca0106 cmipci emu10k1x ens1370 ens1371 es1938 es1968 fm801 hda-intel intel8x0 intel8x0m maestro3 trident usb-audio via82xx via82xx-modem ymfpci" ALSA_PCM_PLUGINS="adpcm alaw asym copy dmix dshare dsnoop empty extplug file hooks iec958 ioplug ladspa lfloat linear meter mmap_emul mulaw multi null plug rate route share shm softvol" APACHE2_MODULES="actions cgi alias auth_basic auth_digest authn_anon authn_dbd authn_dbm authn_default authn_file authz_dbm authz_default authz_groupfile authz_host authz_owner authz_user autoindex cache dav dav_fs dav_lock dbd deflate dir disk_cache env expires ext_filter file_cache filter headers ident imagemap include info log_config logio mem_cache mime mime_magic negotiation proxy proxy_ajp proxy_balancer proxy_connect proxy_http rewrite setenvif so speling status unique_id userdir usertrack vhost_alias" APACHE2_MPMS="prefork" CALLIGRA_FEATURES="kexi words flow plan sheets stage tables krita karbon braindump" CAMERAS="ptp2" COLLECTD_PLUGINS="df interface irq load memory rrdtool swap syslog" ELIBC="glibc" GPSD_PROTOCOLS="ashtech aivdm earthmate evermore fv18 garmin garmintxt gpsclock itrax mtk3301 nmea ntrip navcom oceanserver oldstyle oncore rtcm104v2 rtcm104v3 sirf superstar2 timing tsip tripmate tnt ubx" INPUT_DEVICES="keyboard mouse evdev" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LIBREOFFICE_EXTENSIONS="presenter-console presenter-minimizer" NETBEANS_MODULES="apisupport enterprise groovy harness ide java nb php profiler websvccommon" PHP_TARGETS="php5-3" PYTHON_SINGLE_TARGET="python2_7" PYTHON_TARGETS="python2_7 python3_2" RUBY_TARGETS="ruby18 ruby19" USERLAND="GNU" VIDEO_CARDS="radeon vesa fbdev" XTABLES_ADDONS="quota2 psd pknock lscan length2 ipv4options ipset ipp2p iface geoip fuzzy condition tee tarpit sysrq steal rawnat logmark ipmark dhcpmac delude chaos account"
Unset:  CPPFLAGS, CTARGET, EMERGE_DEFAULT_OPTS, INSTALL_MASK, LC_ALL, LINGUAS, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS, USE_PYTHON
Comment 2 Mark H. Wood 2012-11-29 16:49:39 UTC
I forgot to mention something important:  jsvc also had problems until I added a symlink /lib/libcap.so -> /lib/libcap.so.2

jsvc tries to load libcap.so at runtime and this doesn't play well with Gentoo's linker scripts in /usr/lib.  See https://issues.apache.org/jira/browse/DAEMON-242 for what they are doing.  Apparently there are products that want to ship with precompiled jsvc (which wouldn't have been my choice).

So my patch doesn't work without this one other change.  Sorry.

I'm not sure how to proceed to a complete fix.  I think that jsvc should be built on the machine where it's used instead of playing weird dynaloading games, but then, as a Gentoo user, of course I would.  And I understand that there are changes coming in the way / and /usr are organized, which might affect the choice of solution.
Comment 3 Ralph Sennhauser (RETIRED) gentoo-dev 2012-12-05 20:15:56 UTC
Looking at the patch you are using an older init script. Don't know what exactly went wrong, you use the same pidfile for both instances, you are using the same port or whatever else. Running multiple instances with start-stop-daemon is known to work for at least some of us.

As for running on low ports wltjr suggest in bug 75224 comment 31 wltjr to use a firewall for it.

Closing as invalid as it appears to be a user mistake. If you need help or have questions you can join #gentoo-java on freenode ( be warned, patience may be needed ) or read https://wiki.gentoo.org/wiki/Apache_Tomcat as a starter.

Please reopen if I misunderstood.