[
https://issues.apache.org/jira/browse/CAMEL-15076?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Claus Ibsen resolved CAMEL-15076.
---------------------------------
Resolution: Fixed
> Rest OpenAPI component NPE when using components bound to the registry
> ----------------------------------------------------------------------
>
> Key: CAMEL-15076
> URL: https://issues.apache.org/jira/browse/CAMEL-15076
> Project: Camel
> Issue Type: Improvement
> Reporter: James Netherton
> Assignee: Claus Ibsen
> Priority: Minor
> Fix For: 3.4.0
>
>
> Not sure if this is a genuine issue or my misunderstanding of how things are
> supposed to work. I was experimenting with camel-rest-openapi and had a
> little problem.
> The docs state that REST capable components can be discovered from the
> registry. Is the expectation from users that the components are initialised
> in some way before they are bound to the registry?
> E.g if I do this:
> {code:java}
> NettyHttpComponent component = new NettyHttpComponent();
> camelContext.getRegistry().bind("netty-http", component);
> {code}
> Then I eventually end up hitting an NPE because NettyHttpComponent does the
> following in {{createProducer}}, and {{getCamelContext()}} returns null:
> {code:java}
> RestConfiguration config =
> CamelContextHelper.getRestConfiguration(getCamelContext(), "netty-http");
> {code}
> It's easily fixed by doing {{setCamelContext}} on the component before
> binding it to the registry. But, do we expect users to do this themselves? Or
> should camel take care of doing this after it has discovered the component in
> the registry (E.g after
> [this|https://github.com/apache/camel/blob/master/components/camel-rest/src/main/java/org/apache/camel/component/rest/RestEndpoint.java#L346])?
--
This message was sent by Atlassian Jira
(v8.3.4#803005)