Bug 956509

Summary: add storeconfig to EWS 2.0.1
Product: [JBoss] JBoss Enterprise Web Server 2 Reporter: Weinan Li <weli>
Component: tomcat6, tomcat7, JON PluginAssignee: David Knox <dknox>
Status: CLOSED CURRENTRELEASE QA Contact: Libor Fuka <lfuka>
Severity: high Docs Contact:
Priority: high    
Version: 2.0.1CC: cwelton, dknox, jclere, jdoyle, lfuka, loleary, majoshi, mbabacek, mhasko, myarboro, pslavice, pyadav, rhatlapa, rmaucher, rsvoboda, tsegismo
Target Milestone: ER04   
Target Release: 2.1.0   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Previously, JBoss Operations Network did not work as expected with JBoss Enterprise Web Server because the <classname>storeconfig</classname> components in tomcat 6 and 7 were missing. The missing <classname>StoreConfig</classname> components are now available in and this is a resolved issue in JBoss Enterprise Web Server 2.1.
Story Points: ---
Clone Of: Environment:
Last Closed: 2014-08-21 21:39:57 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On: 1115805, 1115849    
Bug Blocks: 683054, 583996, 625146, 956987, 956990, 1111666    
Attachments:
Description Flags
T6 server.xmls
none
T7 server.xmls
none
T6 server.xml manual testing
none
TC& Out-of-the-box server.xml with coments removed
none
TC7 server.xml after storeConfig
none
TC7 log showing errors created by StoreConfig
none
storeconfig lib for tc7
none
storeconfig lib for tc6
none
storeconfig lib for tc6
none
JON agent.log for T6 config app problem
none
Catalina.out for T6 config app problem
none
agent.log for T7 config virtual host problem
none
Catalina.out for T7 config virtual host problem
none
sample application for JON Tomcat plugin deploy/undeploy/config change testing
none
patch for mod_cluster "problem".
none
Patch for Tomcat 6 context files creation none

Description Weinan Li 2013-04-25 06:26:09 UTC
The following components need to be added into EWS 2.0.1 for JON to work properly:

http://svn.apache.org/repos/asf/tomcat/sandbox/storeconfig6/tags/0.0.1.Alpha1/
http://svn.apache.org/repos/asf/tomcat/sandbox/storeconfig7/tags/0.0.1.Alpha1/

It is a piece of code what was in tomcat5.5.x and removed in 6 and 7 and readded in trunk (8).

Comment 1 Mandar Joshi 2013-05-14 08:19:44 UTC
Doc Text added.

@David, can you please review the Doc Text content?

Comment 2 David Knox 2013-05-15 16:17:05 UTC
Hi Weinan,
There is a problem with both storeconfig-tc6 and tc7. Both use catalina-ha and transitive dependency, catalina-tribes. We exclude both viz JBPAPP-9557. I haven't yet had time to look the storeconfig source closely for a workaround.

Comment 3 David Knox 2013-05-17 18:30:06 UTC
@Mandar, the doc is fine for now but may need to be edited later.

Comment 6 Weinan Li 2013-05-30 03:07:25 UTC
From the pm meeting this is deferred from 2.0.1. I'll confirm in ews-pm.

Comment 7 Libor Fuka 2013-06-03 06:20:40 UTC
This bug should be in known issues. It will not be fixed with EWS 2.0.1

Comment 13 Libor Fuka 2013-08-27 10:17:11 UTC
It doesn't work properly.
Tested environment:
 - JON 3.1.2 server with EWS plugin hotfix + EWS 2.0.1 with storeconfig jars from comm10
 - RHEL5 and SunJDK 1.6

Tests steps:
start T6 - change virtual host property autoDeploy to false - restart T6
start T7 - change virtual host property autoDeploy to false - restart T7

server.xmls before and after changes attached.

Comment 14 Libor Fuka 2013-08-27 10:18:12 UTC
Created attachment 790881 [details]
T6 server.xmls

Comment 15 Libor Fuka 2013-08-27 10:18:41 UTC
Created attachment 790882 [details]
T7 server.xmls

Comment 17 Libor Fuka 2013-08-27 11:04:25 UTC
T6 - server.xml is not well formed after storeconfig operation and missing some properties (address, etc.)
T7 - server.xml does not include Listener tags after storeconfig operation and also missing some tags 
     (<Realm className="org.apache.catalina.realm.UserDatabaseRealm" resourceName="UserDatabase"/>)

Comment 18 Jean-frederic Clere 2013-08-27 13:04:16 UTC
for TC6 it looks like the server.xml is broken: only a part of it. Any thing in the agent log? Like an exception?

Comment 19 Libor Fuka 2013-08-27 13:32:40 UTC
I tried T6 test again manually and it seems well formed but missing address attribute in connectors elements and some others attributes. Other missing attributes like appBase="webapps", unpackWARs="true", xmlValidation="false", xmlNamespaceAware="false" in Host element and connectionTimeout="20000" in HTTP connector elemnts should be defaults so they are not needed in server.xml
Missing address attribute for connectors is a problem.

I also tried T7 test manually and missing Listeners elements are still there.

Comment 20 Libor Fuka 2013-08-27 13:33:14 UTC
Created attachment 790974 [details]
T6 server.xml manual testing

Comment 21 Michal Haško 2013-08-27 13:57:50 UTC
I'm not so sure the missing address attribute is that big of a problem.
From T6 documentation for the 'address' attribute:

   "For servers with more than one IP address, this attribute specifies which
    address will be used for listening on the specified port. By default, this
    port will be used on all IP addresses associated with the server."

    (http://tomcat.apache.org/tomcat-6.0-doc/config/http.html#Attributes)

I wonder if it was omitted on purpose since it can (probably) be considered unnecessary when the machine has only one IP address.

appBase="webapps" is definitely a default setting. Not sure about the rest. (Someone might need to dig in the code).

I don't know how the storeconfig is implemented, but I'd expect something along the lines of "save everything we can't get from default values to server.xml".

Comment 22 Jean-frederic Clere 2013-08-28 08:07:05 UTC
the missing address in the connector is a problem it needs to be fixed.

Comment 23 Libor Fuka 2013-08-28 12:14:38 UTC
Findings: T6 not well formed server.xml is created after changing configuration of deployed application.
Steps to reproduce:
1. Deploy application
2. Change their configuration in JON UI, for example set reloadable attribute to NO
3. Check server.xml -> not well formed

There is also error in catalina.out after changing app configuration:
Aug 28, 2013 8:08:00 AM org.apache.catalina.storeconfig.StoreConfig store
SEVERE: java.lang.InstantiationException: org.apache.catalina.core.StandardEngine$AccessLogListener

Comment 24 David Knox 2013-08-29 22:17:27 UTC
i can reproduce with a simple jmx client.
(1) save a copy of the stock server.xml, 
(2) create a new virt host by invoking addChild on Catalina:type=Engine
(3) invoke storeConfig on Catalina:type=StoreConfig
(4) compare the original with the current

Missing Listeners is because that code is commented. I think there's some configuration problems as well.

StoreConfig tries to rewrite the server.xml, but the result is missing all comments, the file header, and element attributes.

i'm working on it.

Comment 25 Jean-frederic Clere 2013-08-30 07:50:41 UTC
I don't think you will be able to save the comments.
What element attributes are missing?

Comment 26 David Knox 2013-09-03 18:17:54 UTC
No. the comments aren't in the model. Just components and properties.

(1) The server/filters are not being written. This might be because the listeners are configured as 'TransientChild'in server-registry. This has my focus.

(2) The Server attributes port and shutdown are lost.
(3) maxThreads is lost in Connectors, but it does include attributes that are 
not in the base server.xml e.g., Connector:8080 - maxConnections, keepAliveTimeout; Connector:8009 - connectionTimeout, keepAliveTimout, maxConnections, packetSize, tomcatAuthentication. 
(4) storeconfig is missing a Realm for UserDatabaseRealm. storeconfig may not currently allow for a nested Realm.
(5) the connector for 8443 is lost. It's commented in the base server.xml.

Comment 27 Rémy Maucherat 2013-09-04 10:07:42 UTC
storeconfig is an introspection based tool, which produces a bare bones server.xml out of the server's runtime state. To avoid producing a server.xml that would be more verbose than what a user would usually do, it uses introspected default values (other "default" values can be set from somewhere else without the user doing anything to its server.xml, but storeconfig can't see that and they will be saved), known listeners that will always be set, etc. But it can also never be foolproof, and will also never look like the original server.xml.

To examine possible issues and know if it's a bug / can't fix / normal, you need to post the original server.xml snippets (and storeconfiged server.xml snippet too if possible). And specify is this is with 6 or 7 too.

Comment 28 David Knox 2013-09-04 17:47:48 UTC
Created attachment 793762 [details]
TC& Out-of-the-box server.xml with coments removed

The comments have been removed.

Comment 29 David Knox 2013-09-04 17:49:53 UTC
Created attachment 793764 [details]
TC7 server.xml after storeConfig

A vhost is added: "testhost" and storeConfig() has been called

Comment 30 David Knox 2013-09-04 18:00:54 UTC
The result server.xml is broken as comment#23 alludes. 

The error is:
SEVERE: Cannot move orignal context output file at /var/lib/tomcat7/webapps/host-manager/META-INF/context.xml
Sep 04, 2013 1:15:54 PM org.apache.tomcat.util.digester.Digester fatalError
SEVERE: Parse Fatal Error at line 20 column 34: Attribute "connectionTimeout" was already specified for element "Connector".
org.xml.sax.SAXParseException; systemId: file:/usr/share/tomcat7/conf/server.xml; lineNumber: 20; columnNumber: 34; Attribute "connectionTimeout" was already specified for element "Connector".

The complaint is true for both Connector:port=8080 and 8009

I'm going to attach the full log.

Comment 31 David Knox 2013-09-04 18:08:02 UTC
Created attachment 793768 [details]
TC7 log showing errors created by StoreConfig

TC7 catalina.out showing errors from connector elements.

Comment 32 Libor Fuka 2013-09-05 13:39:53 UTC
I found that new T8 RC1 on tomcat.apache.org includes catalina-storeconfig.jar.
May be some code from T8 will be helpful.

Comment 33 Rémy Maucherat 2013-09-05 13:54:18 UTC
Yes, we integrated storeconfig in Tomcat trunk now.

Since the default server.xml works fine for me, maybe the tag used has a problem ? I did diffs and all, but maybe I messed up or something. I also checked all my uncommitted changes were the cluster removal (so I'm not testing saving the cluster config, obviously). Can you try building the JAR from sandbox/storeconfig7/trunk ? If there's a problem, creating a new tag would be easy.

Comment 34 David Knox 2013-09-06 00:00:20 UTC
Digging deeper - The Server/Listener-s need to be written. StoreConfigLifecycleListener is removed along with the other Listeners. 

Changing server-registry and commenting the TransientChild elements under the Listener Description seems to have no affect.

Comment 35 Rémy Maucherat 2013-09-06 07:59:24 UTC
"The Server/Listener-s need to be written."
Yes, and this works fine for me. Did you try trunk ?

Comment 36 David Knox 2013-09-11 20:39:46 UTC
solved the Listener problem. Next: Connector/connectionTimeout is being defined twice.

Comment 37 Libor Fuka 2013-09-25 10:15:49 UTC
*** Bug 583996 has been marked as a duplicate of this bug. ***

Comment 41 Libor Fuka 2013-10-01 11:30:08 UTC
tomcat7-storeconfig-0.0.1.Alpha2-redhat-4.jar tested with EWS 2.0.1 T7 + JON 3.2.0.ER2 with SunJDK 1.6 on RHEL6
================================================================================================================
Findings:
----------
1. Listeners are mostly fixed, but there is still missing <Listener className="org.apache.catalina.core.ThreadLocalLeakPreventionListener" />
2. There is a still missing attribute address in connector elements
3. There is a still missing Realm element <Realm className="org.apache.catalina.realm.UserDatabaseRealm" .....
<Realm className="org.apache.catalina.realm.LockOutRealm">
  <Realm className="org.apache.catalina.realm.UserDatabaseRealm"
               resourceName="UserDatabase"/>
</Realm>
4. Persistency of changed deployed webapp configuration doesn't work


tomcat6-storeconfig-0.0.1.Alpha2-redhat-3.jar tested with EWS 2.0.1 T6 + JON 3.2.0.ER2 with SunJDK 1.6 on RHEL5
================================================================================================================
Findings:
----------
1. T6 not well formed server.xml is created after changing configuration of deployed application (comm#23).
2. There is a still missing attribute address in connector elements

Comment 42 Rémy Maucherat 2013-10-03 16:18:34 UTC
I can work on it, but you need to clarify 4), saving context.xml (which is the webapp config) actually works fine for me in Tomcat.

Comment 43 Libor Fuka 2013-10-04 08:26:52 UTC
ad 4)
I deployed webbapp without context.xml file. The problem is storeconfig didn't create it after JON UI webapp config change.

Comment 44 Rémy Maucherat 2013-10-04 12:07:57 UTC
Ok, maybe this is about the webapps that do not have a context.xml, in that case I don't think it creates one (otherwise, it would always be creating one, since it's not going to know if there's anything to save). That's a limitation.

Comment 45 Libor Fuka 2013-10-04 12:20:49 UTC
I think the storeconfig should always create context.xml.

Comment 46 Rémy Maucherat 2013-10-04 15:19:53 UTC
Ok, I think I found a way. That's a lot of changes to port, and the branches are all different.

Comment 48 Rémy Maucherat 2013-10-07 15:49:22 UTC
After porting, all looks ok now, except item 3) for Tomcat 7, which needs a new API addition to realm. As storeconfig is supposed to support many Tomcat 7s as an addon, this does not look like a realistic scenario, so nested realms (which are quite useless anyway) cannot be supported.

Should I now create new tags for storeconfig6 and storeconfig7 ?

Comment 50 Libor Fuka 2013-10-08 06:49:25 UTC
I think yes

Comment 51 Rémy Maucherat 2013-10-08 08:26:43 UTC
Ok, new tag: Alpha3

Comment 53 Jean-frederic Clere 2013-10-09 13:16:29 UTC
With https://brewweb.devel.redhat.com/buildinfo?buildID=298779
1) Not tested TC6 doesn't support it.
2) It seems no a problem in storeconfig but some in the tomcat plugin.
3) Not tested TC6 doesn't support it.
4) the file is created it looks OK.

Comment 54 David Knox 2013-10-09 16:11:55 UTC
Created attachment 810029 [details]
storeconfig lib for tc7

adding for ease of access.

Comment 55 David Knox 2013-10-09 20:49:43 UTC
Created attachment 810181 [details]
storeconfig lib for tc6

Comment 56 David Knox 2013-10-09 20:54:46 UTC
Created attachment 810182 [details]
storeconfig lib for tc6

Comment 57 Libor Fuka 2013-10-14 14:31:40 UTC
tomcat7-storeconfig-0.0.1.Alpha3-redhat-2.jar tested with EWS 2.0.1 T7 + JON 3.2.0.ER3 with SunJDK 1.6 on RHEL6
==============================================
1. Listeners - FIXED
2. missing attribute address in connector elements - FIXED
3. Nested Realm doesn't support it - ok, this will go to known issues
4. Persistency of changed deployed webapp configuration - FIXED
5. FOUND - Persistence of connector configuration change doesn't work (I tried to change "Max Threads" attribute to 300)

Comment 58 Libor Fuka 2013-10-14 14:53:30 UTC
tomcat6-storeconfig-0.0.1.Alpha3-redhat-8.jar tested with EWS 2.0.1 T6 + JON 3.2.0.ER3 with SunJDK 1.6 on RHEL6
==============================================
1. T6 not well formed server.xml is created after changing configuration of deployed application (comm#23) - FIXED
2. missing attribute address in connector elements - FIXED
3. FOUND - Persistency of changed deployed webapp configuration doesn't work

Comment 59 Jean-frederic Clere 2013-10-17 14:35:26 UTC
2) How did you test it? It doesn't work for me. (TC6 and TC7).

Comment 60 Libor Fuka 2013-10-22 06:40:23 UTC
2) address attribute in connector elements - 
   - i set this attribute before starting tomcat in server.xml manually
   - start tomcat and discovery it to JON
   - change some other attribute for connector in JON UI
   - restart tomcat in JON UI
   - check the connector attributes

and whats your steps Jean-Frederic ?

Comment 61 Jean-frederic Clere 2013-10-22 06:56:33 UTC
Address:
 - start tomcat
 - discover and import it
 - set the address in the JON UI and press save
the server.xml is not changed.

Comment 63 Jean-frederic Clere 2014-01-08 08:14:54 UTC
https://git.fedorahosted.org/cgit/rhq/rhq.git/commit/?id=7548d1752c8d518f43cf8b8deb496b793c9b1866
fix in master that needs to be ported.

Comment 65 Libor Fuka 2014-06-10 13:24:13 UTC
tomcat6-storeconfig-0.0.1.Alpha3-redhat-12.jar tested with EWS 2.1.0 ER2 T6 + JON 3.2.0.GA with SunJDK 1.6 on RHEL6
===============================================
Persistency of changed deployed webapp configuration doesn't work

tomcat7-storeconfig-0.0.1.Alpha3-redhat-3.jar tested with EWS 2.1.0 ER2 T7 + JON 3.2.0.GA with SunJDK 1.6 on RHEL6
===============================================
Persistence of connector configuration change doesn't work (I tried to change "Max Threads" attribute to 300)

Comment 67 Jean-frederic Clere 2014-06-23 15:48:20 UTC
That isn't storeconfig problem.
BTW: to test storeconfig you don't need JON but just jconsole.

Comment 68 Jean-frederic Clere 2014-06-23 15:54:12 UTC
That isn't storeconfig problem.
BTW: to test storeconfig you don't need JON but just jconsole.

do you have something in the agent.log file?

Comment 69 Jean-frederic Clere 2014-06-24 07:21:31 UTC
It works with master. So it is fix missing somewhere in rhq code...

Comment 70 Libor Fuka 2014-06-24 08:04:14 UTC
Created attachment 911655 [details]
JON agent.log for T6 config app problem

Comment 71 Libor Fuka 2014-06-24 08:04:51 UTC
Created attachment 911656 [details]
Catalina.out for T6 config app problem

Comment 72 Libor Fuka 2014-06-24 08:05:25 UTC
Created attachment 911657 [details]
agent.log for T7 config virtual host problem

Comment 73 Libor Fuka 2014-06-24 08:06:03 UTC
Created attachment 911658 [details]
Catalina.out for T7 config virtual host problem

Comment 74 Jean-frederic Clere 2014-06-24 08:31:55 UTC
https://git.fedorahosted.org/cgit/rhq/rhq.git/patch/?id=7548d1752c8d518f43cf8b8deb496b793c9b1866 is missing in the branch.

Comment 75 Jean-frederic Clere 2014-06-24 08:44:18 UTC
I don't have problems with the virtual host what are you testing?
BTW: Could you please limit the logs to the error or around the error?

Comment 76 Libor Fuka 2014-06-24 09:17:01 UTC
Sorry, its my mistake in comm# 72 nad 73.
T7 has problem with - Persistence of connector configuration change doesn't work (I tried to change "Max Threads" attribute to 300)

Comment 77 Libor Fuka 2014-06-24 09:24:57 UTC
Created attachment 911676 [details]
sample application for JON Tomcat plugin deploy/undeploy/config change testing

Comment 78 Libor Fuka 2014-06-24 12:32:12 UTC
Larry, please verify comm#74 and add the patch for building new Tomcat plugin build.

Comment 79 Jean-frederic Clere 2014-06-26 11:44:19 UTC
Note http://svn.apache.org/viewvc?view=revision&revision=r1605724 might be back ported to provide patches for our branches.

Comment 80 Jean-frederic Clere 2014-06-26 12:33:01 UTC
Created attachment 912410 [details]
patch for mod_cluster "problem".

Prevent server.xml being destroyed by mod_cluster listener.

Comment 83 Rémy Maucherat 2014-07-03 14:14:19 UTC
Created attachment 914483 [details]
Patch for Tomcat 6 context files creation

Adds the capability to save context config if the config file doesn't exist in storeconfig6.

Comment 84 Libor Fuka 2014-07-17 15:39:49 UTC
pre-tested Remy's patch and its safe to include it in CR1

Comment 85 Libor Fuka 2014-08-04 12:41:34 UTC
Verified with EWS 2.1.0 CR2 on RHEL - OracleJDK 1.6/1.7, OpenJDK 1.6/1.7, IBMJDK 1.6/1.7 
MS Windows, Solaris - OracleJDK 1.6/1.7

waiting for rpm tests...

Comment 87 Michal Karm Babacek 2014-08-19 11:29:54 UTC
O.K.

Comment 88 Larry O'Leary 2014-08-21 21:39:57 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