You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
For the windows project, when you run the application with the maven commande
mvn compile quarkus:dev -Dquarkus.profile=local
The application failed to open a mongo connection with the SRV protocol.
"/etc/resolv.conf"
Expected behavior
The mongodb SRV protocol should work out of the box
Actual behavior
we have a great stack trace with NPE :
2022-10-14 18:17:06,767 ERROR [org.jbo.res.rea.com.cor.AbstractResteasyReactiveContext] (executor-thread-0) Request failed: java.lang.NullPointerException: Cannot invoke "java.util.List.isEmpty()" because "list" is null
at io.quarkus.mongodb.runtime.dns.MongoDnsClient.lambda$new$0(MongoDnsClient.java:58)
at java.base/java.util.Optional.orElseGet(Optional.java:364)
at io.quarkus.mongodb.runtime.dns.MongoDnsClient.<init>(MongoDnsClient.java:56)
at io.quarkus.mongodb.runtime.dns.MongoDnsClientProvider.create(MongoDnsClientProvider.java:12)
at com.mongodb.internal.dns.DefaultDnsResolver.<init>(DefaultDnsResolver.java:44)
at com.mongodb.ConnectionString.<init>(ConnectionString.java:397)
at io.quarkus.mongodb.runtime.MongoClients.createMongoConfiguration(MongoClients.java:262)
at io.quarkus.mongodb.runtime.MongoClients.createMongoClient(MongoClients.java:118)
at io.quarkus.mongodb.runtime.MongoClients_Subclass.createMongoClient$$superforward1(Unknown Source)
at io.quarkus.mongodb.runtime.MongoClients_Subclass$$function$$4.apply(Unknown Source)
at io.quarkus.arc.impl.AroundInvokeInvocationContext.proceed(AroundInvokeInvocationContext.java:53)
at io.quarkus.arc.runtime.devconsole.InvocationInterceptor.proceed(InvocationInterceptor.java:62)
at io.quarkus.arc.runtime.devconsole.InvocationInterceptor.monitor(InvocationInterceptor.java:49)
at io.quarkus.arc.runtime.devconsole.InvocationInterceptor_Bean.intercept(Unknown Source)
at io.quarkus.arc.impl.InterceptorInvocation.invoke(InterceptorInvocation.java:41)
at io.quarkus.arc.impl.AroundInvokeInvocationContext.perform(AroundInvokeInvocationContext.java:40)
at io.quarkus.arc.impl.InvocationContexts.performAroundInvoke(InvocationContexts.java:32)
at io.quarkus.mongodb.runtime.MongoClients_Subclass.createMongoClient(Unknown Source)
at io.quarkus.mongodb.runtime.MongoClientRecorder.lambda$mongoClientSupplier$0(MongoClientRecorder.java:63)
at io.quarkus.mongodb.runtime.MongoClientRecorder$MongoClientSupplier.get(MongoClientRecorder.java:57)
at com.mongodb.client.MongoClient_38bcba43bbcf7928744e8baa654420f551f1ff9a_Synthetic_Bean.create(Unknown Source)
at com.mongodb.client.MongoClient_38bcba43bbcf7928744e8baa654420f551f1ff9a_Synthetic_Bean.create(Unknown Source)
at io.quarkus.arc.impl.AbstractSharedContext.createInstanceHandle(AbstractSharedContext.java:111)
at io.quarkus.arc.impl.AbstractSharedContext$1.get(AbstractSharedContext.java:35)
at io.quarkus.arc.impl.AbstractSharedContext$1.get(AbstractSharedContext.java:32)
at io.quarkus.arc.impl.LazyValue.get(LazyValue.java:26)
at io.quarkus.arc.impl.ComputingCache.computeIfAbsent(ComputingCache.java:69)
at io.quarkus.arc.impl.AbstractSharedContext.get(AbstractSharedContext.java:32)
at io.quarkus.arc.impl.ClientProxies.getApplicationScopedDelegate(ClientProxies.java:19)
at com.mongodb.client.MongoClient_38bcba43bbcf7928744e8baa654420f551f1ff9a_Synthetic_ClientProxy.arc$delegate(Unknown Source)
at com.mongodb.client.MongoClient_38bcba43bbcf7928744e8baa654420f551f1ff9a_Synthetic_ClientProxy.getDatabase(Unknown Source)
How to Reproduce?
Step to reproduce the behaviour :
Having a windows environment or not having the right to read this file ( "/etc/resolv.conf")
try to connect a mongodb with srv protocole ( url connection must start with mongodb+srv)
try to open the connection, the NPE rise !
Output of uname -a or ver
No response
Output of java -version
Java version: 17.0.1
GraalVM version (if different from Java)
No response
Quarkus version or git rev
2.12.0
Build tool (ie. output of mvnw --version or gradlew --version)
Apache Maven 3.8.1
Additional information
You should not initialize a list with null
List nameServers = null;
should be nameServers = new ArrayList<>();
The text was updated successfully, but these errors were encountered:
Hi, I had the same issue today, a workaround is using legacy connection string specifing shards, like mongodb://<usr>:<psw>@<cluster_id>.mongodb.net:27017,<cluster_id>-shard-00-01.ysvl5.mongodb.net:27017,<cluster_id>-shard-00-02.ysvl5.mongodb.net:27017/?ssl=true&replicaSet=atlas-j022j2-shard-0&authSource=admin&retryWrites=true&w=majority.
My application.properties:
# configure the MongoDB client for a replica set of two nodes
quarkus.mongodb.connection-string=mongodb://<usr>:<psw>@<cluster_id>.mongodb.net:27017,<cluster_id>-shard-00-01.ysvl5.mongodb.net:27017,<cluster_id>-shard-00-02.ysvl5.mongodb.net:27017/?ssl=true&replicaSet=atlas-j022j2-shard-0&authSource=admin&retryWrites=true&w=majority
# mandatory if you don't specify the name of the database using @MongoEntity
quarkus.mongodb.database = Feeds
Describe the bug
For the windows project, when you run the application with the maven commande
mvn compile quarkus:dev -Dquarkus.profile=local
The application failed to open a mongo connection with the SRV protocol.
"/etc/resolv.conf"
Expected behavior
The mongodb SRV protocol should work out of the box
Actual behavior
we have a great stack trace with NPE :
How to Reproduce?
Step to reproduce the behaviour :
Output of
uname -a
orver
No response
Output of
java -version
Java version: 17.0.1
GraalVM version (if different from Java)
No response
Quarkus version or git rev
2.12.0
Build tool (ie. output of
mvnw --version
orgradlew --version
)Apache Maven 3.8.1
Additional information
You should not initialize a list with null
List nameServers = null;
should be nameServers = new ArrayList<>();
The text was updated successfully, but these errors were encountered: