0

我在 Mule 4 中工作。我想连接到 Azure cosmos MongoDB API。我使用 MongoDB 连接器的“插入文档”操作成功保存了文档,但所有其他 MongoDb 操作都引发了异常。以下是我在使用“list collecton”操作时遇到的异常。

Root Exception stack trace:
com.mongodb.MongoTimeoutException: Timed out after 30000 ms while waiting to connect. Client view of cluster state is {type=UNKNOWN, servers=[{address=dev-mule-est.documents.azure.com:10255, type=UNKNOWN, state=CONNECTING, exception={com.mongodb.MongoSocketOpenException: Exception opening socket}, caused by {java.net.SocketTimeoutException: connect timed out}}]
    at com.mongodb.internal.connection.BaseCluster.getDescription(BaseCluster.java:182)
    at com.mongodb.internal.connection.AbstractMultiServerCluster.getDescription(AbstractMultiServerCluster.java:54)
    at com.mongodb.client.internal.MongoClientDelegate.getConnectedClusterDescription(MongoClientDelegate.java:145)
    at com.mongodb.client.internal.MongoClientDelegate.createClientSession(MongoClientDelegate.java:100)
    at com.mongodb.client.internal.MongoClientDelegate$DelegateOperationExecutor.getClientSession(MongoClientDelegate.java:277)
    at com.mongodb.client.internal.MongoClientDelegate$DelegateOperationExecutor.execute(MongoClientDelegate.java:181)
    at com.mongodb.client.internal.MongoIterableImpl.execute(MongoIterableImpl.java:143)
    at com.mongodb.client.internal.MongoIterableImpl.iterator(MongoIterableImpl.java:92)
    at com.mongodb.client.internal.MappingIterable.iterator(MappingIterable.java:39)
    at com.mongodb.client.internal.MappingIterable.iterator(MappingIterable.java:27)
    at com.google.common.collect.ImmutableList.copyOf(ImmutableList.java:226)
    at org.mule.modules.mongo.internal.operation.CollectionOperations.listCollections(CollectionOperations.java:100)
    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.springframework.util.ReflectionUtils.invokeMethod(ReflectionUtils.java:282)
    at org.mule.runtime.module.extension.internal.runtime.execution.ReflectiveMethodComponentExecutor.lambda$execute$1(ReflectiveMethodComponentExecutor.java:80)
    at org.mule.runtime.core.api.util.ExceptionUtils.tryExpecting(ExceptionUtils.java:227)
    at org.mule.runtime.core.api.util.ClassUtils.withContextClassLoader(ClassUtils.java:915)
    at org.mule.runtime.core.api.util.ClassUtils.withContextClassLoader(ClassUtils.java:879)
    at org.mule.runtime.module.extension.internal.runtime.execution.ReflectiveMethodComponentExecutor.execute(ReflectiveMethodComponentExecutor.java:79)
    at org.mule.runtime.module.extension.internal.runtime.operation.ReflectiveMethodOperationExecutor.execute(ReflectiveMethodOperationExecutor.java:64)
    at org.mule.runtime.module.extension.internal.runtime.execution.InterceptableOperationExecutorWrapper.execute(InterceptableOperationExecutorWrapper.java:60)
    at org.mule.runtime.module.extension.internal.runtime.operation.DefaultExecutionMediator.lambda$null$3(DefaultExecutionMediator.java:146)
    at org.mule.runtime.core.api.util.ExceptionUtils.tryExpecting(ExceptionUtils.java:227)
    at org.mule.runtime.core.api.util.ClassUtils.withContextClassLoader(ClassUtils.java:915)
    at org.mule.runtime.core.api.util.ClassUtils.withContextClassLoader(ClassUtils.java:879)
    at org.mule.runtime.module.extension.internal.runtime.operation.DefaultExecutionMediator.lambda$executeWithInterceptors$9(DefaultExecutionMediator.java:146)
    at reactor.core.* (20 elements filtered from stack; set debug level logging or '-Dmule.verbose.exceptions=true' for everything)(Unknown Source)
    at org.mule.runtime.core.privileged.processor.chain.* (2 elements filtered from stack; set debug level logging or '-Dmule.verbose.exceptions=true' for everything)(Unknown Source)
    at reactor.core.* (4 elements filtered from stack; set debug level logging or '-Dmule.verbose.exceptions=true' for everything)(Unknown Source)
    at org.mule.runtime.core.privileged.processor.chain.* (1 elements filtered from stack; set debug level logging or '-Dmule.verbose.exceptions=true' for everything)(Unknown Source)
    at reactor.core.* (11 elements filtered from stack; set debug level logging or '-Dmule.verbose.exceptions=true' for everything)(Unknown Source)
    at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    at org.mule.service.scheduler.internal.AbstractRunnableFutureDecorator.doRun(AbstractRunnableFutureDecorator.java:111)
    at org.mule.service.scheduler.internal.RunnableFutureDecorator.run(RunnableFutureDecorator.java:54)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
    at java.lang.Thread.run(Thread.java:748)
4

1 回答 1

0

那是查询超时。可能查询需要很长时间才能返回。尝试增加套接字超时或简化/优化查询。

于 2019-09-05T23:59:18.030 回答