最終更新日 :
2021年4月27日
問題点
AEM が、ストレージに MongoMK を使用しています。AEM の起動時に MongoTimeoutException エラーが発生し、起動が失敗します:
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
原因
ファイアウォールの問題/ネットワーク接続の問題/Mongo Java ドライバの問題の可能性があります。
解決策
タイムアウト時間を延長するために、MongoURI の connectTimeoutMS を 120000 (2 minutes) に設定します。MongoURI は、起動スクリプト JVM パラメータか、crx-quickstart/install 以下の org.apache.jackrabbit.oak.plugins.document.DocumentNodeStoreService.config で設定できます。
例えば、MongoURI は次のようになっているかもしれません:
mongodb://db1.example.net,db2.example.net:2500/?replicaSet=test&connectTimeoutMS=120000
それでも問題が解決しない場合は、ネットワーク操作および MongoDB を管理する DBA チームと共同して作業してください。AEM サーバーと MongoDB サーバー間のネットワーク接続をデバッグします。レプリカセットの接続も確認してください。