3

Goal: Run Apache Sling with Apache Oak as the JCR provider with MongoDB as the backing datastore.

Steps Thus far: installed MongoDB (3.0.2) and verified up and running cloned : https://github.com/apache/sling.git built using maven: mvn clean install run locally using the:

java -jar target/org.apache.sling.launchpad-*.jar -c test -f -

This works well, but now I would like to switch out to use Apache Oak with MongoDB. The Launchpad App documentation seems to describe the possibility of just doing something like:

java -jar target/org.apache.sling.launchpad-*.jar -Dsling.run.modes=oak,oak_mongo

However, when I do that, I do not see any connections made to the running Mongo instance.

Reviewed Documentation Thus far:

Enter the launchpad/builder directory and launch Sling for the first time

$ cd launchpad/builder 
$ java -jar target/org.apache.sling.launchpad-*.jar -c test -f -

Update: 05/19/2015

As Robert has suggested, I have started a 2.6.8 instance of Mongo and tried to starting Sling to see if there are any connections being made: (the connections that do appear in the Mongo logs are from connecting with RoboMongo and not Sling, as far as I can tell. Browsing to http://localhost:8080/.explorer.html# , doesn't trigger any output in the Mongo logs)

Mongo Terminal Logs

/usr/local/Cellar/mongodb/2.6.8/bin [master]
± % ./mongod                                                                                 !1778
./mongod --help for help and startup options
2015-05-19T13:51:27.831-0500 [initandlisten] MongoDB starting : pid=42458 port=27017 dbpath=/data/db 64-bit host=Davids-MacBook-Pro-3.local
2015-05-19T13:51:27.831-0500 [initandlisten]
2015-05-19T13:51:27.831-0500 [initandlisten] ** WARNING: soft rlimits too low. Number of files is 256, should be at least 1000
2015-05-19T13:51:27.831-0500 [initandlisten] db version v2.6.8
2015-05-19T13:51:27.831-0500 [initandlisten] git version: nogitversion
2015-05-19T13:51:27.831-0500 [initandlisten] build info: Darwin miniyosemite.local 14.1.0 Darwin Kernel Version 14.1.0: Mon Dec 22 23:10:38 PST 2014; root:xnu-2782.10.72~2/RELEASE_X86_64 x86_64 BOOST_LIB_VERSION=1_49
2015-05-19T13:51:27.831-0500 [initandlisten] allocator: tcmalloc
2015-05-19T13:51:27.831-0500 [initandlisten] options: {}
2015-05-19T13:51:27.836-0500 [initandlisten] journal dir=/data/db/journal
2015-05-19T13:51:27.836-0500 [initandlisten] recover : no journal files present, no recovery needed
2015-05-19T13:51:28.294-0500 [initandlisten] waiting for connections on port 27017
2015-05-19T13:52:28.338-0500 [clientcursormon] mem (MB) res:97 virt:3295
2015-05-19T13:52:28.338-0500 [clientcursormon]  mapped (incl journal view):800
2015-05-19T13:52:28.338-0500 [clientcursormon]  connections:0
2015-05-19T13:57:28.529-0500 [clientcursormon] mem (MB) res:97 virt:3295
2015-05-19T13:57:28.529-0500 [clientcursormon]  mapped (incl journal view):800
2015-05-19T13:57:28.529-0500 [clientcursormon]  connections:0
2015-05-19T14:02:28.710-0500 [clientcursormon] mem (MB) res:97 virt:3295
2015-05-19T14:02:28.710-0500 [clientcursormon]  mapped (incl journal view):800
2015-05-19T14:02:28.710-0500 [clientcursormon]  connections:0
2015-05-19T14:07:28.899-0500 [clientcursormon] mem (MB) res:97 virt:3295
2015-05-19T14:07:28.899-0500 [clientcursormon]  mapped (incl journal view):800
2015-05-19T14:07:28.899-0500 [clientcursormon]  connections:0
2015-05-19T14:12:29.096-0500 [clientcursormon] mem (MB) res:97 virt:3295
2015-05-19T14:12:29.096-0500 [clientcursormon]  mapped (incl journal view):800
2015-05-19T14:12:29.096-0500 [clientcursormon]  connections:0
2015-05-19T14:17:29.289-0500 [clientcursormon] mem (MB) res:97 virt:3295
2015-05-19T14:17:29.289-0500 [clientcursormon]  mapped (incl journal view):800
2015-05-19T14:17:29.289-0500 [clientcursormon]  connections:0
2015-05-19T14:22:29.522-0500 [clientcursormon] mem (MB) res:97 virt:3295
2015-05-19T14:22:29.522-0500 [clientcursormon]  mapped (incl journal view):800
2015-05-19T14:22:29.522-0500 [clientcursormon]  connections:0
2015-05-19T15:00:05.966-0500 [clientcursormon] mem (MB) res:97 virt:3295
2015-05-19T15:00:05.966-0500 [clientcursormon]  mapped (incl journal view):800
2015-05-19T15:00:05.966-0500 [clientcursormon]  connections:0
2015-05-19T15:03:52.664-0500 [initandlisten] connection accepted from 127.0.0.1:64394 #1 (1 connection now open)
2015-05-19T15:03:52.674-0500 [initandlisten] connection accepted from 127.0.0.1:64395 #2 (2 connections now open)
2015-05-19T15:04:11.610-0500 [initandlisten] connection accepted from 127.0.0.1:64453 #3 (3 connections now open)
2015-05-19T15:04:11.620-0500 [initandlisten] connection accepted from 127.0.0.1:64454 #4 (4 connections now open)
2015-05-19T15:04:27.788-0500 [conn3] end connection 127.0.0.1:64453 (3 connections now open)
2015-05-19T15:04:27.788-0500 [conn4] end connection 127.0.0.1:64454 (3 connections now open)
2015-05-19T15:04:27.795-0500 [conn2] end connection 127.0.0.1:64395 (1 connection now open)
2015-05-19T15:04:27.796-0500 [conn1] end connection 127.0.0.1:64394 (0 connections now open)

Sling Terminal Logs

java -jar org.apache.sling.launchpad-8-SNAPSHOT.jar -Dsling.run.modes=oak_mongo     !1804
19.05.2015 15:14:24.777 *INFO * [main] Setting sling.home=sling (default)
19.05.2015 15:14:24.778 *INFO * [main] Starting Apache Sling in /Users/dholtz/projects/git/sling/launchpad/builder/target/sling
19.05.2015 15:14:24.780 *INFO * [main] Sling  Extension Lib Home : /Users/dholtz/projects/git/sling/launchpad/builder/target/sling/ext
19.05.2015 15:14:24.781 *INFO * [main] Checking launcher JAR in folder /Users/dholtz/projects/git/sling/launchpad/builder/target/sling
19.05.2015 15:14:24.804 *INFO * [main] Installing new launcher: jar:file:/Users/dholtz/projects/git/sling/launchpad/builder/target/org.apache.sling.launchpad-8-SNAPSHOT.jar!/resources/org.apache.sling.launchpad.base.jar, 5.0.0.2_6_0 (org.apache.sling.launchpad.base.jar.1432066464804)
19.05.2015 15:14:24.817 *INFO * [main] Loading launcher class org.apache.sling.launchpad.base.app.MainDelegate from org.apache.sling.launchpad.base.jar.1432066464804
19.05.2015 15:14:24.817 *INFO * [main] External Libs Home (ext) is null or does not exists.
19.05.2015 15:14:24.840 *INFO * [main] Setting sling.run.modes=oak_mongo
19.05.2015 15:14:24.840 *INFO * [main] Setting sling.launchpad=/Users/dholtz/projects/git/sling/launchpad/builder/target/sling
19.05.2015 15:14:24.840 *INFO * [main] Starting launcher ...
19.05.2015 15:14:24.840 *INFO * [main] HTTP server port: 8080
19.05.2015 15:14:25.561 *INFO* [FelixStartLevel] org.apache.sling.commons.logservice Service [org.apache.sling.commons.logservice.internal.LogServiceFactory,18, [org.osgi.service.log.LogService]] ServiceEvent REGISTERED
19.05.2015 15:14:25.564 *INFO* [FelixStartLevel] org.apache.sling.commons.logservice Service [org.apache.sling.commons.logservice.internal.LogReaderServiceFactory,19, [org.osgi.service.log.LogReaderService]] ServiceEvent REGISTERED
19.05.2015 15:14:25.566 *INFO* [FelixStartLevel] org.apache.sling.commons.logservice BundleEvent STARTED
19.05.2015 15:14:25.569 *INFO* [FelixStartLevel] org.apache.sling.installer.core BundleEvent RESOLVED
19.05.2015 15:14:25.570 *INFO* [FelixStartLevel] org.apache.sling.installer.core BundleEvent STARTING
19.05.2015 15:14:25.793 *INFO * [main] Startup completed

Update: 05/20/2015

Per Roberts suggestion:

the runmodes are incorrect in your log, you should use -Dsling.run.modes=oak,oak_mongo –

Altered the runmodes and reran Sling.

error.log

20.05.2015 12:59:27.745 *ERROR* [CM Event Dispatcher (Fire ConfigurationEvent: pid=org.apache.jackrabbit.oak.plugins.document.DocumentNodeStoreService)] org.apache.jackrabbit.oak-core [org.apache.jackrabbit.oak.plugins.document.DocumentNodeStoreService(17)] The activate method has thrown an exception (java.lang.NoClassDefFoundError: com/mongodb/MongoClientOptions$Builder)
java.lang.NoClassDefFoundError: com/mongodb/MongoClientOptions$Builder
    at org.apache.jackrabbit.oak.plugins.document.util.MongoConnection.getDefaultBuilder(MongoConnection.java:85)
    at org.apache.jackrabbit.oak.plugins.document.DocumentNodeStoreService.registerNodeStore(DocumentNodeStoreService.java:375)
    at org.apache.jackrabbit.oak.plugins.document.DocumentNodeStoreService.registerNodeStoreIfPossible(DocumentNodeStoreService.java:324)
    at org.apache.jackrabbit.oak.plugins.document.DocumentNodeStoreService.activate(DocumentNodeStoreService.java:310)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:497)
    at org.apache.felix.scr.impl.helper.BaseMethod.invokeMethod(BaseMethod.java:231)
    at org.apache.felix.scr.impl.helper.BaseMethod.access$500(BaseMethod.java:39)
    at org.apache.felix.scr.impl.helper.BaseMethod$Resolved.invoke(BaseMethod.java:624)
    at org.apache.felix.scr.impl.helper.BaseMethod.invoke(BaseMethod.java:508)
    at org.apache.felix.scr.impl.helper.ActivateMethod.invoke(ActivateMethod.java:149)
    at org.apache.felix.scr.impl.manager.SingleComponentManager.createImplementationObject(SingleComponentManager.java:315)
    at org.apache.felix.scr.impl.manager.SingleComponentManager.createComponent(SingleComponentManager.java:127)
    at org.apache.felix.scr.impl.manager.SingleComponentManager.getService(SingleComponentManager.java:871)
    at org.apache.felix.scr.impl.manager.SingleComponentManager.getServiceInternal(SingleComponentManager.java:838)
    at org.apache.felix.scr.impl.manager.AbstractComponentManager.activateInternal(AbstractComponentManager.java:850)
    at org.apache.felix.scr.impl.manager.SingleComponentManager.reconfigure(SingleComponentManager.java:623)
    at org.apache.felix.scr.impl.config.ConfigurableComponentHolder.configurationUpdated(ConfigurableComponentHolder.java:328)
    at org.apache.felix.scr.impl.config.ConfigurationSupport.configurationEvent(ConfigurationSupport.java:290)
    at org.apache.felix.cm.impl.ConfigurationManager$FireConfigurationEvent.sendEvent(ConfigurationManager.java:2036)
    at org.apache.felix.cm.impl.ConfigurationManager$FireConfigurationEvent.run(ConfigurationManager.java:2005)
    at org.apache.felix.cm.impl.UpdateThread.run(UpdateThread.java:103)
    at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.ClassNotFoundException: com.mongodb.MongoClientOptions$Builder not found by org.apache.jackrabbit.oak-core [48]
    at org.apache.felix.framework.BundleWiringImpl.findClassOrResourceByDelegation(BundleWiringImpl.java:1558)
    at org.apache.felix.framework.BundleWiringImpl.access$400(BundleWiringImpl.java:79)
    at org.apache.felix.framework.BundleWiringImpl$BundleClassLoader.loadClass(BundleWiringImpl.java:1998)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
    ... 25 common frames omitted

Update: 06/04/2015

Based on Robert's latest suggestions it appears successful connections are possibly being made to mongodb. As stated there are exceptions being thrown though.

Robomongo oak-repo

dholtz
  • 91
  • 1
  • 10

1 Answers1

0

As far as I know Oak 1.2, the version we currently use in Sling, was tested on MongoDB 2.6.x . Can you try with the latest 2.6.x version of MongoDB instead of 3.0.x?

If that works and you want to use the latest version of MongoDB you should use the latest driver, e.g. apply a patch to the Sling git repo like

diff --git a/launchpad/builder/src/main/provisioning/oak.txt b/launchpad/builder/src/main/provisioning/oak.txt
index 64decb2..8f5edb6 100644
--- a/launchpad/builder/src/main/provisioning/oak.txt
+++ b/launchpad/builder/src/main/provisioning/oak.txt
@@ -36,7 +36,7 @@
     org.apache.jackrabbit/oak-blob/${oak.version}

 [artifacts startLevel=15 runModes=oak_mongo]
-    org.mongodb/mongo-java-driver/2.12.2
+    org.mongodb/mongo-java-driver/3.0.1

 [configurations runModes=oak]
   org.apache.felix.jaas.Configuration.factory-GuestLoginModule
Robert Munteanu
  • 67,031
  • 36
  • 206
  • 278
  • Robert, thank you for your comments. I have updated the post to include the results of switching to Mongo 2.6.8. Is this the correct way to start Sling after doing an, mvn clean install? java -jar org.apache.sling.launchpad-8-SNAPSHOT.jar -Dsling.run.modes=oak_mongo – dholtz May 19 '15 at 20:34
  • Can you post the ${sling.home}/logs/error.log output somewhere? – Robert Munteanu May 20 '15 at 07:54
  • I have put the entire log file on google drive. https://drive.google.com/file/d/0B-eU5bPCi24Cb1Z3SUlwS29DWWs/view?usp=sharing – dholtz May 20 '15 at 14:49
  • @dholtz - the runmodes are incorrect in your log, you should use -Dsling.run.modes=oak,oak_mongo – Robert Munteanu May 20 '15 at 15:10
  • Post updated above. with newest issue(s). Full logs available: https://drive.google.com/file/d/0B-eU5bPCi24CUVQyYnNPMEFlX28/view?usp=sharing – dholtz May 20 '15 at 19:08
  • I see there's an error in the provisioning configuration. It should use the 2.13.0 driver, not the 2.12.2 one. I've just committed a fix to the Sling SVN repo, can you retry? – Robert Munteanu May 21 '15 at 09:14
  • Unfortunately, I haven't seen a clean build from the Sling Git repo in days. https://drive.google.com/file/d/0B-eU5bPCi24CaFVSWmxWU1dDYkE/view?usp=sharing Are the SVN and Git repos always in sync? – dholtz May 27 '15 at 16:27
  • I would simply build the launchpad/builder/ project, not the whole reactor. Snapshots will be pulled in from Maven if needed – Robert Munteanu May 28 '15 at 07:31
  • It looks like the last suggestion to just build the launchpad/builder project has worked to at least get Sling running and connecting to mongo. I was able to see that the oak-mongo repo appears to have been created at startup. I will update the original post / question with a screen capture of what I 'think' is what is getting created. **There are exceptions being thrown however:** https://drive.google.com/file/d/0B-eU5bPCi24CdnRfcFNlclMwNm8/view?usp=sharing – dholtz Jun 04 '15 at 18:28