WARNING: An illegal reflective access operation has occurred WARNING: Illegal reflective access by com.google.inject.internal.cglib.core.$ReflectUtils$1 (file:/usr/share/maven/lib/guice.jar) to method java.lang.ClassLoader.defineClass(java.lang.String,byte[],int,int,java.security.ProtectionDomain) WARNING: Please consider reporting this to the maintainers of com.google.inject.internal.cglib.core.$ReflectUtils$1 WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations WARNING: All illegal access operations will be denied in a future release [INFO] Scanning for projects... [INFO] [INFO] ----------------------< com.mycompany.app:my-app >---------------------- [INFO] Building my-app 1.0-SNAPSHOT [INFO] --------------------------------[ jar ]--------------------------------- [INFO] [INFO] --- exec-maven-plugin:3.0.0:java (default-cli) @ my-app --- log4j: Trying to find [log4j.properties] using context classloader java.net.URLClassLoader@6dcd5639. log4j: Using URL [file:/usr/local/hd/home/mrussotto/javatest/my-app/target/classes/log4j.properties] for automatic log4j configuration. log4j: Reading configuration from URL file:/usr/local/hd/home/mrussotto/javatest/my-app/target/classes/log4j.properties log4j: Parsing for [root] with value=[DEBUG, A1]. log4j: Level token is [DEBUG]. log4j: Category root set to DEBUG log4j: Parsing appender named "A1". log4j: Parsing layout options for "A1". log4j: End of parsing for "A1". log4j: Parsed "A1" options. log4j: Finished configuring. Ignoring unrecognized boolean value 'true,replicaset=bf23504' in the connection string for 'retrywrites'. Replace with either 'true' or 'false' Cluster created with settings {hosts=[localhost:20020, localhost:20021], mode=MULTIPLE, requiredClusterType=UNKNOWN, serverSelectionTimeout='30000 ms'} Adding discovered server localhost:20020 to client view of cluster Adding discovered server localhost:20021 to client view of cluster Updating cluster description to {type=UNKNOWN, servers=[{address=localhost:20021, type=UNKNOWN, state=CONNECTING}, {address=localhost:20020, type=UNKNOWN, state=CONNECTING}] Cluster description not yet available. Waiting for 30000 ms before timing out Opened connection [connectionId{localValue:1, serverValue:14}] to localhost:20020 Opened connection [connectionId{localValue:4, serverValue:14}] to localhost:20021 Opened connection [connectionId{localValue:3, serverValue:15}] to localhost:20020 Opened connection [connectionId{localValue:2, serverValue:13}] to localhost:20021 Monitor thread successfully connected to server with description ServerDescription{address=localhost:20021, type=REPLICA_SET_SECONDARY, state=CONNECTED, ok=true, minWireVersion=0, maxWireVersion=17, maxDocumentSize=16777216, logicalSessionTimeoutMinutes=30, roundTripTimeNanos=53873373, setName='BF23504', canonicalAddress=Morningstar:20021, hosts=[Morningstar:20020], passives=[Morningstar:20021], arbiters=[], primary='Morningstar:20020', tagSet=TagSet{[]}, electionId=null, setVersion=3, topologyVersion=TopologyVersion{processId=6239e525dee1e3a514a1772f, counter=4}, lastWriteDate=Tue Mar 22 11:03:06 EDT 2022, lastUpdateTimeNanos=16848645353145725} Monitor thread successfully connected to server with description ServerDescription{address=localhost:20020, type=REPLICA_SET_PRIMARY, state=CONNECTED, ok=true, minWireVersion=0, maxWireVersion=17, maxDocumentSize=16777216, logicalSessionTimeoutMinutes=30, roundTripTimeNanos=53874921, setName='BF23504', canonicalAddress=Morningstar:20020, hosts=[Morningstar:20020], passives=[Morningstar:20021], arbiters=[], primary='Morningstar:20020', tagSet=TagSet{[]}, electionId=7fffffff0000000000000001, setVersion=3, topologyVersion=TopologyVersion{processId=6239e524451f902e506f7ed0, counter=8}, lastWriteDate=Tue Mar 22 11:03:06 EDT 2022, lastUpdateTimeNanos=16848645353145708} Discovered cluster type of REPLICA_SET Adding discovered server morningstar:20020 to client view of cluster Adding discovered server morningstar:20021 to client view of cluster Canonical address Morningstar:20021 does not match server address. Removing localhost:20021 from client view of cluster Closing connection connectionId{localValue:2, serverValue:13} Closing connection connectionId{localValue:4, serverValue:14} Updating cluster description to {type=REPLICA_SET, servers=[{address=localhost:20020, type=UNKNOWN, state=CONNECTING}, {address=morningstar:20020, type=UNKNOWN, state=CONNECTING}, {address=morningstar:20021, type=UNKNOWN, state=CONNECTING}] Server localhost:20020 is no longer a member of the replica set. Removing from client view of cluster. Closing connection connectionId{localValue:3, serverValue:15} Closing connection connectionId{localValue:1, serverValue:14} Setting max election id to 7fffffff0000000000000001 from replica set primary localhost:20020 Setting max set version to 3 from replica set primary localhost:20020 Discovered replica set primary localhost:20020 Updating cluster description to {type=REPLICA_SET, servers=[{address=morningstar:20020, type=UNKNOWN, state=CONNECTING}, {address=morningstar:20021, type=UNKNOWN, state=CONNECTING}] Opened connection [connectionId{localValue:6, serverValue:16}] to morningstar:20020 No server chosen by com.mongodb.client.internal.MongoClientDelegate$1@6e263129 from cluster description ClusterDescription{type=REPLICA_SET, connectionMode=MULTIPLE, serverDescriptions=[ServerDescription{address=morningstar:20020, type=UNKNOWN, state=CONNECTING}, ServerDescription{address=morningstar:20021, type=UNKNOWN, state=CONNECTING}]}. Waiting for 30000 ms before timing out Opened connection [connectionId{localValue:7, serverValue:16}] to morningstar:20021 Monitor thread successfully connected to server with description ServerDescription{address=morningstar:20021, type=REPLICA_SET_SECONDARY, state=CONNECTED, ok=true, minWireVersion=0, maxWireVersion=17, maxDocumentSize=16777216, logicalSessionTimeoutMinutes=30, roundTripTimeNanos=6948194, setName='BF23504', canonicalAddress=Morningstar:20021, hosts=[Morningstar:20020], passives=[Morningstar:20021], arbiters=[], primary='Morningstar:20020', tagSet=TagSet{[]}, electionId=null, setVersion=3, topologyVersion=TopologyVersion{processId=6239e525dee1e3a514a1772f, counter=4}, lastWriteDate=Tue Mar 22 11:03:06 EDT 2022, lastUpdateTimeNanos=16848645390275432} Opened connection [connectionId{localValue:8, serverValue:15}] to morningstar:20021 Opened connection [connectionId{localValue:5, serverValue:17}] to morningstar:20020 Monitor thread successfully connected to server with description ServerDescription{address=morningstar:20020, type=REPLICA_SET_PRIMARY, state=CONNECTED, ok=true, minWireVersion=0, maxWireVersion=17, maxDocumentSize=16777216, logicalSessionTimeoutMinutes=30, roundTripTimeNanos=9170400, setName='BF23504', canonicalAddress=Morningstar:20020, hosts=[Morningstar:20020], passives=[Morningstar:20021], arbiters=[], primary='Morningstar:20020', tagSet=TagSet{[]}, electionId=7fffffff0000000000000001, setVersion=3, topologyVersion=TopologyVersion{processId=6239e524451f902e506f7ed0, counter=8}, lastWriteDate=Tue Mar 22 11:03:06 EDT 2022, lastUpdateTimeNanos=16848645392327732} Updating cluster description to {type=REPLICA_SET, servers=[{address=morningstar:20020, type=UNKNOWN, state=CONNECTING}, {address=morningstar:20021, type=REPLICA_SET_SECONDARY, roundTripTime=6.9 ms, state=CONNECTED}] Checking status of morningstar:20021 Discovered replica set primary morningstar:20020 Updating cluster description to {type=REPLICA_SET, servers=[{address=morningstar:20020, type=REPLICA_SET_PRIMARY, roundTripTime=9.2 ms, state=CONNECTED}, {address=morningstar:20021, type=REPLICA_SET_SECONDARY, roundTripTime=6.9 ms, state=CONNECTED}] Checking status of morningstar:20020 Opened connection [connectionId{localValue:9, serverValue:18}] to morningstar:20020 Sending command '{"update": "BF23504", "ordered": true, "txnNumber": 1, "$db": "test", "lsid": {"id": {"$binary": {"base64": "V59x0oigRZ+WzQRYsfRY6g==", "subType": "04"}}}, "updates": [{"q": {"x": 10}, "u": {"x": 11}}]}' with request id 12 to database test on connection [connectionId{localValue:9, serverValue:18}] to server morningstar:20020 Execution of command with request id 12 failed to complete successfully in 21.32 ms on connection [connectionId{localValue:9, serverValue:18}] to server morningstar:20020 com.mongodb.MongoNotPrimaryException: Command failed with error 10107 (NotWritablePrimary): 'not primary' on server morningstar:20020. The full response is {"errorLabels": ["RetryableWriteError"], "topologyVersion": {"processId": {"$oid": "6239e524451f902e506f7ed0"}, "counter": 8}, "ok": 0.0, "errmsg": "not primary", "code": 10107, "codeName": "NotWritablePrimary", "$clusterTime": {"clusterTime": {"$timestamp": {"t": 1647961386, "i": 3}}, "signature": {"hash": {"$binary": {"base64": "AAAAAAAAAAAAAAAAAAAAAAAAAAA=", "subType": "00"}}, "keyId": 0}}, "operationTime": {"$timestamp": {"t": 1647961386, "i": 3}}} at com.mongodb.internal.connection.ProtocolHelper.createSpecialException(ProtocolHelper.java:265) at com.mongodb.internal.connection.ProtocolHelper.getCommandFailureException(ProtocolHelper.java:191) at com.mongodb.internal.connection.InternalStreamConnection.receiveCommandMessageResponse(InternalStreamConnection.java:400) at com.mongodb.internal.connection.InternalStreamConnection.sendAndReceive(InternalStreamConnection.java:324) at com.mongodb.internal.connection.UsageTrackingInternalConnection.sendAndReceive(UsageTrackingInternalConnection.java:114) at com.mongodb.internal.connection.DefaultConnectionPool$PooledConnection.sendAndReceive(DefaultConnectionPool.java:604) at com.mongodb.internal.connection.CommandProtocolImpl.execute(CommandProtocolImpl.java:81) at com.mongodb.internal.connection.DefaultServer$DefaultServerProtocolExecutor.execute(DefaultServer.java:252) at com.mongodb.internal.connection.DefaultServerConnection.executeProtocol(DefaultServerConnection.java:214) at com.mongodb.internal.connection.DefaultServerConnection.command(DefaultServerConnection.java:123) at com.mongodb.internal.operation.MixedBulkWriteOperation.executeCommand(MixedBulkWriteOperation.java:431) at com.mongodb.internal.operation.MixedBulkWriteOperation.executeBulkWriteBatch(MixedBulkWriteOperation.java:251) at com.mongodb.internal.operation.MixedBulkWriteOperation.access$700(MixedBulkWriteOperation.java:76) at com.mongodb.internal.operation.MixedBulkWriteOperation$1.call(MixedBulkWriteOperation.java:194) at com.mongodb.internal.operation.MixedBulkWriteOperation$1.call(MixedBulkWriteOperation.java:185) at com.mongodb.internal.operation.OperationHelper.withReleasableConnection(OperationHelper.java:621) at com.mongodb.internal.operation.MixedBulkWriteOperation.execute(MixedBulkWriteOperation.java:185) at com.mongodb.internal.operation.MixedBulkWriteOperation.execute(MixedBulkWriteOperation.java:76) at com.mongodb.client.internal.MongoClientDelegate$DelegateOperationExecutor.execute(MongoClientDelegate.java:205) at com.mongodb.client.internal.MongoCollectionImpl.executeSingleWriteRequest(MongoCollectionImpl.java:1006) at com.mongodb.client.internal.MongoCollectionImpl.executeReplaceOne(MongoCollectionImpl.java:564) at com.mongodb.client.internal.MongoCollectionImpl.replaceOne(MongoCollectionImpl.java:547) at com.mongodb.client.internal.MongoCollectionImpl.replaceOne(MongoCollectionImpl.java:542) at com.mycompany.app.App.main(App.java:23) at org.codehaus.mojo.exec.ExecJavaMojo$1.run(ExecJavaMojo.java:254) at java.base/java.lang.Thread.run(Thread.java:834) Retrying operation REPLACE due to an error "com.mongodb.MongoNotPrimaryException: Command failed with error 10107 (NotWritablePrimary): 'not primary' on server morningstar:20020. The full response is {"errorLabels": ["RetryableWriteError"], "topologyVersion": {"processId": {"$oid": "6239e524451f902e506f7ed0"}, "counter": 8}, "ok": 0.0, "errmsg": "not primary", "code": 10107, "codeName": "NotWritablePrimary", "$clusterTime": {"clusterTime": {"$timestamp": {"t": 1647961386, "i": 3}}, "signature": {"hash": {"$binary": {"base64": "AAAAAAAAAAAAAAAAAAAAAAAAAAA=", "subType": "00"}}, "keyId": 0}}, "operationTime": {"$timestamp": {"t": 1647961386, "i": 3}}}" Sending command '{"update": "BF23504", "ordered": true, "txnNumber": 1, "$db": "test", "$clusterTime": {"clusterTime": {"$timestamp": {"t": 1647961386, "i": 3}}, "signature": {"hash": {"$binary": {"base64": "AAAAAAAAAAAAAAAAAAAAAAAAAAA=", "subType": "00"}}, "keyId": 0}}, "lsid": {"id": {"$binary": {"base64": "V59x0oigRZ+WzQRYsfRY6g==", "subType": "04"}}}, "updates": [{"q": {"x": 10}, "u": {"x": 11}}]}' with request id 13 to database test on connection [connectionId{localValue:9, serverValue:18}] to server morningstar:20020 Sending command '{"hello": 1, "$db": "admin", "$clusterTime": {"clusterTime": {"$timestamp": {"t": 1647961386, "i": 3}}, "signature": {"hash": {"$binary": {"base64": "AAAAAAAAAAAAAAAAAAAAAAAAAAA=", "subType": "00"}}, "keyId": 0}}}' with request id 14 to database admin on connection [connectionId{localValue:6, serverValue:16}] to server morningstar:20020 Sending command '{"hello": 1, "$db": "admin", "$clusterTime": {"clusterTime": {"$timestamp": {"t": 1647961386, "i": 3}}, "signature": {"hash": {"$binary": {"base64": "AAAAAAAAAAAAAAAAAAAAAAAAAAA=", "subType": "00"}}, "keyId": 0}}}' with request id 15 to database admin on connection [connectionId{localValue:8, serverValue:15}] to server morningstar:20021 Execution of command with request id 14 completed successfully in 9.89 ms on connection [connectionId{localValue:6, serverValue:16}] to server morningstar:20020 Execution of command with request id 15 completed successfully in 7.66 ms on connection [connectionId{localValue:8, serverValue:15}] to server morningstar:20021 Updating cluster description to {type=REPLICA_SET, servers=[{address=morningstar:20020, type=REPLICA_SET_PRIMARY, roundTripTime=9.2 ms, state=CONNECTED}, {address=morningstar:20021, type=REPLICA_SET_SECONDARY, roundTripTime=7.6 ms, state=CONNECTED}] Checking status of morningstar:20021 Updating cluster description to {type=REPLICA_SET, servers=[{address=morningstar:20020, type=REPLICA_SET_PRIMARY, roundTripTime=7.5 ms, state=CONNECTED}, {address=morningstar:20021, type=REPLICA_SET_SECONDARY, roundTripTime=7.6 ms, state=CONNECTED}] Checking status of morningstar:20020 Sending command '{"hello": 1, "$db": "admin", "$clusterTime": {"clusterTime": {"$timestamp": {"t": 1647961394, "i": 1}}, "signature": {"hash": {"$binary": {"base64": "AAAAAAAAAAAAAAAAAAAAAAAAAAA=", "subType": "00"}}, "keyId": 0}}}' with request id 16 to database admin on connection [connectionId{localValue:6, serverValue:16}] to server morningstar:20020 Sending command '{"hello": 1, "$db": "admin", "$clusterTime": {"clusterTime": {"$timestamp": {"t": 1647961394, "i": 1}}, "signature": {"hash": {"$binary": {"base64": "AAAAAAAAAAAAAAAAAAAAAAAAAAA=", "subType": "00"}}, "keyId": 0}}}' with request id 17 to database admin on connection [connectionId{localValue:8, serverValue:15}] to server morningstar:20021 Execution of command with request id 17 completed successfully in 6.27 ms on connection [connectionId{localValue:8, serverValue:15}] to server morningstar:20021 Execution of command with request id 16 completed successfully in 6.79 ms on connection [connectionId{localValue:6, serverValue:16}] to server morningstar:20020 Updating cluster description to {type=REPLICA_SET, servers=[{address=morningstar:20020, type=REPLICA_SET_PRIMARY, roundTripTime=7.7 ms, state=CONNECTED}, {address=morningstar:20021, type=REPLICA_SET_SECONDARY, roundTripTime=7.6 ms, state=CONNECTED}] Checking status of morningstar:20020 Updating cluster description to {type=REPLICA_SET, servers=[{address=morningstar:20020, type=REPLICA_SET_PRIMARY, roundTripTime=7.7 ms, state=CONNECTED}, {address=morningstar:20021, type=REPLICA_SET_SECONDARY, roundTripTime=7.7 ms, state=CONNECTED}] Checking status of morningstar:20021 Closing connection connectionId{localValue:5, serverValue:17} Closing connection connectionId{localValue:9, serverValue:18} Execution of command with request id 13 failed to complete successfully in 23034.80 ms on connection [connectionId{localValue:9, serverValue:18}] to server morningstar:20020 com.mongodb.MongoSocketReadException: Prematurely reached end of stream at com.mongodb.internal.connection.SocketStream.read(SocketStream.java:112) at com.mongodb.internal.connection.SocketStream.read(SocketStream.java:131) at com.mongodb.internal.connection.InternalStreamConnection.receiveResponseBuffers(InternalStreamConnection.java:694) at com.mongodb.internal.connection.InternalStreamConnection.receiveMessageWithAdditionalTimeout(InternalStreamConnection.java:558) at com.mongodb.internal.connection.InternalStreamConnection.receiveCommandMessageResponse(InternalStreamConnection.java:397) at com.mongodb.internal.connection.InternalStreamConnection.sendAndReceive(InternalStreamConnection.java:324) at com.mongodb.internal.connection.UsageTrackingInternalConnection.sendAndReceive(UsageTrackingInternalConnection.java:114) at com.mongodb.internal.connection.DefaultConnectionPool$PooledConnection.sendAndReceive(DefaultConnectionPool.java:604) at com.mongodb.internal.connection.CommandProtocolImpl.execute(CommandProtocolImpl.java:81) at com.mongodb.internal.connection.DefaultServer$DefaultServerProtocolExecutor.execute(DefaultServer.java:252) at com.mongodb.internal.connection.DefaultServerConnection.executeProtocol(DefaultServerConnection.java:214) at com.mongodb.internal.connection.DefaultServerConnection.command(DefaultServerConnection.java:123) at com.mongodb.internal.operation.MixedBulkWriteOperation.executeCommand(MixedBulkWriteOperation.java:431) at com.mongodb.internal.operation.MixedBulkWriteOperation.access$1200(MixedBulkWriteOperation.java:76) at com.mongodb.internal.operation.MixedBulkWriteOperation$3.call(MixedBulkWriteOperation.java:301) at com.mongodb.internal.operation.MixedBulkWriteOperation$3.call(MixedBulkWriteOperation.java:293) at com.mongodb.internal.operation.OperationHelper.withReleasableConnection(OperationHelper.java:641) at com.mongodb.internal.operation.MixedBulkWriteOperation.retryExecuteBatches(MixedBulkWriteOperation.java:293) at com.mongodb.internal.operation.MixedBulkWriteOperation.executeBulkWriteBatch(MixedBulkWriteOperation.java:286) at com.mongodb.internal.operation.MixedBulkWriteOperation.access$700(MixedBulkWriteOperation.java:76) at com.mongodb.internal.operation.MixedBulkWriteOperation$1.call(MixedBulkWriteOperation.java:194) at com.mongodb.internal.operation.MixedBulkWriteOperation$1.call(MixedBulkWriteOperation.java:185) at com.mongodb.internal.operation.OperationHelper.withReleasableConnection(OperationHelper.java:621) at com.mongodb.internal.operation.MixedBulkWriteOperation.execute(MixedBulkWriteOperation.java:185) at com.mongodb.internal.operation.MixedBulkWriteOperation.execute(MixedBulkWriteOperation.java:76) at com.mongodb.client.internal.MongoClientDelegate$DelegateOperationExecutor.execute(MongoClientDelegate.java:205) at com.mongodb.client.internal.MongoCollectionImpl.executeSingleWriteRequest(MongoCollectionImpl.java:1006) at com.mongodb.client.internal.MongoCollectionImpl.executeReplaceOne(MongoCollectionImpl.java:564) at com.mongodb.client.internal.MongoCollectionImpl.replaceOne(MongoCollectionImpl.java:547) at com.mongodb.client.internal.MongoCollectionImpl.replaceOne(MongoCollectionImpl.java:542) at com.mycompany.app.App.main(App.java:23) at org.codehaus.mojo.exec.ExecJavaMojo$1.run(ExecJavaMojo.java:254) at java.base/java.lang.Thread.run(Thread.java:834) Exception in monitor thread while connecting to server morningstar:20020 com.mongodb.MongoSocketReadException: Prematurely reached end of stream at com.mongodb.internal.connection.SocketStream.read(SocketStream.java:112) at com.mongodb.internal.connection.SocketStream.read(SocketStream.java:131) at com.mongodb.internal.connection.InternalStreamConnection.receiveResponseBuffers(InternalStreamConnection.java:694) at com.mongodb.internal.connection.InternalStreamConnection.receiveMessageWithAdditionalTimeout(InternalStreamConnection.java:558) at com.mongodb.internal.connection.InternalStreamConnection.receiveCommandMessageResponse(InternalStreamConnection.java:397) at com.mongodb.internal.connection.InternalStreamConnection.receive(InternalStreamConnection.java:356) at com.mongodb.internal.connection.DefaultServerMonitor$ServerMonitorRunnable.lookupServerDescription(DefaultServerMonitor.java:223) at com.mongodb.internal.connection.DefaultServerMonitor$ServerMonitorRunnable.run(DefaultServerMonitor.java:151) at java.base/java.lang.Thread.run(Thread.java:834) Updating cluster description to {type=REPLICA_SET, servers=[{address=morningstar:20020, type=UNKNOWN, state=CONNECTING, exception={com.mongodb.MongoSocketReadException: Prematurely reached end of stream}}, {address=morningstar:20021, type=REPLICA_SET_SECONDARY, roundTripTime=7.7 ms, state=CONNECTED}] Invalidating the connection pool Updating cluster description to {type=REPLICA_SET, servers=[{address=morningstar:20020, type=UNKNOWN, state=CONNECTING, exception={com.mongodb.MongoSocketReadException: Prematurely reached end of stream}}, {address=morningstar:20021, type=REPLICA_SET_SECONDARY, roundTripTime=7.7 ms, state=CONNECTED}] Invalidating the connection pool Closing connection connectionId{localValue:10} Exception in monitor thread while connecting to server morningstar:20020 com.mongodb.MongoSocketOpenException: Exception opening socket at com.mongodb.internal.connection.SocketStream.open(SocketStream.java:70) at com.mongodb.internal.connection.InternalStreamConnection.open(InternalStreamConnection.java:165) at com.mongodb.internal.connection.DefaultServerMonitor$ServerMonitorRunnable.lookupServerDescription(DefaultServerMonitor.java:195) at com.mongodb.internal.connection.DefaultServerMonitor$ServerMonitorRunnable.run(DefaultServerMonitor.java:151) at java.base/java.lang.Thread.run(Thread.java:834) Caused by: java.net.ConnectException: Connection refused (Connection refused) at java.base/java.net.PlainSocketImpl.socketConnect(Native Method) at java.base/java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:399) at java.base/java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:242) at java.base/java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:224) at java.base/java.net.SocksSocketImpl.connect(SocksSocketImpl.java:403) at java.base/java.net.Socket.connect(Socket.java:609) at com.mongodb.internal.connection.SocketStreamHelper.initialize(SocketStreamHelper.java:107) at com.mongodb.internal.connection.SocketStream.initializeSocket(SocketStream.java:79) at com.mongodb.internal.connection.SocketStream.open(SocketStream.java:65) ... 4 more Closed connection [connectionId{localValue:9, serverValue:18}] to morningstar:20020 because there was a socket exception raised by this connection. Updating cluster description to {type=REPLICA_SET, servers=[{address=morningstar:20020, type=UNKNOWN, state=CONNECTING, exception={com.mongodb.MongoSocketOpenException: Exception opening socket}, caused by {java.net.ConnectException: Connection refused (Connection refused)}}, {address=morningstar:20021, type=REPLICA_SET_SECONDARY, roundTripTime=7.7 ms, state=CONNECTED}] Invalidating the connection pool Unable to update due to an error: com.mongodb.MongoNotPrimaryException: Command failed with error 10107 (NotWritablePrimary): 'not primary' on server morningstar:20020. The full response is {"errorLabels": ["RetryableWriteError"], "topologyVersion": {"processId": {"$oid": "6239e524451f902e506f7ed0"}, "counter": 8}, "ok": 0.0, "errmsg": "not primary", "code": 10107, "codeName": "NotWritablePrimary", "$clusterTime": {"clusterTime": {"$timestamp": {"t": 1647961386, "i": 3}}, "signature": {"hash": {"$binary": {"base64": "AAAAAAAAAAAAAAAAAAAAAAAAAAA=", "subType": "00"}}, "keyId": 0}}, "operationTime": {"$timestamp": {"t": 1647961386, "i": 3}}} Closing connection connectionId{localValue:6, serverValue:16} Closing connection connectionId{localValue:7, serverValue:16} Closing connection connectionId{localValue:8, serverValue:15} [INFO] ------------------------------------------------------------------------ [INFO] BUILD SUCCESS [INFO] ------------------------------------------------------------------------ [INFO] Total time: 24.087 s [INFO] Finished at: 2022-03-22T11:03:37-04:00 [INFO] ------------------------------------------------------------------------