Oak and Mongo

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

Oak and Mongo

Ron Wheeler
Does Oak work with the latest version (3.4.2) of MongoDB?


I could not get the code on
http://jackrabbit.apache.org/oak/docs/construct.html to work.

getDB("test2")

is flagged as deprecated.

The

Exception in thread "main" java.lang.IllegalAccessError: tried to access
class org.apache.jackrabbit.stats.TimeSeriesAverage from class
org.apache.jackrabbit.oak.plugins.blob.BlobStoreStats
     at
org.apache.jackrabbit.oak.plugins.blob.BlobStoreStats.getAvgTimeSeries(BlobStoreStats.java:200)
     at
org.apache.jackrabbit.oak.plugins.blob.BlobStoreStats.<init>(BlobStoreStats.java:75)
     at
org.apache.jackrabbit.oak.plugins.document.DocumentMK$Builder.configureBlobStore(DocumentMK.java:1296)
     at
org.apache.jackrabbit.oak.plugins.document.DocumentMK$Builder.setBlobStore(DocumentMK.java:669)
     at
org.apache.jackrabbit.oak.plugins.document.DocumentMK$Builder.setMongoDB(DocumentMK.java:663)
     at
org.apache.jackrabbit.oak.plugins.document.DocumentMK$Builder.setMongoDB(DocumentMK.java:634)
     at
org.apache.jackrabbit.oak.plugins.document.DocumentMK$Builder.setMongoDB(DocumentMK.java:684)
     at
com.artifact_software.communication.InitiateDatabase.getNodeStore(InitiateDatabase.java:109)
     at
com.artifact_software.communication.InitiateDatabase.main(InitiateDatabase.java:29)

I have broken the example down into smaller chunks that should do the
same thing as the code in the example and this is the function that fails

     private static DocumentNodeStore getNodeStore(){
         DB db = new MongoClient("127.0.0.1", 27017).getDB("test2");
             DocumentNodeStore ns = new DocumentMK.Builder().
                     setMongoDB(db).getNodeStore();
             return ns;
     }


--
Ron Wheeler
President
Artifact Software Inc
email: [hidden email]
skype: ronaldmwheeler
phone: 866-970-2435, ext 102

Reply | Threaded
Open this post in threaded view
|

Re: Oak and Mongo

Clay Ferguson
I am using the latest stable spring boot, which provides some version of
appropriate mongodb version, and also i just upgraded to latest stable
Jackrabbit:

All versions can be gleaned from this:

https://github.com/Clay-Ferguson/meta64/blob/master/pom.xml

BTW: The reason I love spring-boot is that one of it's primary purposes is
to let you start with a 'known stack' of versions of things that work well
together.


Best regards,
Clay Ferguson
[hidden email]


On Mon, May 22, 2017 at 8:44 AM, Ron Wheeler <[hidden email]
> wrote:

> Does Oak work with the latest version (3.4.2) of MongoDB?
>
>
> I could not get the code on http://jackrabbit.apache.org/o
> ak/docs/construct.html to work.
>
> getDB("test2")
>
> is flagged as deprecated.
>
> The
>
> Exception in thread "main" java.lang.IllegalAccessError: tried to access
> class org.apache.jackrabbit.stats.TimeSeriesAverage from class
> org.apache.jackrabbit.oak.plugins.blob.BlobStoreStats
>     at org.apache.jackrabbit.oak.plugins.blob.BlobStoreStats.getAvg
> TimeSeries(BlobStoreStats.java:200)
>     at org.apache.jackrabbit.oak.plugins.blob.BlobStoreStats.<init>
> (BlobStoreStats.java:75)
>     at org.apache.jackrabbit.oak.plugins.document.DocumentMK$Builde
> r.configureBlobStore(DocumentMK.java:1296)
>     at org.apache.jackrabbit.oak.plugins.document.DocumentMK$Builde
> r.setBlobStore(DocumentMK.java:669)
>     at org.apache.jackrabbit.oak.plugins.document.DocumentMK$Builde
> r.setMongoDB(DocumentMK.java:663)
>     at org.apache.jackrabbit.oak.plugins.document.DocumentMK$Builde
> r.setMongoDB(DocumentMK.java:634)
>     at org.apache.jackrabbit.oak.plugins.document.DocumentMK$Builde
> r.setMongoDB(DocumentMK.java:684)
>     at com.artifact_software.communication.InitiateDatabase.
> getNodeStore(InitiateDatabase.java:109)
>     at com.artifact_software.communication.InitiateDatabase.main(In
> itiateDatabase.java:29)
>
> I have broken the example down into smaller chunks that should do the same
> thing as the code in the example and this is the function that fails
>
>     private static DocumentNodeStore getNodeStore(){
>         DB db = new MongoClient("127.0.0.1", 27017).getDB("test2");
>             DocumentNodeStore ns = new DocumentMK.Builder().
>                     setMongoDB(db).getNodeStore();
>             return ns;
>     }
>
>
> --
> Ron Wheeler
> President
> Artifact Software Inc
> email: [hidden email]
> skype: ronaldmwheeler
> phone: 866-970-2435, ext 102
>
>
Reply | Threaded
Open this post in threaded view
|

Re: Oak and Mongo

chetan mehrotra
In reply to this post by Ron Wheeler
On Mon, May 22, 2017 at 7:14 PM, Ron Wheeler
<[hidden email]> wrote:
> Exception in thread "main" java.lang.IllegalAccessError: tried to access
> class org.apache.jackrabbit.stats.TimeSeriesAverage from class
> org.apache.jackrabbit.oak.plugins.blob.BlobStoreStats
>     at
> org.apache.jackrabbit.oak.plugins.blob.BlobStoreStats.getAvgTimeSeries(BlobStoreStats.java:200)

Looks like some dependency version conflict issue. Whats the version
of jackrabbit-jcr-commons in your classpath? The TimeSeriesAverage was
made public with JCR-3855 long time back. So unless you are using a
version < 2.10 you should not be getting this error

Chetan Mehrotra
Reply | Threaded
Open this post in threaded view
|

Re: Oak and Mongo

Clay Ferguson
​The most common reason for wrong/unexpected version of a class to get used
at runtime arises from the fact that Java at runtime will simply scan the
classpath and grab the first class name that matches when searching for
classes. So what can happen is that even if you specify the right
dependency version some OTHER dependency (I'm assuming Maven, as the
example)​ may load some OTHER version of something. The way to troubleshoot
and see if this is happening is use the maven command line option for
generating the depencency graph/tree and view that and see where the other
unwanted version is getting pulled in from, and then to fix it (not ALWAYS
possible) is to do an exclude of the improper version and then hope that
doesn't choke the JAR/dep that pulled in the wrong version to begin with.
This is a nasty problem, and is the reason that springboot exists and to
some extent why OSGi exists. The single classpath is a limitation of Java.

Best regards,
Clay Ferguson
[hidden email]


On Mon, May 22, 2017 at 10:59 PM, Chetan Mehrotra <[hidden email]
> wrote:

> On Mon, May 22, 2017 at 7:14 PM, Ron Wheeler
> <[hidden email]> wrote:
> > Exception in thread "main" java.lang.IllegalAccessError: tried to access
> > class org.apache.jackrabbit.stats.TimeSeriesAverage from class
> > org.apache.jackrabbit.oak.plugins.blob.BlobStoreStats
> >     at
> > org.apache.jackrabbit.oak.plugins.blob.BlobStoreStats.getAvgTimeSeries(
> BlobStoreStats.java:200)
>
> Looks like some dependency version conflict issue. Whats the version
> of jackrabbit-jcr-commons in your classpath? The TimeSeriesAverage was
> made public with JCR-3855 long time back. So unless you are using a
> version < 2.10 you should not be getting this error
>
> Chetan Mehrotra
>
Reply | Threaded
Open this post in threaded view
|

Re: Oak and Mongo

Ron Wheeler
In reply to this post by chetan mehrotra
That was exactly the problem.
I missed a hard-coded version on one dependency in Maven that did not
match with the <oakVersion> property setting that controlled the rest of
the Oak dependencies.

Thank you very much.

Ron

On 22/05/2017 11:59 PM, Chetan Mehrotra wrote:

> On Mon, May 22, 2017 at 7:14 PM, Ron Wheeler
> <[hidden email]> wrote:
>> Exception in thread "main" java.lang.IllegalAccessError: tried to access
>> class org.apache.jackrabbit.stats.TimeSeriesAverage from class
>> org.apache.jackrabbit.oak.plugins.blob.BlobStoreStats
>>      at
>> org.apache.jackrabbit.oak.plugins.blob.BlobStoreStats.getAvgTimeSeries(BlobStoreStats.java:200)
> Looks like some dependency version conflict issue. Whats the version
> of jackrabbit-jcr-commons in your classpath? The TimeSeriesAverage was
> made public with JCR-3855 long time back. So unless you are using a
> version < 2.10 you should not be getting this error
>
> Chetan Mehrotra
>

--
Ron Wheeler
President
Artifact Software Inc
email: [hidden email]
skype: ronaldmwheeler
phone: 866-970-2435, ext 102