Bug 771497 - TomcatWarDiscoveryComponent excludes valid WAR deployments due to eager host name regular expression
Summary: TomcatWarDiscoveryComponent excludes valid WAR deployments due to eager host ...
Keywords:
Status: CLOSED DUPLICATE of bug 784000
Alias: None
Product: RHQ Project
Classification: Other
Component: Plugins
Version: 4.3
Hardware: All
OS: All
high
high
Target Milestone: ---
: ---
Assignee: Larry O'Leary
QA Contact: Mike Foley
URL:
Whiteboard:
Depends On: 771495
Blocks: 784000
TreeView+ depends on / blocked
 
Reported: 2012-01-03 21:56 UTC by Larry O'Leary
Modified: 2012-01-23 16:22 UTC (History)
1 user (show)

Fixed In Version:
Clone Of: 771495
Environment:
Last Closed: 2012-01-23 16:22:28 UTC
Embargoed:


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


Links
System ID Private Priority Status Summary Last Updated
Red Hat Bugzilla 772790 0 high NEW Tomcat Web Application incorrectly discovered and imported into inventory when application is deployed outside of webapp... 2022-03-31 04:28:51 UTC

Internal Links: 772790

Description Larry O'Leary 2012-01-03 21:56:53 UTC
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:

"//([^:/\\s]+)(/.*)"



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

How reproducible:
Always

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 21:59:09 UTC
Created attachment 550546 [details]
helloworld.war that should be deployed to non-standard location

Comment 2 Larry O'Leary 2012-01-03 22:56:01 UTC
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,
//use.this.value.as.host.name/.

http://git.fedorahosted.org/git/?p=rhq/rhq.git;a=commit;h=d1d18876b9f22a681e7243ef54aa649d066e8656 on master

Comment 3 Larry O'Leary 2012-01-10 00:15:47 UTC
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 19:21:35 UTC
verified as part of jon 2.4.2

Comment 5 Charles Crouch 2012-01-23 16:22:28 UTC
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.