Apache Camel 3.1.0 Logging Issue - apache-camel

While I was porting Apache Camel Version from 2.x to 3.1.0 with Camel REST DSL and Spring Boot, I am facing the below logging issue.
My logging key is defined in application.properties i,e mymessage=Hello World.
Inside route when I am using it as
.log(LoggingLevel.INFO, "${properties:mymessage}") [Works in both 2.x and 3.1.0]
.log(LoggingLevel.INFO, "{{mymessage}}") [Works only in 2.x]
My problem is I have lots of logging statements using {{xxx}} which is unfortunately not working during 3.1.0 upgrading process.
Am I missing any specific setting.
I tried using #PropertySource by putting the key in the separate file also tried it with spring cloud config nothing works.
Any help would be highly appreciated.

This has been solved and will be part of 3.2.0, see https://issues.apache.org/jira/browse/CAMEL-14651

Related

JAXB ClassNotFoundException com.sun.xml.bind.v2.ContextFactory when hot-deploying camel routes

Yes I know, there are numerous questions and answers since JAXB was removed from JDK 11. But this one is specific.
I've a Wildfly Server (tested with 18.0.1 and 16.0.0) running with the wildfly-camel subsystem 11.0.1 patch applied. The patch installs Camel 2.25.0
Deploying and Hot-Deploying (while the server is up) Camel routes works fine!
Until I deploy Liferay on the same server :-(
Then the Hot-Deploy of a camel route gives me the annoying
[java.lang.ClassNotFoundException: com.sun.xml.bind.v2.ContextFactory from [Module "org.apache.camel.spring" version 2.25.0...
exeption.
No matter if I run the server on JDK 11 or JDK 8! Liferay 7.3.2 claims to be runnable on both JDK versions so I guess it has something to with the way Liferay was build.
Reading this article
http://www.descher.at/descher-vu/2019/01/java-11-jaxb-and-osgi/
that the JAXB topic is very complex and far from being resolved.
Question:
How can a deployed application destroy otherwise working classpath resolutions?
And more important:
How to fix it?
I tried removing the 2 jars in question jaxb-api.jar and jaxb-impl.jar from Liferay. But that didn't help.
Turns out that the root cause of the error is a missing dependency to com.sun.xml.bind in the org.apache.camel.spring module of the wildfly-camel patch.
I filed the issue in detail.
Looks like Liferay has nothing to do with it. Because in theory jboss-modules should separate the deployments.

camel blueprint force usage of log4j

Has anyone been able to use camel-blueprint together with logback? It seems that there are dependencies in camel blueprint which forces you to use log4j even though the log4j dependencies are removed from the pom. After running the project it starts to download the slf4j-log4j12 and then then complains of multiple bindings because it finds both log4j and logback.
I did the same with a camel java project and it worked fine to switch to logback. Does camel-blueprint force you to use log4j as its logging implementation?
Answer found via nabble forum in through discussion with the camel community. For more details go here:
http://camel.465427.n5.nabble.com/camel-blueprint-force-usage-of-log4j-td5772826.html#a5772852
Essentially there are certain dependencies in the maven plugin which uses log4j. For production in JBoss Fuse or Karaf, its Pax logging.

Including camel-test-spring causes NoClassDefFoundError for DefaultParameterNameDiscoverer

I have a Camel project using Maven to build and manage dependencies. My project depends on Camel component versions 2.14.0. I've matched Spring dependencies with Camel and use Spring component versions 3.2.11.RELEASE. However, if I include camel-test-spring version 2.14.0 as a dependency in the test scope it pulls in both spring-beans version 4.0.7.RELEASE and spring-expression 4.0.7.RELEASE into the runtime scope, which result is my application throwing java.lang.NoClassDefFoundError: org/springframework/core/DefaultParameterNameDiscoverer. Oh, btw, the application boots from a Java main method with org.apache.camel.spring.Main.
Adding exclusions for both spring-beans and spring-expression into the POM dependency for camel-test-spring resolves the runtime exception but I'm not sure if this is the right thing to do. Does anyone have more insight into why camel-test-spring 2.14.0 depends on the 4.0.7.RELEASE versions of spring-beans and spring-expression when most (all?) the other Camel 2.14.0 components seem to depend on 3.2.11.RELEASE versions of Spring components?
Regards,
Matt
Please you camel-test-spring3 which support Spring 3.x instead of camel-test-spring (for Spring 4.0.x).

NoSuchMethodError for errorHandler when deploying into ServiceMix

I have a servicemix module, which is basicly a camel based route.
It works fine during development and also when deploying in older version of FUSE. However, when deploying in a later version of FUSE, I get
Caused by: java.lang.NoSuchMethodError:
com.company.integration.MyRouteBuilder.errorHandler(Lorg/apache/camel/builder/ErrorHandlerBuilder;)Lorg/apache/camel/builder/RouteBuilder;
I do not quite get why :-)
The old version used camel 2.6, the new uses Camel 2.9. Both have RouteBuilder.errorHandler as far as i can tell..
br
I wouldn't spend too much time trying to figure that out myself...I'd just start testing with the same version of Camel that I'm going to deploy it under...otherwise even if you get around this issue, others will likely pop up, etc.
If you do have a requirement to run multiple apps that depend on different versions of Camel, then OSGi supports this as long as install the necessary camel bundle versions and setup your applicaiton bundle manifests correctly, etc.
Reinstalling (or rather, recreating the instance) helped.

Issue with Apache camel 2.4 version

This is an issue when I change the camel version from 1.6 to 2.4.
I wanted to use a method userOriginaLmessage which was not supported in 1.6. Hence I starte using camel 2.4 version. The code is getting compiled. But when I deploy it in Fuse ESB environment I get below error.
Unexpected exception parsing XML document from class path resource [camel-route.xml]; nested exception is java.lang.VerifyError:
Can you please help me on this ? What can be the issue.
Thanks in advance for the help.
Is there any more error message showing up than what you posted? Seems a bit lacking in information :)
There were a ton of changes from 1.6 to 2.4. You should take a look at the Camel 1.x -> 2.x migration guide if you have not done so already:
http://fusesource.com/docs/router/2.2/migration/index.html

Resources