Jörg Jansen created CAMEL-16225:
-----------------------------------

             Summary: route-list command fail with NPE
                 Key: CAMEL-16225
                 URL: https://issues.apache.org/jira/browse/CAMEL-16225
             Project: Camel
          Issue Type: Bug
          Components: camel-core
    Affects Versions: 3.8.0, 3.7.2, 3.7.1, 3.7.0
            Reporter: Jörg Jansen


I'm running apache-camel within a apache-karaf container.
Now I recognized the problem, that the route-list command failed, with
the following scenario:

I have route configured where bundle1 reads the data from a file and
forwards the content to a route of bundle 2, using a *VmEndpoint*.

After startup the route-list command works fine, but as soon as an
incoming message has been processed, the command failed with a
NullPointerException.

I think the problem is located in the DefaultManagementObjectNameStrategy.
Here I can see, the in method getObjectNameForRoute(..)
The camelContext is picked from the Endpoint.
Is there a special reason, why it is not read from the provided route directly?

 
{code:java}
@Override
public ObjectName getObjectNameForRoute(org.apache.camel.Route route) throws 
MalformedObjectNameException {
    Endpoint ep = route.getEndpoint();
    String id = route.getId();

    StringBuilder buffer = new StringBuilder();
    buffer.append(domainName).append(":");
    buffer.append(KEY_CONTEXT + 
"=").append(getContextId(ep.getCamelContext())).append(",");
    buffer.append(KEY_TYPE + "=" + TYPE_ROUTE + ",");
    buffer.append(KEY_NAME + "=").append(ObjectName.quote(id));
    return createObjectName(buffer);
} {code}


As in my test-case the context of the endpoint and route differ, this
seems to be the reason, why the JMX-object could not be resolved.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to