You are not logged in.

#1 2012-07-16 02:39:47

cferrell
Member
Registered: 2012-07-16
Posts: 4

Apache and Tomcat issue

First post, so bear with me.
Ok, so I've gotten Apache up and running and Tomcat up and running separately, but when I try to combine the two via mod_jk.so Apache craps out on command "sudo rc.d start httpd"

Specifically. This is the result:

Terminal wrote:

:: Starting Apache Web Server                                                                        [BUSY]
                           /usr/sbin/apachectl: line 84:  6406 Bus error               $HTTPD -k $ARGV       [FAIL]

Diving into the file in question

#!/bin/sh
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements.  See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License.  You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
#
# Apache control script designed to allow an easy command line interface
# to controlling Apache.  Written by Marc Slemko, 1997/08/23
# 
# The exit codes returned are:
#   XXX this doc is no longer correct now that the interesting
#   XXX functions are handled by httpd
#	0 - operation completed successfully
#	1 - 
#	2 - usage error
#	3 - httpd could not be started
#	4 - httpd could not be stopped
#	5 - httpd could not be started during a restart
#	6 - httpd could not be restarted during a restart
#	7 - httpd could not be restarted during a graceful restart
#	8 - configuration syntax error
#
# When multiple arguments are given, only the error from the _last_
# one is reported.  Run "apachectl help" for usage info
#
ARGV="$@"
#
# |||||||||||||||||||| START CONFIGURATION SECTION  ||||||||||||||||||||
# --------------------                              --------------------
# 
# the path to your httpd binary, including options if necessary
HTTPD='/usr/sbin/httpd'
#
# pick up any necessary environment variables
if test -f /usr/sbin/envvars; then
  . /usr/sbin/envvars
fi
#
# a command that outputs a formatted text version of the HTML at the
# url given on the command line.  Designed for lynx, however other
# programs may work.  
LYNX="lynx -dump"
#
# the URL to your server's mod_status status page.  If you do not
# have one, then status and fullstatus will not work.
STATUSURL="http://localhost:80/server-status"

# Source /etc/conf.d/apache for $HTTPD setting, etc.
if [ -r /etc/conf.d/apache ]; then
    . /etc/conf.d/apache
fi

#
# Set this variable to a command that increases the maximum
# number of file descriptors allowed per child process. This is
# critical for configurations that use many file descriptors,
# such as mass vhosting, or a multithreaded server.
ULIMIT_MAX_FILES="ulimit -S -n `ulimit -H -n`"
# --------------------                              --------------------
# ||||||||||||||||||||   END CONFIGURATION SECTION  ||||||||||||||||||||

# Set the maximum number of file descriptors allowed per child process.
if [ "x$ULIMIT_MAX_FILES" != "x" ] ; then
    $ULIMIT_MAX_FILES
fi

ERROR=0
if [ "x$ARGV" = "x" ] ; then 
    ARGV="-h"
fi

case $ARGV in
start|stop|restart|graceful|graceful-stop)
    $HTTPD -k $ARGV
    ERROR=$?
    ;;
startssl|sslstart|start-SSL)
    echo The startssl option is no longer supported.
    echo Please edit httpd.conf to include the SSL configuration settings
    echo and then use "apachectl start".
    ERROR=2
    ;;
configtest)
    $HTTPD -t
    ERROR=$?
    ;;
status)
    $LYNX $STATUSURL | awk ' /process$/ { print; exit } { print } '
    ;;
fullstatus)
    $LYNX $STATUSURL
    ;;
*)
    $HTTPD $ARGV
    ERROR=$?
esac

exit $ERROR

Since that's a little "heavy," here's line 84 and the surrounding code where the problem seems to be occurring. Specifically, line 84 is "case $ARGV in"

ERROR=0
if [ "x$ARGV" = "x" ] ; then 
    ARGV="-h"
fi

case $ARGV in
start|stop|restart|graceful|graceful-stop)
    $HTTPD -k $ARGV
    ERROR=$?
    ;;

Looked all over and couldn't find anything that looks to relate to this problem.

However, I believe that this **MAY** be a problem relating to Java, specifically $JAVA_HOME and $TOMCAT_JAVA_HOME. The guides read that the default $JAVA_HOME should point to /opt/java but I find that on my system it points by default to /usr/lib/jvm/java-7-openjdk

NOTE: this is true even if I remove openjdk and yaourt jre7 in its place, and the problem isn't solved.

Taking suggestions of various other guides I have tried to "export" $JAVA_HOME and $TOMCAT_JAVA_HOME via such files as /etc/profile.d/jdk.sh and /etc/profile.d/jdk.csh to /opt/java  such that command echo $JAVA_HOME and echo $TOMCAT_JAVA_HOME both point to /opt/java   Nothing changes, and there is no /opt/java

Been running arch for a few months now (with sporadic experimentation with linux over the past 5 years or so) so I don't really know how to go about fixing this, and I've tooled through the Tomcat and Apache Guide, the Tomcat Guide, and even the Java Guide, all to no avail. Additionally, I've tried fixes through other forums posts and adapting outside help such as this, this and even this. Haven't found anything that has fixed the problem, obviously.

Been at this for about 12 hours today, running through the guides about a dozen times over to negate the possibility of missing a crucial step apart from the above mentioned, so it's that which I believe is the problem.


Suggestions?

Last edited by cferrell (2012-07-16 03:36:28)

Offline

#2 2012-07-16 11:13:52

teekay
Member
Registered: 2011-10-26
Posts: 270

Re: Apache and Tomcat issue

How did you install mod_jk (AUR, upstream), and how did you configure Apache to use it (files edited, edits in detail)?

Offline

#3 2012-07-16 16:34:21

cferrell
Member
Registered: 2012-07-16
Posts: 4

Re: Apache and Tomcat issue

Upstream. The AUR package is out of date and won't install because the source link was 404.

Downloaded latest source tarball and configured following directions in the file to make the package. Copied mod_jk to /usr/lib/httpd/modules as instructed, and followed all the the instructions in Tomcat and Apache Guide to the letter.

edit: If I were to try the configuration method without mod_jk, is it important where I place the code in httpd.conf?

Specifically this code

ProxyPass / ajp://127.0.0.1:8009/APPNAME
ProxyPassReverse / ajp://127.0.0.1:8009/APPNAME

. Do I just throw it in wherever? Doesn't quite seem right.

Just to move back to a clean slate I removed mod_jk from the modules directory and eliminated its string of code in httpd.conf
Apache is running normally and so is Tomcat, just mod_jk isn't working.

edit: I THINK I fixed it. Not sure how though, but tomcat7 and Apache seem to be getting along now. Now, to get the program I'm trying to run to just work!

Last edited by cferrell (2012-07-17 19:25:31)

Offline

Board footer

Powered by FluxBB