Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8177721

Improve diagnostics in sun.management.Agent#startAgent()

XMLWordPrintable

        In sun/management/jmxremote/ConnectorBootstrap.java, in exportMBeanServer(), we wrap IOException in AgentConfigurationError:

                catch(IOException ioexception)
                {
                    if(jmxconnectorserver == null)
                        throw new
        AgentConfigurationError("agent.err.connector.server.io.error", ioexception,
        new String[] {
                            jmxserviceurl.toString()
                        });


        But in the Agent.java this exception is caught and the wrapped exception is
        ignored:

                    if (jmxremote != null || jmxremotePort != null) {
        259 if (jmxremotePort != null) {
        260 jmxServer = ConnectorBootstrap.
        261 startRemoteConnectorServer(jmxremotePort, props);
        262 startDiscoveryService(props);
        263 }
        264 startLocalManagementAgent();
        265 }
        266
        267 } catch (AgentConfigurationError e) {
        268 error(e.getError(), e.getParams()); <--this just prints the
        error message and not the stack trace and ignores the wrapped exception
        269 } catch (Exception e) {
        270 error(e);
        271 }

        We should fix this code to print information about the original exception as
        well.

        With the current code, what the user sees is the following message without the i/o error that caused this failure:

        Error: JMX connector server communication error:
        service:jmx:rmi://us2z24-emcs-nvm-ita-loader1.emcs.z24.usdc2.oraclecloud.com

              shshahma Shafi Ahmad (Inactive)
              poonam Poonam Bajaj Parhar
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Created:
                Updated:
                Resolved: