Unable to support mongodb+srv// style connections as the 'com.sun.jndi.dns.DnsContextFactory' class is not available in this JRE

86 views Asked by At

I'm trying to make an API in java using resteasy and jetty to run the API and Morphia to connect to a MongoDB database, however when I try to create a datastore the application crashes and gives the following errors:

com.google.inject.CreationException: Unable to create injector, see the following errors:

1) An exception was caught and reported. Message: Unable to support mongodb+srv// style connections as the 'com.sun.jndi.dns.DnsContextFactory' class is not available in this JRE. A JNDI context is required for resolving SRV records.
  at com.google.inject.internal.InjectorShell$Builder.build(InjectorShell.java:137)

I'm using java 11 for this.

If more info is needed I will try to provide it.

0

There are 0 answers