Bug 828464 - Unable to create ESB deployment
Unable to create ESB deployment
Status: CLOSED CURRENTRELEASE
Product: JBoss Operations Network
Classification: JBoss
Component: Plugin -- SOA 4, Plugin -- SOA 5 (Show other bugs)
JON 3.0.1
i386 Linux
urgent Severity urgent
: ---
: JON 3.1.0
Assigned To: RHQ Project Maintainer
Mike Foley
:
Depends On:
Blocks: 829071
  Show dependency treegraph
 
Reported: 2012-06-04 14:46 EDT by Libor Zoubek
Modified: 2015-11-01 19:43 EST (History)
6 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
: 829071 (view as bug list)
Environment:
Last Closed: 2013-09-11 07:03:33 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:


Attachments (Terms of Use)
sample ESB deployment (3.23 KB, application/octet-stream)
2012-06-04 14:46 EDT, Libor Zoubek
no flags Details
JBoss ESB Connection settings error (129.09 KB, image/png)
2012-06-05 08:24 EDT, Pavel Kralik
no flags Details
JBoss ESB > Deployments > Connection settings error (100.40 KB, image/png)
2012-06-05 09:18 EDT, Pavel Kralik
no flags Details

  None (edit)
Description Libor Zoubek 2012-06-04 14:46:14 EDT
Created attachment 589244 [details]
sample ESB deployment

Description of problem: I am not able to create ESB deployment child


Version-Release number of selected component (if applicable):
JON 3.1.CR1+SOA-P 5.3.ER3

How reproducible:always


Steps to Reproduce:
1.import SOA-P server running in default profile
2.you must uncomment admin=admin line in soa-users.properties
3.create new deployment under ESB subsystem
  
Actual results: child creation fails

UI error:
java.lang.NullPointerException
	at org.jbosson.plugins.jbossesb.ESB5Component.createResource(ESB5Component.java:228)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:616)
	at org.rhq.core.pc.inventory.ResourceContainer$ComponentInvocationThread.call(ResourceContainer.java:634)
	at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
	at java.util.concurrent.FutureTask.run(FutureTask.java:166)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
	at java.lang.Thread.run(Thread.java:636)


Agent error:

2012-06-04 20:37:32,479 INFO  [ResourceFactory.executor-1] (rhq.core.pc.inventory.CreateResourceRunner)- Creating resource through report: CreateResourceReport: ResourceType=[{JBossESB5}Deployment], ResourceKey=[null]
2012-06-04 20:37:32,481 INFO  [ResourceFactory.executor-1] (rhq.core.pc.inventory.CreateResourceRunner)- Sending create response to server: CreateResourceResponse[RequestId=10112, Status=Failure]

Expected results:deployment is created


Additional info:
Comment 1 Mike Foley 2012-06-04 14:52:02 EDT
len or pavel .... comments on this?  can you repro?
Comment 2 Libor Zoubek 2012-06-04 15:35:35 EDT
Also .. Connection properties for 'JBoss ESB' subystem are incorrectly detected:
'JBoss Home Directory' and 'Configuration Path' are empty and marked as incorrect.
Comment 3 Pavel Kralik 2012-06-05 08:24:34 EDT
Created attachment 589516 [details]
JBoss ESB Connection settings error
Comment 4 Pavel Kralik 2012-06-05 09:10:05 EDT
Reproduced. JON 3.1.0.CR1 and SOA-P 5.3.0.ER3.

JBoss ESB Connection settings error
Manual ESB deployment with JON GUI failed.
I did not experienced java.lang.NullPointerException.
Comment 5 Pavel Kralik 2012-06-05 09:18:59 EDT
Created attachment 589529 [details]
JBoss ESB > Deployments > Connection settings error
Comment 6 Libor Zoubek 2012-06-05 09:44:32 EDT
I've just reproduced it on JON 3.1.CR2
Comment 7 tcunning 2012-06-05 13:36:12 EDT
Here's what's failing : 
                          Class remoteIClazz = classLoader.loadClass("org.rhq.plugins.jbossas5.deploy.PackageDownloader");

                          Class remoteDClazz = classLoader.loadClass("org.rhq.plugins.jbossas5.deploy.RemoteDownloader");
                          Constructor remoteDConstructor = remoteDClazz.getDeclaredConstructor(ResourceContext.class, boolean.class, ProfileServiceConnection.class);

                          Class clazz = classLoader.loadClass("org.rhq.plugins.jbossas5.deploy.ManagedComponentDeployer");
                          Constructor constructor = clazz.getDeclaredConstructor(ProfileServiceConnection.class, remoteIClazz);

In JON 3.0, the jbossas5 RemoteDeployer class was removed, which made us have to  try to load & execute its replacement (RemoteDownloader/ManagedComponentDeployer) because we need to maintain compatibility with the AS5 admin-console.   In JON 3.1 we're failing on the getDeclaredConstructor the ManagedComponentDeployer constructor.      My guess is that that class has changed between JON 3.0 and JON 3.1 and that is what is breaking us.

I'll take a look at what's changed there and see if we can patch the ESB plugin to go along with it.
Comment 8 Stefan Negrea 2012-06-05 17:39:24 EDT
Created a two argument constructor for backwards compatibility. The extra argument is not needed for the way the ESB plugin uses the content system code from the AS5 plugin. The extra constructor was marked as deprecated and is not used anywhere else in the RHQ code.
Comment 9 Stefan Negrea 2012-06-05 17:43:30 EDT
release/jon3.1.x branch commit:

http://git.fedorahosted.org/git/?p=rhq/rhq.git;a=commit;h=88560f71766cfa3e3c55150e7e485826df37946b
Comment 10 Charles Crouch 2012-06-05 23:14:44 EDT
As per Stefan's comment this should be fixed in JON31 CR3
Comment 11 John Sanda 2012-06-06 01:53:20 EDT
Moving to ON_QA since the CR3 build is available.
Comment 12 Libor Zoubek 2012-06-06 07:01:54 EDT
verified on JON 3.1.CR3
Comment 13 Mike Foley 2012-07-03 15:15:44 EDT
just documenting the root cause analysis on this BZ ...


Root Cause Analysis 

 BZ 828191 and 828464


Scope:
BRMS autodiscovery - https://bugzilla.redhat.com/show_bug.cgi?id=828191
ESB autodiscovery - https://bugzilla.redhat.com/show_bug.cgi?id=828464


GOALS:
Prevent regressions like this from even happening
Earlier detection

Details on the nature of these issues (provided by Tom Cunningham)

From Tom Cunningham
I've found the root cause of the first one (more details in bugzilla) - 
In JON 3.0, the jbossas5 RemoteDeployer class was removed, which made us 
have to try to load & execute its replacement in the event we got a 
ClassNotFoundException on RemoteDeployer.      We need to maintain 
compatibility with the AS5 admin-console, and we actually compile 
against the admin-console in our build, so we needed to insert some 
messy loadClass/getDeclaredConstructor/invoke stuff in the case of JON 3.

In JON 3.1, this is now failing :

                           Class clazz = 
classLoader.loadClass("org.rhq.plugins.jbossas5.deploy.ManagedComponentDeployer");
                          Constructor constructor = 
clazz.getDeclaredConstructor(ProfileServiceConnection.class, remoteIClazz);

my guess is that the method signature changed.     Charles - are there 
additional args we have to pass in?

The SOA-P plugin is extends the jbossas5 plugin.  The jbossas5 plugin changed (unexpectedly) which caused breakage in the SOA-P plugin.  




Details on the how these regressions occurred
(let's ask "why?" 5 5 times to understand the root cause)

 Why did the jbossas5 plugin change?  a deprecated method was removed  https://bugzilla.redhat.com/show_bug.cgi?id=828464  ( Created a two argument constructor for backwards compatibility. The extra argument is not needed for the way the ESB plugin uses the content system code from the AS5 plugin. The extra constructor was marked as deprecated and is not used anywhere else in the RHQ code.)   
why? The plugin was changed to address an issue found by Eiichi Nagai when QE'ing https://bugzilla.redhat.com/show_bug.cgi?id=646631
why? The change required a new parameter to be passed to one of the constructors in the jbossas5 plugin, adding this new parameter caused the issue. plugin is calling a non-public API
why?  no specific indicator that would prevent a plugin developer from making calls not to the public plugin API ... but to the internals 
why? plugin can extend other plugins see line #28  
why? trying to create a plugin that uses JON and EAP5 embedded console   ???? supposition





Details on why these regressions were not detected sooner

From Libor:  by accident, looking at another issue.  found this one.  

From Pavel:  https://bugzilla.redhat.com/show_bug.cgi?id=821904
    couldn't detect is sooner because plugin pack was broken ER4
it could only be detected after JON ER4  (bug was introduced in ER4)
it was a late regression that was detected quickly (having Brew builds earlier is NOT a valid countermeasure for this specific issue)


It was later in the dev cycle because the problem with https://bugzilla.redhat.com/show_bug.cgi?id=646631 was only discovered on 5/14. The fix was then done on 5/23.
ESB plugin is not built in the JON test suite  (clarifying question:  would that classz stuff have thrown a compile time error if the ESB plugin were built in the JON test suite? that looks to me like it would only get caught at runtime, not compile)  
The SOA-P/EDS regression automation deploys ESB archives by ANT and there was not covered a JON GUI manual deployment for the archives. The case will be added:https://issues.jboss.org/browse/JBQA-6484 
For the BRMS case there is a Drools application in GIT that is compiled with various BRMS deployable ZIP files, eg. http://jawa05.englab.brq.redhat.com/released/BRMS-5.2.0.GA/brms-p-5.2.0.GA-deployable.zip There was a problem with compilation and running the application that was solved with BRMS 5.3.0.ER6. Task: https://issues.jboss.org/browse/JBQA-6485
Information about new builds of JON 3.1.0 get a couple of days later after the release. I was testing ER4 build and there was ER5/ER6 already. I joined jboss-on mailing list to fix the problem.
why?  

why? 
why?




Possible Countermeasures to prevent these regressions and detect issues sooner


Document that describes the write way to create a plugin that is not susceptible to this type of breakage....+1+1 (this seems like an easy thing to do)
already exists
doesn't include comments "Do not make classloader statements to load explicit classes in the implementation (which could change)"
test automation that detected this failure pattern
already Plugin verifier that could be augmented - related to line 86
static analysis that explicitly looks for patterns like this ... such as FindBugs
write a plugin Check Tool that could be distributed to other plugin teams +1+1+1
If you want earlier warnings on things like this, we can change the ESB plugin to compile against current RHQ & jbossas5 and you can compile against your nightlies - which would catch an error like this.  (    However, since ESB & the ESB plugin won't be a part of SOA-P 6 (SwitchYard replaces it), I'm not sure how much effort it'll be worth.      
Search the ESB/BRMS plugins when obsoleting methods in jbossas5 plugin  (why are we not using the public API?  why are we referncing classes in the implementation?) -1 (we can't search through every possible plugin)
Adding the automation test casses to cover all variations of deployment ESB/VDB archives.
Integrate the BRMS/SOA-P/EDS integration reggression testing automation into JON team automation to: http://git.engineering.redhat.com/?p=users/jweiss/automatjon.git;a=summary similar to EAP6/7.   Sahi tests running in the JON QE integration test suite +1+1+1
Pavel ... is willing to do this ... needs advice on where to put his sources 
The SOA-P/EDS regression automation deploys ESB archives by ANT and there was not covered a JON GUI manual deployment for the archives. The case will be added:https://issues.jboss.org/browse/JBQA-6484 +1+1 <<<this seems like an obvious thing
:https://issues.jboss.org/browse/JBQA-6484 
https://issues.jboss.org/browse/JBQA-6485
Branching SOA plugin one for EAP and one for JON would allow both to be optimized which should enable some of the funky classloading to be avoided +1
JON team adding API change detection (e.g. animal-sniffer) to its build to help detect potentially breaking changes such as this +1
Ensure future plugin APIs are more locked down 
Have JON team review other teams plugins for usage of best practices (+1 related to line 80)

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