[
https://issues.apache.org/jira/browse/CAMEL-14190?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16977309#comment-16977309
]
Constantino Cronemberger commented on CAMEL-14190:
--------------------------------------------------
I'm trying to use camel-jms-starter and have the ConnectionFactory
automatically set.
I first made camel-jms work specifying the connection factory as an URI
parameter (jms:queue:my-queue?connectionFactory=#myConnectionFactory). After
that my next step was to start using camel-jms-starter so I could get rid of
the connectionFactory parameter in all URIs. So I replaced camel-jms by
camel-jms-starter in the pom and removed the URI parameter and added the
following line in the application.properties:
camel.component.jms.connection-factory=#myConnectionFactory
Then I found that the # notation does not work in this case and finally I
found (by checking the code) that I should not even need to set the connection
factory because it should be automatically set if a connection factory bean is
found in the application context. Then while debugging it I found that by the
first time the getConfiguration method is called the attribute
applicationContext is null, so the a configuration is created without the
existing connection factory set on it.
More information about the problem with # can be found in my last comment in
issue CAMEL-12956. There you can find the steps to reproduce it.
> JMSComponent tries to use applicationContext before it is initialised
> ---------------------------------------------------------------------
>
> Key: CAMEL-14190
> URL: https://issues.apache.org/jira/browse/CAMEL-14190
> Project: Camel
> Issue Type: Bug
> Components: camel-jms
> Affects Versions: 3.0.0.RC3
> Reporter: Constantino Cronemberger
> Priority: Minor
>
> The method getConfiguration checks if applicationContext is null. If not it
> will try to automatically initialise the ConnectionFactory and the
> DestinationResolver.
> The problem is that applicationContext will always be null when used with
> JmsComponentAutoConfiguration (or the corresponding classes in other similar
> starters) because the method setApplicationContext is called only after the
> method that creates the bean returns and because the auto configuration class
> also calls CamelPropertiesHelper.setCamelProperties which in turn calls
> getConfiguration.
>
--
This message was sent by Atlassian Jira
(v8.3.4#803005)