Bug 771497 - TomcatWarDiscoveryComponent excludes valid WAR deployments due to eager host name regular expression
TomcatWarDiscoveryComponent excludes valid WAR deployments due to eager host ...
Status: CLOSED DUPLICATE of bug 784000
Product: RHQ Project
Classification: Other
Component: Plugins (Show other bugs)
All All
high Severity high (vote)
: ---
: ---
Assigned To: Larry O'Leary
Mike Foley
Depends On: 771495
Blocks: 784000
  Show dependency treegraph
Reported: 2012-01-03 16:56 EST by Larry O'Leary
Modified: 2012-01-23 11:22 EST (History)
1 user (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: 771495
Last Closed: 2012-01-23 11:22:28 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)
helloworld.war that should be deployed to non-standard location (866 bytes, application/octet-stream)
2012-01-03 16:59 EST, Larry O'Leary
no flags Details

  None (edit)
Description Larry O'Leary 2012-01-03 16:56:53 EST
Description of problem:
If a web application is deployed with a context of //localhost/myapps/helloworld it is ignored during service discovery. This is because the discovery logic attempts to confirm that the host name portion of the context path matches that of the Tomcat Virtual Host. This is done by using a regular expression to break the context into its host name and its path. The misbehaving regex is "//(.*)(/.*)" seen at http://git.fedorahosted.org/git?p=rhq/rhq.git;a=blob;f=modules/plugins/tomcat/src/main/java/org/jboss/on/plugins/tomcat/TomcatWarDiscoveryComponent.java;h=f6fa791585c796650e76544ef34917f2c9e07538;hb=6746535317a560e748a3753cb9ff4906ae6a468c#l61

With this regex, the host name becomes everything after the starting // up to the last /.

A more appropriate regex with the minimalist of change would be:


Version-Release number of selected component (if applicable):
plugins-tomcat 3.0.1

How reproducible:

Steps to Reproduce:
1. Create a directory called apps, one directory above where webapps resides
2. Copy helloworld.war into the apps directory
3. Edit server.xml and add:
       <Context docBase="../apps/helloworld.war" path="/myapps/helloworld" />
4. Start the Tomcat server
5. Add the tomcat instance to inventory
Actual results:
All WARs are added to inventory except the helloworld.war

Expected results:
helloworld.war should have appeared as /myapps/helloworld
Comment 1 Larry O'Leary 2012-01-03 16:59:09 EST
Created attachment 550546 [details]
helloworld.war that should be deployed to non-standard location
Comment 2 Larry O'Leary 2012-01-03 17:56:01 EST
Updated regular expression used to extract host name from context path in
TomcatWarDiscoveryComponent.java. The regular expression now uses the value
following the first // and before the next / as the host name. For example,

http://git.fedorahosted.org/git/?p=rhq/rhq.git;a=commit;h=d1d18876b9f22a681e7243ef54aa649d066e8656 on master
Comment 3 Larry O'Leary 2012-01-09 19:15:47 EST
This fix exposes the issue identified in Bug 772790 which is not directly related to this issue and should not prevent this issue from passing QA assuming that the correct web application context is displayed and functioning (available and being monitored).
Comment 4 Mike Foley 2012-01-16 14:21:35 EST
verified as part of jon 2.4.2
Comment 5 Charles Crouch 2012-01-23 11:22:28 EST
This will be get fixed and tested in master via https://bugzilla.redhat.com/show_bug.cgi?id=784000

*** This bug has been marked as a duplicate of bug 784000 ***

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