Skip to content

Unable to access serialized exception with java-client #85

Description

@marosmars

We would like to utilize the "serializeException" option to access thrown exceptions. The problem is that we are unable to access serialized exception with java client included in jolokia.

When we query jolokia directly e.g.

curl http://<host>/jolokia/write/<object-name>/<variable>/<value>?serializeException=true

and an exception is thrown, the exception is serialized under "error_value" field. This is what we expect, but when we query jolokia with its java client e.g.

J4pClient j4pClient = new J4pClient(url);
J4pRequest pRequest = ...;
try {
    Map<J4pQueryParameter, String> pProcessingOptions = Maps.newHashMap();
    pProcessingOptions.put(J4pQueryParameter.SERIALIZE_EXCEPTION, "true");
    pProcessingOptions.put(J4pQueryParameter.INCLUDE_STACKTRACE, "false");
    return j4pClient.execute(pRequest, "POST", pProcessingOptions);
} catch (J4pRemoteException e) {
        // How to access error_value via J4pRemoteException 
}

We are unable to access serialized exception in the catch block via J4pRemoteException. J4pRemoteException does not include any functionality related to "error_value" field neither does processing of json response in org.jolokia.client.J4pClient (method: private J4pRemoteException validate(T pRequest, JSONObject pJsonRespObject)).

We would like the J4pRemoteException to provide either the whole json response object it was created from or just the "error_value" field as string so we can rebuild/rethrow the original exception .

If you agree and decide to provide this functionality, we are willing to implement it.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions