Bug 786194

Summary: CLI interface simplifiers cause classloading exceptions in server when using non-default context classloader
Product: [Other] RHQ Project Reporter: Lukas Krejci <lkrejci>
Component: Core ServerAssignee: RHQ Project Maintainer <rhq-maint>
Status: CLOSED CURRENTRELEASE QA Contact: Mike Foley <mfoley>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 4.3CC: hrupp
Target Milestone: ---Keywords: Reopened
Target Release: RHQ 4.3.0   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2013-09-01 10:01:10 UTC Type: ---
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:    
Bug Blocks: 790018    

Description Lukas Krejci 2012-01-31 17:12:35 UTC
Description of problem:
In the RHQ server, the CLI code can theoretically be invoked with different context classloaders. This obviously depends on the thread that invokes the code in question. It is generally not guaranteed that context classloader will be the same from invocation to invocation.

The interface simplifiers inside CLI generate custom classes on the fly and place them inside the context classloader. Such dynamically generated class is then used to generate a dynamic proxy that is configured to reside in the same classloader as the original interface.

Because the classloader of the original interface and the context classloader can be different, the creation of the dynamic proxy might fail because the dynamically created class will not be visible in the original classloader.

Version-Release number of selected component (if applicable):
4.3.0-SNAPSHOT

How reproducible:
with difficulties

Steps to Reproduce:
1. checkout and build https://github.com/metlos/rhq-xmpp
2. Install the plugin into RHQ server
3. Configure it following the instructions in this video http://vimeo.com/35730049
4. Connect to the chat and try sending "var r = ProxyFactory.getResource(10001);"
  
Actual results:
IllegalArgumentException complaining about a class not being visible from classloader

Expected results:
CLI statements working as expected

Additional info:

Comment 1 Lukas Krejci 2012-01-31 18:12:57 UTC
master: http://git.fedorahosted.org/git/?p=rhq/rhq.git;a=commitdiff;h=c9cc6ed13db6d9d246611f627323abc86bd3f461
Author: Lukas Krejci <lkrejci>
Date:   Tue Jan 31 19:11:25 2012 +0100

    [BZ 786194] - Make sure to set the correct context classloader when
    simplifying the interfaces for the LocalClientProxy.

Comment 2 Charles Crouch 2012-02-13 04:39:47 UTC
Not quite sure how this ended up as CLOSED:UPSTREAM. Also it doesn't seem to have gone through a verification step so setting it back to ON_QA so it can be verified in master/RHQ4.3

Comment 3 Lukas Krejci 2012-02-13 14:31:42 UTC
Putting this under the correct tracker.

Comment 4 Heiko W. Rupp 2013-09-01 10:01:10 UTC
Bulk closing of items that are on_qa and in old RHQ releases, which are out for a long time and where the issue has not been re-opened since.