You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by scrutari <yu...@gmail.com> on 2012/09/25 08:07:48 UTC

OSGi (Felix) + Camel + logback interaction issue

Dear colleagues!

In brief: we are experiencing problems with Felix 4.0.2 + Camel 2.9.2 +
logback 1.0.7 interaction which can be fixed by migrating to the version of
Camel to 2.9.3. But in this case the exception handling designed in Camel
XML configuration via <camel:doTry /> and <camel:doCatch /> fails and misses
any exception occurred within <camel:doTry />. Find the details bellow.

Our team uses several Apache technologies (Felix 4.0.2 and Camel 2.9.2)
along with logback 1.0.7.
The issue raised when we developed a custom logback appender as an OSGi
bundle fragment: during start of OSGi framework we are getting and error
message during activating bundle "camel-core":

org.osgi.framework.BundleException: Activator start error in bundle
org.apache.camel.camel-core [43].
        at org.apache.felix.framework.Felix.activateBundle(Felix.java:2027)
        at org.apache.felix.framework.Felix.startBundle(Felix.java:1895)
        at org.apache.felix.framework.BundleImpl.start(BundleImpl.java:944)
        at org.apache.felix.framework.BundleImpl.start(BundleImpl.java:931)

The cause of this exception is NPE:

Caused by: java.lang.NullPointerException
        at
org.apache.felix.framework.BundleWiringImpl.findClassOrResourceByDelegation(BundleWiringImpl.java:1432)
        at
org.apache.felix.framework.BundleWiringImpl.access$400(BundleWiringImpl.java:72)
        at
org.apache.felix.framework.BundleWiringImpl$BundleClassLoader.loadClass(BundleWiringImpl.java:1843)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
        at
ch.qos.logback.classic.LoggerContext.getLogger(LoggerContext.java:142)
        at
ch.qos.logback.classic.LoggerContext.getLogger(LoggerContext.java:49)
        at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:270)
        at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:281)
        at org.apache.camel.impl.osgi.Activator.<clinit>(Activator.java:78)
        ... 24 more

Our analysis on suggests that there are some incompatibility between logback
dependencies of our bundles and Camel core. So we tried to migrate to a
newer version of Camel: 2.9.3. It fixed this problem and raised another
issue which totally crashes exception handling by means of Camel.

This config doesn't work for Camel 2.9.3 (neither it does for 2.10.1):

<camel:doTry>
  <camel:to uri="bean:beanOne?method=methodOne"/>
  <camel:to uri="bean:beanTwo?method=methodTwo"/>
  <camel:recipientList>
    <camel:simple>direct:${in.header.customTrigger}</camel:simple>
  </camel:recipientList>
  <camel:to uri="bean:beanThree?method=methodThree"/>
  <camel:doCatch>
    <camel:exception>java.lang.Throwable</camel:exception>
    <camel:to uri="direct:handleGeneralError"/>
  </camel:doCatch>
</camel:doTry>

Whatever exception is raised in the described beans and methods the
"direct:handleGeneralError" endpoint is never invoked.

The combinations of such issues looks rather strange. So, I guess our team
has to ask a piece of your advice or any ideas.

Thank you very much!

Yours faithfully,
Yuri.




--
View this message in context: http://camel.465427.n5.nabble.com/OSGi-Felix-Camel-logback-interaction-issue-tp5719906.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: OSGi (Felix) + Camel + logback interaction issue

Posted by scrutari <yu...@gmail.com>.
After several tests we have figured out the cause of issues involving NPEs.
In general within this problem we deal with three bundles: camel-core,
logback-classic and our custom bundle that contains custom logback appender.
The described problem occurs when the bundles are installed via different
types of URLs. When we hold camel-core and logback-classic inside WAR (and
access via "jndi:/") and our custom - in specific directory (it is accessed
via "file:/") - the NPEs rises very often during start-up and bundle
resolution process. But when all bundles are kept inside same place (all in
WAR or all in a directory) - everything works fine. That is the reason for
exceptions at start-up.

However, our results do not explain why <camel:doTry /> and <camel:doCatch
/> stopped working - this must be a bug in Camel 2.9.3+.



-----
----
Yours faithfully,
Yuri.
--
View this message in context: http://camel.465427.n5.nabble.com/OSGi-Felix-Camel-logback-interaction-issue-tp5719906p5720295.html
Sent from the Camel - Users mailing list archive at Nabble.com.