bthj opened a new issue #2684:
URL: https://github.com/apache/camel-k/issues/2684
When trying to access a MongoDB Atlas Free Tier Cluster with a Camel-K
integration Java file like:
```
// camel-k: language=java
// camel-k: dependency=camel:mongodb
// camel-k: dependency=camel:jackson
// camel-k: dependency=mvn:org.mongodb:mongo-java-driver:3.12.10
import org.apache.camel.builder.RouteBuilder;
public class MongoDBTest extends RouteBuilder {
@Override
public void configure() throws Exception {
from("timer:java?period=1000")
.routeId("java")
.to("mongodb:mongoBean?hosts=[shard1].mongodb.net:27017,[shard2].mongodb.net:27017,[shard3].mongodb.net:27017&username=[user]&password=[pass]&database=[dbname]&collection=[collection-name]&operation=getDbStats")
.to("log:info");
}
}
```
and deploy it with Camel K Client 1.6.0 to a camel-k-operator.v1.6.0 with
the command: `kamel run MongoDBTest.java --dev` it results in the error:
```
Error processing exchange. Exchange[F6C144558CE94DA-000000000000000B].
Caused by: [org.apache.camel.component.mongodb.CamelMongoDbException -
com.mongodb.MongoTimeoutException: Timed out after 30000 ms while waiting to
connect. Client view of cluster state is {type=UNKNOWN,
servers=[{address=127.0.0.1:27017, type=UNKNOWN, state=CONNECTING,
exception={com.mongodb.MongoSocketOpenException: Exception opening socket},
caused by {java.net.ConnectException: Connection refused (Connection
refused)}}]]: org.apache.camel.component.mongodb.CamelMongoDbException:
com.mongodb.MongoTimeoutException: Timed out after 30000 ms while waiting to
connect. Client view of cluster state is {type=UNKNOWN,
servers=[{address=127.0.0.1:27017, type=UNKNOWN, state=CONNECTING,
exception={com.mongodb.MongoSocketOpenException: Exception opening socket},
caused by {java.net.ConnectException: Connection refused (Connection refused)}}]
[3] at
org.apache.camel.component.mongodb.MongoDbComponent.wrapInCamelMongoDbException(MongoDbComponent.java:84)
```
- it seems to be trying to connect to `127.0.0.1:27017` - is there something
I should add to have the integration communicate with the correct hosts?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]