Reputation: 259
On Camel 2.10.1, the following worked:
<camel:bean ref="profilingBean" method="addProfilingContext('TEST')"/>
The method in question takes a String parameter
Migrating to 2.10.6 , this does not work anymore, it tries to call TEST as another class. I have tried wrapping with ${} , trying to use exotic combinations of "& quot;" etc...
The only solution I found was to put the value in a header using constant language then call the header using simple. Obviously, this isn't very clean...
Do you have any ideas how to do this?
Cheers
Upvotes: 2
Views: 4657
Reputation: 41
The behavior/bug still exists in Camel 2.16
and also in latest 2.18.2
.
For every string constant that is passed to a bean via Spring DSL a java.lang.ClassNotFoundException
is thrown.
It gets more visible by setting logger for org.apache.camel.util.ObjectHelper
to TRACE
.
This camel behavior also has serious negative performance impact because ClassLoader
method (java.lang.ClassLoader.loadClass
) is synchronized for a given parameter name.
I wrote a little demo to show this: https://github.com/groundhog2k/camel-dsl-bean-bug
Upvotes: 4
Reputation: 55535
Your solution with the header is fine. The bug you talk about should be fixed in 2.10.7, or 2.11.1 etc.
Upvotes: 1