hawtio / hawtio-next

Next generation Hawtio UI console
https://hawt.io
Apache License 2.0
7 stars 22 forks source link

Connecting to an app running with jolokia javaagent causes jolokia rejections #350

Closed phantomjinx closed 1 year ago

phantomjinx commented 1 year ago

When a target app is configured to execute using the jolokia-jvm agent (see here), connecting to it fails.

  1. Run up the example app using its start.sh script;
  2. Run up this client using yarn start;
  3. Create a connection to the target app with a connection url of http://localhost:8778/jolokia;
  4. Click .

The spinner remains visible and the following error appears in the console:

[hawtio-util] Operation unknown failed due to: java.lang.IllegalArgumentException : No MBean 'hawtio:type=security,name=RBACRegistry' found

This is caused by the function checkListOptimisation() which rejects and errors out.

By commenting out this check, the JMX tree is displayed but a whole range of errors are thrown from buildRequest:

[hawtio-util] Operation canInvoke(java.lang.String) failed due to: javax.management.InstanceNotFoundException : *:*

This will require fixing before implementing hawtio-online since java apps (example ones anyway) are implemented with jolokia in this way, eg. the Red Hat Fuse 7.11 Camel with Spring Boot 2 template on Openshift.

phantomjinx commented 1 year ago

@tadayosi Appreciate any thoughts you may have on this.

tadayosi commented 1 year ago

@phantomjinx I wonder if the old hawtio has the same issue or not.

Talking about checkListOptimisation(), it seems that this is another case of not having reject when invoking Jolokia, thus entering infinite awaiting: https://github.com/hawtio/hawtio-next/blob/main/packages/hawtio/src/plugins/connect/jolokia-service.ts#L296-L312 I think we need to invoke reject when we receive error at jolokia list. Absense of RBACRegistry is expected, so we should handle such case gently.

phantomjinx commented 1 year ago

PR -> https://github.com/hawtio/hawtio-next/pull/357