Not able to run mflix app

Hi @steevej-1495/@varshamaru , When i try to start my mflix app post following README instructions i get below error . I am able to connect to my cluster via command line.

Please advise .

2019-03-15 22:40:51.852 INFO 4024 — [ngodb.net:27017] org.mongodb.driver.cluster : Exception in monitor thread while connecting to server mflix-shard-00-02-qviz5.mongodb.net:27017

com.mongodb.MongoSocketWriteException: Exception sending message
at com.mongodb.internal.connection.InternalStreamConnection.translateWriteException(InternalStreamConnection.java:541) ~[mongodb-driver-core-3.9.1.jar:na]
at com.mongodb.internal.connection.InternalStreamConnection.sendMessage(InternalStreamConnection.java:429) ~[mongodb-driver-core-3.9.1.jar:na]
at com.mongodb.internal.connection.InternalStreamConnection.sendCommandMessage(InternalStreamConnection.java:269) ~[mongodb-driver-core-3.9.1.jar:na]
at com.mongodb.internal.connection.InternalStreamConnection.sendAndReceive(InternalStreamConnection.java:253) ~[mongodb-driver-core-3.9.1.jar:na]
at com.mongodb.internal.connection.CommandHelper.sendAndReceive(CommandHelper.java:83) ~[mongodb-driver-core-3.9.1.jar:na]
at com.mongodb.internal.connection.CommandHelper.executeCommand(CommandHelper.java:33) ~[mongodb-driver-core-3.9.1.jar:na]
at com.mongodb.internal.connection.InternalStreamConnectionInitializer.initializeConnectionDescription(InternalStreamConnectionInitializer.java:106) ~[mongodb-driver-core-3.9.1.jar:na]
at com.mongodb.internal.connection.InternalStreamConnectionInitializer.initialize(InternalStreamConnectionInitializer.java:63) ~[mongodb-driver-core-3.9.1.jar:na]
at com.mongodb.internal.connection.InternalStreamConnection.open(InternalStreamConnection.java:127) ~[mongodb-driver-core-3.9.1.jar:na]
at com.mongodb.internal.connection.DefaultServerMonitor$ServerMonitorRunnable.run(DefaultServerMonitor.java:117) ~[mongodb-driver-core-3.9.1.jar:na]
at java.lang.Thread.run(Thread.java:748) [na:1.8.0_161]
Caused by: javax.net.ssl.SSLHandshakeException: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
at sun.security.ssl.Alerts.getSSLException(Alerts.java:192) ~[na:1.8.0_161]
at sun.security.ssl.SSLSocketImpl.fatal(SSLSocketImpl.java:1959) ~[na:1.8.0_161]
at sun.security.ssl.Handshaker.fatalSE(Handshaker.java:328) ~[na:1.8.0_161]
at sun.security.ssl.Handshaker.fatalSE(Handshaker.java:322) ~[na:1.8.0_161]
at sun.security.ssl.ClientHandshaker.serverCertificate(ClientHandshaker.java:1614) ~[na:1.8.0_161]
at sun.security.ssl.ClientHandshaker.processMessage(ClientHandshaker.java:216) ~[na:1.8.0_161]
at sun.security.ssl.Handshaker.processLoop(Handshaker.java:1052) ~[na:1.8.0_161]
at sun.security.ssl.Handshaker.process_record(Handshaker.java:987) ~[na:1.8.0_161]
at sun.security.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:1072) ~[na:1.8.0_161]
at sun.security.ssl.SSLSocketImpl.performInitialHandshake(SSLSocketImpl.java:1385) ~[na:1.8.0_161]
at sun.security.ssl.SSLSocketImpl.writeRecord(SSLSocketImpl.java:757) ~[na:1.8.0_161]
at sun.security.ssl.AppOutputStream.write(AppOutputStream.java:123) ~[na:1.8.0_161]
at com.mongodb.internal.connection.SocketStream.write(SocketStream.java:99) ~[mongodb-driver-core-3.9.1.jar:na]
at com.mongodb.internal.connection.InternalStreamConnection.sendMessage(InternalStreamConnection.java:426) ~[mongodb-driver-core-3.9.1.jar:na]
… 9 common frames omitted
Caused by: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
at sun.security.validator.PKIXValidator.doBuild(PKIXValidator.java:397) ~[na:1.8.0_161]
at sun.security.validator.PKIXValidator.engineValidate(PKIXValidator.java:302) ~[na:1.8.0_161]
at sun.security.validator.Validator.validate(Validator.java:260) ~[na:1.8.0_161]
at sun.security.ssl.X509TrustManagerImpl.validate(X509TrustManagerImpl.java:324) ~[na:1.8.0_161]
at sun.security.ssl.X509TrustManagerImpl.checkTrusted(X509TrustManagerImpl.java:229) ~[na:1.8.0_161]
at sun.security.ssl.X509TrustManagerImpl.checkServerTrusted(X509TrustManagerImpl.java:124) ~[na:1.8.0_161]
at sun.security.ssl.ClientHandshaker.serverCertificate(ClientHandshaker.java:1596) ~[na:1.8.0_161]
… 18 common frames omitted

@ Rahul_Singh18

Just to clarify, I’m not the TA for this course, and really don’t have any insight here. The error messages indicate that the Java app can’t find the required security certificate, so I’d probably start there. Good luck.

1 Like

Try to use the srv connection string.

Hi @steevej-1495 i am using srv connection string as below:

spring.mongodb.uri=mongodb+srv://m220student:m220password@mflix-qviz5.mongodb.net/test?retryWrites=true
spring.mongodb.database=mflix
server.port=5000
logging.level.api.controllers=DEBUG
api.movies.movies_per_page=20
spring.resources.static-locations=classpath:/META-INF/resources/,classpath:/resources/,classpath:/static/,classpath:/build

Sorry but I have no clue. Firewall or VPN issue may be. Which version of java are you using?

I am using Java 8 . Seriously not understanding why it is not working . I have another project where i connect boot app to mongo on local and app loads perfectly fine.

I am puzzled too. I really do not know what would be the next step. May be I would try to reinstall. Are you Windows, Linux or Mac?

I am on windows did some research on internet , very vague answers i could find mostly related to Certificates , but if thats the case then i should be having same error for my other project as well.

Hi @Rahul_Singh18,

When connecting to Atlas you are mandatorily using your systems TLS certificates.
Generally this is fine, it uses a similar system to your browser when you connect to an https website.

When you connect locally, by default your local mongod does not require TLS certificates, hence the reason why you don’t see these issues locally.

In this support page you can find some information on how to identify the issue / solve it.

Try to find out that the MongoDB certificate is correctly installed and trusted in your local certificate store.

Unfortunately I cannot reproduce this error, therefore there is not much more I can do to help you out here.

N.

1 Like

@Norberto thank you for this information , i will try with MongoDb Certificate.