Problema
AEM está usando o MongoMK para armazenamento. Um erro MongoTimeoutException é observado durante a inicialização do AEM e a inicialização falha:
03.04.2017 15:16:38.907 *ERROR* [FelixStartLevel] org.apache.jackrabbit.oak-core [org.apache.jackrabbit.oak.plugins.document.DocumentNodeStoreService(157)] The activate method has thrown an exception (com.mongodb.MongoTimeoutException: Timed out after 10000 ms while waiting for a server that matches {serverSelectors=[ReadPreferenceServerSelector{readPreference=primary}, LatencyMinimizingServerSelector{acceptableLatencyDifference=15 ms}]}. Client view of cluster state is {type=ReplicaSet, servers=[{address=host1:30000, type=ReplicaSetArbiter, averageLatency=0.6 ms, state=Connected}, {host2:27017, type=Unknown, state=Connecting}, {address=host3:27017, type=ReplicaSetSecondary, averageLatency=0.7 ms, state=Connected}]) com.mongodb.MongoTimeoutException: Timed out after 10000 ms while waiting for a server that matches {serverSelectors=[ReadPreferenceServerSelector{readPreference=primary}, LatencyMinimizingServerSelector{acceptableLatencyDifference=15 ms}]}. Client view of cluster state is {type=ReplicaSet, servers=[{address=host1:30000, type=ReplicaSetArbiter, averageLatency=0.6 ms, state=Connected}, {address=host2:27017, type=Unknown, state=Connecting}, {address=host3:27017, type=ReplicaSetSecondary, averageLatency=0.7 ms, state=Connected}] at com.mongodb.BaseCluster.getServer(BaseCluster.java:82) at com.mongodb.DBTCPConnector.getServer(DBTCPConnector.java:669) at com.mongodb.DBTCPConnector.access$500(DBTCPConnector.java:40) at com.mongodb.DBTCPConnector$MyPort.getConnection(DBTCPConnector.java:518) at com.mongodb.DBTCPConnector$MyPort.get(DBTCPConnector.java:461) at com.mongodb.DBTCPConnector.innerCall(DBTCPConnector.java:288) at com.mongodb.DBTCPConnector.call(DBTCPConnector.java:273) at com.mongodb.DBCollectionImpl.find(DBCollectionImpl.java:86) at com.mongodb.DB.command(DB.java:320) at com.mongodb.DB.command(DB.java:299) at com.mongodb.DB.command(DB.java:374) at com.mongodb.DB.command(DB.java:246) at com.mongodb.DB.command(DB.java:401) at org.apache.jackrabbit.oak.plugins.document.mongo.MongoDocumentStore.checkVersion(MongoDocumentStore.java:254) at org.apache.jackrabbit.oak.plugins.document.mongo.MongoDocumentStore.<init>(MongoDocumentStore.java:201) at org.apache.jackrabbit.oak.plugins.document.DocumentMK$Builder.setMongoDB(DocumentMK.java:576) at org.apache.jackrabbit.oak.plugins.document.DocumentMK$Builder.setMongoDB(DocumentMK.java:559) at org.apache.jackrabbit.oak.plugins.document.DocumentNodeStoreService.registerNodeStore(DocumentNodeStoreService.java:466) at org.apache.jackrabbit.oak.plugins.document.DocumentNodeStoreService.registerNodeStoreIfPossible(DocumentNodeStoreService.java:374) at org.apache.jackrabbit.oak.plugins.document.DocumentNodeStoreService.activate(DocumentNodeStoreService.java:358) 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:498) at org.apache.felix.scr.impl.helper.BaseMethod.invokeMethod(BaseMethod.java:222) at org.apache.felix.scr.impl.helper.BaseMethod.access$500(BaseMethod.java:37) at org.apache.felix.scr.impl.helper.BaseMethod$Resolved.invoke(BaseMethod.java:615) at org.apache.felix.scr.impl.helper.BaseMethod.invoke(BaseMethod.java:499) at org.apache.felix.scr.impl.helper.ActivateMethod.invoke(ActivateMethod.java:295) at org.apache.felix.scr.impl.manager.SingleComponentManager.createImplementationObject(SingleComponentManager.java:302) at org.apache.felix.scr.impl.manager.SingleComponentManager.createComponent(SingleComponentManager.java:113) at org.apache.felix.scr.impl.manager.SingleComponentManager.getService(SingleComponentManager.java:866) at org.apache.felix.scr.impl.manager.SingleComponentManager.getServiceInternal(SingleComponentManager.java:833) at org.apache.felix.scr.impl.manager.AbstractComponentManager.activateInternal(AbstractComponentManager.java:724) at org.apache.felix.scr.impl.manager.AbstractComponentManager.enable(AbstractComponentManager.java:399) at org.apache.felix.scr.impl.config.ConfigurableComponentHolder.enableComponents(ConfigurableComponentHolder.java:676) at org.apache.felix.scr.impl.BundleComponentActivator.initialEnable(BundleComponentActivator.java:339) at org.apache.felix.scr.impl.Activator.loadComponents(Activator.java:360) at org.apache.felix.scr.impl.Activator.access$000(Activator.java:53) at org.apache.felix.scr.impl.Activator$ScrExtension.start(Activator.java:260) at org.apache.felix.utils.extender.AbstractExtender.createExtension(AbstractExtender.java:259) at org.apache.felix.utils.extender.AbstractExtender.modifiedBundle(AbstractExtender.java:232) at org.osgi.util.tracker.BundleTracker$Tracked.customizerModified(BundleTracker.java:482) at org.osgi.util.tracker.BundleTracker$Tracked.customizerModified(BundleTracker.java:415) at org.osgi.util.tracker.AbstractTracked.track(AbstractTracked.java:232) at org.osgi.util.tracker.BundleTracker$Tracked.bundleChanged(BundleTracker.java:444) at org.apache.felix.framework.util.EventDispatcher.invokeBundleListenerCallback(EventDispatcher.java:916) at org.apache.felix.framework.util.EventDispatcher.fireEventImmediately(EventDispatcher.java:835) at org.apache.felix.framework.util.EventDispatcher.fireBundleEvent(EventDispatcher.java:517) at org.apache.felix.framework.Felix.fireBundleEvent(Felix.java:4541) at org.apache.felix.framework.Felix.startBundle(Felix.java:2172) at org.apache.felix.framework.Felix.setActiveStartLevel(Felix.java:1371) at org.apache.felix.framework.FrameworkStartLevelImpl.run(FrameworkStartLevelImpl.java:308) at java.lang.Thread.run(Thread.java:745) 03.04.2017 15:16:38.908 *ERROR* [FelixStartLevel] org.apache.jackrabbit.oak-core [org.apache.jackrabbit.oak.plugins.document.DocumentNodeStoreService(157)] Failed creating the component instance; see log for reason
Causa
Pode haver algum problema de firewall, problema de conectividade de rede ou problema do Mongo Java Driver.
Resolução
Configure o connectTimeoutMS para 120000 (2 minutos) no MongoURI para aumentar o tempo limite. Seu MongoURI é definido nos parâmetros JVM do script de início ou no org.apache.jackrabbit.oak.plugins.document.DocumentNodeStoreService.config arquivo em crx-quickstart/install.
Por exemplo, seu MongoURI pode ser algo como isto:
mongodb://db1.example.net,db2.example.net:2500/?replicaSet=test&connectTimeoutMS=120000
Se isso não resolver o problema, trabalhe com suas operações de rede e a equipe de DBA que gerencia o MongoDB. Depure a conectividade de rede entre o servidor AEM e os servidores MongoDB. Verifique também a conectividade do conjunto de réplicas.