Connecting Jaspersoft Studio to Mongo DB using pem certificate

Have you ever had to create a data source in Japsersoft Studio to connect to a Mongo database over SSL/TLS using a certificate in pem form? So I use the following as my Mongo URI

mongodb://<host>:<port>/<database name>?tls=true&tlsAllowInvalidCertificates=true&tlsCertificateKeyFile=<full path and filename>.pem

When I test that connection I get a timeout exception with the following message stack:

net.sf.jasperreports.engine.JRException: Error creating MongoDBConnection; Caused by: Cannot test MongoDB connection; Caused by: Timed out after 30000 ms while waiting to connect. Client view of cluster state is {type=UNKNOWN, servers=[{address=<host removed from post>:<port removed from post>, type=UNKNOWN, state=CONNECTING, exception={com.mongodb.MongoSocketWriteException: Exception sending message}, caused by {javax.net.ssl.SSLHandshakeException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target}, caused by {sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target}, caused by {sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target}}]
    at com.jaspersoft.mongodb.connection.MongoDbConnection.<init>(MongoDbConnection.java:86)
    at com.jaspersoft.mongodb.adapter.MongoDbDataAdapterService.createConnection(MongoDbDataAdapterService.java:70)
    at com.jaspersoft.mongodb.adapter.MongoDbDataAdapterService.test(MongoDbDataAdapterService.java:91)
    at com.jaspersoft.studio.data.wizard.AbstractDataAdapterWizard$3.runOperations(AbstractDataAdapterWizard.java:154)
    at com.jaspersoft.studio.utils.jobs.CheckedRunnableWithProgress$1.run(CheckedRunnableWithProgress.java:51)
    at java.base/java.lang.Thread.run(Unknown Source)

It seems that it's the tls=true that's causing this; I can remove all other parameters and still get the same response. So I though about importing my pem file into my TIBCO installation's cacerts but given the above behaviour it doesn't seem to even get that far.

Any ideas?

petros.tavridis's picture
Joined: Oct 15 2021 - 3:19am
Last seen: 1 week 3 days ago

0 Answers:

No answers yet
Feedback
randomness