camel-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mart Kartašev (JIRA) <>
Subject [jira] [Commented] (CAMEL-11623) LevelDB Java implementation wont be tried on Errors
Date Wed, 02 Aug 2017 10:44:00 GMT


Mart Kartašev commented on CAMEL-11623:

I assume this problem would be present in the 2.17.x, 2.18.x and 2.20.x branches as well,
but they have not actually been released yet, so I am not sure how to mark the affects versions
(see 11427 in regards to wrong version in Jira)

> LevelDB Java implementation wont be tried on Errors
> ---------------------------------------------------
>                 Key: CAMEL-11623
>                 URL:
>             Project: Camel
>          Issue Type: Bug
>          Components: camel-leveldb
>    Affects Versions: 2.19.2
>            Reporter: Mart Kartašev
>             Fix For: 2.20.0, 2.19.3
> For a bit of background, we have been running into a problem with the LevelDB JNI drivers
for AggregationRepositories, which prevents startup when using routes for which we require
persistent aggregation. This, however, is not the main topic of this issue.
> In the latest version (2.19.2) the following issue has implemented a Java specific leveldb
> The relevant part of the Error on startup is as follows: 
> java.lang.UnsatisfiedLinkError: Could not load library. Reasons: [no leveldbjni64-1.8
in java.library.path, no leveldbjni-1.8 in java.library.path, no leveldbjni in java.library.path,
C:\Users\atos\AppData\Local\Temp\leveldbjni-64-1-794362262645531032.8: Can't find dependent
> at org.fusesource.hawtjni.runtime.Library.doLoad( 
> at org.fusesource.hawtjni.runtime.Library.load( 
> at org.fusesource.leveldbjni.JniDBFactory.( 
> at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) 
> at sun.reflect.NativeConstructorAccessorImpl.newInstance(

> at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(

> at java.lang.reflect.Constructor.newInstance( 
> at java.lang.Class.newInstance( 
> at org.apache.camel.component.leveldb.LevelDBFile.getFactory( 
> at org.apache.camel.component.leveldb.LevelDBFile.start( 
> The way that I understand the code added in issue 11427, is that the LevelDBFile class
getFactory() method (line 181) will first try to initiate with the JNI drivers and if that
fails, will turn to the pure Java implementation. This is done by catching an Exception which
is then ignored incase the JNI driver fails.
> However, when we look at the code we see that UnstatisfiedLinkError does not extend Exception,
it extends Error.
> This Error is therefore not caught by the application and thus the Java implementation
for LevelDB is never even attempted to be initialized as the method execution ends exceptionally
at that point.
> So the main two questions are: 
> 1) Was the code intended to catch this UnsatisfiedLinkageError (I know Errors are often
considered a bad thing to catch) as a means to substitute the JNI driver, incase it fails?
> 2) If it is not supposed to catch this error, how can I use the pure Java implementation
in this case? I expect that trying to exclude relevant packages also wont work as it will
directly try to initiate the the JNI implementation by its name, which would fail also with
an Error.
> So, in summary:
> Is line 194 in class LevelDBFile in the camel-leveldb component supposed to catch an
Error or more generally a Throwable instead of Exception?

This message was sent by Atlassian JIRA

View raw message