Gerwin created TOMEE-1508:
-----------------------------
Summary: daemon.sh doesn't include setclasspath.sh causing that
web-fragment.xml is not loaded
Key: TOMEE-1508
URL: https://issues.apache.org/jira/browse/TOMEE-1508
Project: TomEE
Issue Type: Bug
Affects Versions: 1.7.1
Environment: Unix
Reporter: Gerwin
*Steps to reproduce*
# Install and [configure TomEE as a
daemon|http://tomee.apache.org/unix-daemon.html]
#* use jsvc
#* use CATALINA_HOME/bin/daemon.sh
# In the webapps directory, create a directory 'showbug'
# In the showbug directory, create a htm file:
{code:xml|title=CATALINA_HOME/webapps/showbug/web-fragment.htm}
<html>
<body>
<h1>Hello from web-fragment.htm</h1>
</body>
</html>
{code}
# In the showbug directory, create a directory 'WEB-INF'
# In the WEB-INF directory, create a directory 'lib'
# In the lib direcotory, place a jar file with the following contents:
{code:none|title=CATALINA_HOME/webapps/showbug/WEB-INF/lib/showbug.jar}
META-INF/web-fragment.xml
{code}
{code:xml|title=CATALINA_HOME/webapps/showbug/WEB-INF/lib/showbug.jar/META-INF/web-fragment.xml}
<?xml version="1.0" encoding="UTF-8"?>
<web-fragment version="3.0" xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/web-fragment_3_0.xsd">
<welcome-file-list>
<welcome-file>web-fragment.htm</welcome-file>
</welcome-file-list>
</web-fragment>
{code}
# Start the daemon
{code}
CATALINA_HOME/bin/daemon.sh start
{code}
# Open the showbug webapp http://localhost:8080/showbug/
*Expected result*
The browser show the web-fragment.htm webpage.
*Actual result*
The browser shows a 404 NOT FOUND
*Analysis*
I did a diff between {{daemon.sh}} and {{catalina.sh}} and observed some
differences.
* {{catalina.sh}} calls {{setclasspath.sh}}, but {{daemon.sh}} doesn't
* {{catalina.sh}} sets {{openejb-javaagent}}, but {{daemon.sh}} doesn't
*Proposal*
{code:none|title=daemon.patch}
--- daemon.sh vr jul 18 18:39:38 2014
+++ daemon.sh do feb 5 15:42:22 2015
@@ -124,6 +124,15 @@ elif [ -r "$CATALINA_HOME/bin/setenv.sh" ]; then
. "$CATALINA_HOME/bin/setenv.sh"
fi
+# Get standard Java environment variables
+if [ -r "$CATALINA_HOME"/bin/setclasspath.sh ]; then
+ . "$CATALINA_HOME"/bin/setclasspath.sh
+else
+ echo "Cannot find $CATALINA_HOME/bin/setclasspath.sh"
+ echo "This file is needed to run this program"
+ exit 1
+fi
+
# Add on extra jar files to CLASSPATH
test ".$CLASSPATH" != . && CLASSPATH="${CLASSPATH}:"
CLASSPATH="$CLASSPATH$CATALINA_HOME/bin/bootstrap.jar:$CATALINA_HOME/bin/commons-daemon.jar"
@@ -151,6 +160,11 @@ fi
test ".$LOGGING_MANAGER" = . &&
LOGGING_MANAGER="-Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager"
JAVA_OPTS="$JAVA_OPTS $LOGGING_MANAGER"
+# Add OpenEJB javaagent
+if [ -r "$CATALINA_HOME"/lib/openejb-javaagent.jar ]; then
+ JAVA_OPTS=""-javaagent:$CATALINA_HOME/lib/openejb-javaagent.jar" $JAVA_OPTS"
+fi
+
# Set -pidfile
test ".$CATALINA_PID" = . &&
CATALINA_PID="$CATALINA_BASE/logs/catalina-daemon.pid"
{code}
*Disclamer*
I did not test on AS400 or other special unix variants
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)