Bug 690957 - EWS Tomcat installed from RPM shutdown fails.
Summary: EWS Tomcat installed from RPM shutdown fails.
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: JBoss Enterprise Web Server 2
Classification: JBoss
Component: JON Plugin
Version: 2.0.1
Hardware: Unspecified
OS: Unspecified
high
high
Target Milestone: ER04
: ---
Assignee: Jean-frederic Clere
QA Contact: Libor Fuka
URL:
Whiteboard:
Depends On:
Blocks: ews1.0.2 jon30-sprint9 jon3 1111666 1122005
TreeView+ depends on / blocked
 
Reported: 2011-03-25 23:20 UTC by Ondřej Žižka
Modified: 2014-08-21 21:40 UTC (History)
13 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Previously in JBoss Enterprise Web Server, when installing Tomcat using RPMs and managing it via JBoss Operation Network, Tomcat could not be shut down. This was because the JBoss Operation Network Tomcat plugin did not work as expected with the RPM-based Tomcat installation. The JBoss Operation Network Tomcat plugin is fixed in JBoss Enterprise Web Server 2.1.
Clone Of:
: 1122005 (view as bug list)
Environment:
Last Closed: 2014-08-21 21:40:05 UTC
Type: ---
Embargoed:


Attachments (Terms of Use)

Description Ondřej Žižka 2011-03-25 23:20:57 UTC
java.lang.RuntimeException: Server failed to shutdown
        at org.jboss.on.plugins.tomcat.TomcatServerOperationsDelegate.shutdown(TomcatServerOperationsDelegate.java:281)
        at org.jboss.on.plugins.tomcat.TomcatServerOperationsDelegate.shutdown(TomcatServerOperationsDelegate.java:274)
        at org.jboss.on.plugins.tomcat.TomcatServerOperationsDelegate.invoke(TomcatServerOperationsDelegate.java:128)
        at org.jboss.on.plugins.tomcat.TomcatServerComponent.invokeOperation(TomcatServerComponent.java:424)
        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:597)
        at org.rhq.core.pc.inventory.ResourceContainer$ComponentInvocationThread.call(ResourceContainer.java:525)
        at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
        at java.util.concurrent.FutureTask.run(FutureTask.java:138)
        at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
        at java.lang.Thread.run(Thread.java:662)

Comment 1 Ondřej Žižka 2011-03-25 23:28:58 UTC
STR:

1) Install Tomcat on RHEL 6 from RPM, inventorize.
   Follow https://docspace.corp.redhat.com/docs/DOC-61584
2) Configure JMX
   Follow https://docspace.corp.redhat.com/docs/DOC-60338  6) + 7)
3) Invoke Tomcat's Shutdown operation. It will fail with the exception above.

To save you opening Docspace, the config I used is this:


Manager URL  =    service:jmx:rmi:///jndi/rmi://localhost:<PORT>/jmxrmi    (same as normal)

Control Method =  RPM System V init script
Start Script    = /usr/sbin/tomcat6
Shutdown Script = /usr/sbin/tomcat6

Comment 3 Lukas Krejci 2011-11-23 13:49:37 UTC
confirmed. This is because the plugin cannot figure out the version of the RPM-based tomcat install.

Comment 4 Lukas Krejci 2011-11-23 14:30:22 UTC
Note that this is currently only in master.

commit 884eb4f2a4a609ff9541d9d8693133f79518a520
Author: Lukas Krejci <lkrejci>
Date:   Wed Nov 23 15:26:04 2011 +0100

    [BZ 690957] - EWS Tomcat is identical to "normal" tomcat when installed through RPM (at least wrt system services installed)
    Make sure that the operation execution logic doesn't get confused by not being able to distinguish between them.

Comment 5 Charles Crouch 2011-11-29 05:07:37 UTC
Mike can you have this tested in master so we can get it into the release 
branch, assuming it verifies

Comment 6 Praveen Adupa 2011-12-01 16:00:25 UTC
I am using  below version JON and still getting this error. does this exist previous builds also. Also is there a fix avaialbe for this. 

version: 2.4.1.GA
build number: 11140:81e26be20d 

thanks,
Praveen

Comment 8 Libor Fuka 2013-11-11 14:30:40 UTC
VERIFIED: JON 3.2.0.ER5 + EWS 2.0.1 Tomcat6 from RPM + RHEL 6.4 (x86_64) + OpenJDK 1.6

NOT VERIFIED: JON 3.2.0.ER5 + EWS 2.0.1 Tomcat7 from RPM + RHEL 6.4 (x86_64) + OpenJDK 1.6
It shows Operation status failed in JON HTML UI:
java.lang.RuntimeException: Script returned error or non-zero exit code while shutting down the Tomcat instance. Exit code [1]
	at org.jboss.on.plugins.tomcat.TomcatServerOperationsDelegate.doShutdown(TomcatServerOperationsDelegate.java:314)
	at org.jboss.on.plugins.tomcat.TomcatServerOperationsDelegate.shutdown(TomcatServerOperationsDelegate.java:279)
	at org.jboss.on.plugins.tomcat.TomcatServerOperationsDelegate.shutdown(TomcatServerOperationsDelegate.java:275)
	at org.jboss.on.plugins.tomcat.TomcatServerOperationsDelegate.invoke(TomcatServerOperationsDelegate.java:129)
	at org.jboss.on.plugins.tomcat.TomcatServerComponent.invokeOperation(TomcatServerComponent.java:453)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:622)
	at org.rhq.core.pc.inventory.ResourceContainer$ComponentInvocation.call(ResourceContainer.java:654)
	at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
	at java.util.concurrent.FutureTask.run(FutureTask.java:166)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1146)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
	at java.lang.Thread.run(Thread.java:701)

Configuration in JON Tomcat config:
Control Method: RPM System V init script
Start Script: /usr/sbin/tomcat7
Stop Script: /usr/sbin/tomcat7

Comment 9 Jean-frederic Clere 2014-03-08 18:44:15 UTC
Fixed by https://github.com/rhq-project/rhq/pull/10

Comment 11 Libor Fuka 2014-07-17 09:21:18 UTC
I am receiving still the same error when i want to shutdown EWS tomcat7 installed from RPM.
I am receiving error in catalina.out:
Error: Exception thrown by the agent : java.rmi.server.ExportException: Port already in use: 8100; nested exception is: 
        java.net.BindException: Address already in use

It the same with RPM tomcat6.

Tested environment:
JON 3.2.0.GA+update02 + Tomcat plugin update-01 + EWS 2.1.0.ER4 Tomcat6/7 from RPM + RHEL 5 (x86_64) + OpenJDK 1.7

Comment 12 Libor Fuka 2014-07-17 09:22:26 UTC
Note: port 8100 is from jmx configured for Tomcat. There is no opened port 8100 when i shutdown tomcat.

Comment 13 Libor Fuka 2014-07-17 10:52:50 UTC
comm#11 and #12 - Tomcat was running under tomcat user and JON agent under root user.

Comment 14 Libor Fuka 2014-07-17 12:11:11 UTC
It was my bad configuration. I set up jmx properties in /etc/tomcatX/tomcatX.conf JAVA_OPTS section. Its bad because it sets up JAVA_OPTS during start and also shutdown operation.

Correct configuration for JON monitoring RPM EWS Tomcat is (X is tomcat version):
1. Set up jmx JAVA_OPTS properties in /usr/sbin/tomcatX script in section start and start-security.
example:
....
if [ "$1" = "start" ]; then
JAVA_OPTS="${JAVA_OPTS} -Dcom.sun.management.jmxremote.port=8100 -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.authenticate=true -Dcom.sun.management.jmxr
emote.access.file="/etc/tomcatX/jmxremote.access" -Dcom.sun.management.jmxremote.password.file="/etc/tomcatX/jmxremote.password""

  ${JAVACMD} $JAVA_OPTS $LOGGING_CONFIG $CATALINA_OPTS \
    -classpath "$CLASSPATH" \
    -Dcatalina.base="$CATALINA_BASE" \
    -Dcatalina.home="$CATALINA_HOME" \
    -Djava.endorsed.dirs="$JAVA_ENDORSED_DIRS" \
    -Djava.io.tmpdir="$CATALINA_TMPDIR" \
    org.apache.catalina.startup.Bootstrap start \
    >> ${CATALINA_BASE}/logs/catalina.out 2>&1 &
    if [ ! -z "$CATALINA_PID" ]; then
      echo $! > $CATALINA_PID
    fi
elif [ "$1" = "start-security" ]; then
JAVA_OPTS="${JAVA_OPTS} -Dcom.sun.management.jmxremote.port=8100 -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.authenticate=true -Dcom.sun.management.jmxr
emote.access.file="/etc/tomcat6/jmxremote.access" -Dcom.sun.management.jmxremote.password.file="/etc/tomcat6/jmxremote.password""

  ${JAVACMD} $JAVA_OPTS $LOGGING_CONFIG $CATALINA_OPTS \
    -classpath "$CLASSPATH" \
    -Dcatalina.base="$CATALINA_BASE" \
....

2. Set Tomcat to run under root user in /etc/tomcatX/tomcatX.conf 
# What user should run tomcat
TOMCAT_USER="root"

3. Start tomcat by command service tomcatX start under root user
4. Start JON agent under root user
5. Import JON agent and tomcat to JON server from JON HTML UI
6. Setup Tomcat connection configuration (principal and credentials) in JON UI
7. Setup Tomcat Control method configuration to RPM System V init script (note: Start and Shutdown script may not be set because Tomcat plugin always run service tomcatX start/stop command if we are using RPM System V init script)

That's it

Comment 15 Libor Fuka 2014-07-17 12:53:04 UTC
VERIFIED on RHEL5 x86_64 + JON 3.2.0.GA (update02) + JON Tomcat plugin (update01) + OpenJDK 1.7 + EWS RPM Tomcat6/7

Comment 16 Libor Fuka 2014-07-17 13:34:18 UTC
Mandar please document steps from comm#14

Comment 17 Libor Fuka 2014-07-18 08:19:42 UTC
VERIFIED on RHEL7 x86_64 + JON 3.2.0.GA (update02) + JON Tomcat plugin (update01) + OpenJDK 1.7 + EWS RPM Tomcat6/7

Comment 18 Mandar Joshi 2014-07-22 11:33:18 UTC
bug cloned for documentation.
bz#1122005

Comment 19 Mandar Joshi 2014-08-11 14:21:22 UTC
added doc text.

Comment 20 Larry O'Leary 2014-08-21 21:40:05 UTC
This fix, change, or update was tested and released in Web Server Plugin Pack Update-01 for JBoss ON 3.2 -- https://access.redhat.com/jbossnetwork/restricted/softwareDetail.html?softwareId=32543


Note You need to log in before you can comment on or make changes to this bug.