Bug 772790

Summary: Tomcat Web Application incorrectly discovered and imported into inventory when application is deployed outside of webapps base directory
Product: [Other] RHQ Project Reporter: Larry O'Leary <loleary>
Component: PluginsAssignee: Nobody <nobody>
Status: NEW --- QA Contact:
Severity: medium Docs Contact:
Priority: high    
Version: 4.3CC: hrupp
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
helloworld.war that should be deployed to non-standard location none

Description Larry O'Leary 2012-01-10 00:08:55 UTC
Created attachment 551724 [details]
helloworld.war that should be deployed to non-standard location

Description of problem:
When web application is deployed to an alternate location with non-default context name and unpackWARs=true for the Tomcat Virtual Host, the result is an invalid Tomcat Web Application deployment name added to inventory.

For example, if an application is deployed in ../apps (instead of ../webapps) and a context definition is added to the Tomcat Virtual Host as:

<Context docBase="../apps/helloworld.war" path="/myapps/helloworld" />

And a Tomcat Virtual Host definition such as:

<Host name="localhost"  appBase="webapps" unpackWARs="true" autoDeploy="true" xmlValidation="false" xmlNamespaceAware="false">
...

The result is two Tomcat Web Application resources being added to inventory:

/myapps/helloworld
/myapps#helloworld

The first one is correct but the second one is incorrect and is a result of the unpackWARs option causing ../apps/helloworld.war being extracted to ../webapps/myapps#helloworld

Version-Release number of selected component (if applicable):
pre-4.3 based on master including http://git.fedorahosted.org/git/?p=rhq/rhq.git;a=commit;h=d1d18876b9f22a681e7243ef54aa649d066e8656

How reproducible:
Always

Steps to Reproduce:
1. Install Tomcat6 instance
2. Create a directory called apps, one directory above where webapps resides
3. Copy helloworld.war into the apps directory
4. Edit server.xml and add:
       <Context docBase="../apps/helloworld.war" path="/myapps/helloworld" />
5. Confirm that Virtual Host definition contains unpackWARs="true"
6. Start the Tomcat server
7. Add the tomcat instance to inventory
  
Actual results:
Two web application appear in inventory for helloworld app:
   /myapps/helloworld
   /myapps#helloworld


Expected results:
One web application appear in inventory for helloworld app:
   /myapps/helloworld


Additional info:
If unpackWARs is set to false, Tomcat will not extract the helloworld.war to the webapps directory and the result will be a single web application as described by the expected results.