title: Cannot locate default realm from javaKerberos Sql Server connection on docker Linux
body: <p>I'm trying to connect to a sql server instance via javaKerberos.   I can get this  to work on Windows (non-docker)  and a nondocker Linux instance, but I keep getting a &quot;Cannot locate default realm&quot; error on Linux docker.  Note, I'm running an Amazon Linux docker image because ultimately I'm trying to get this to work on ECS, though at the moment im testing this on my Docker Desktop for Windows.</p>
  <p>Do any of you have any suggestion on what to try?  I've tried MANY combnations of the krb5.conf and various java command line flags, but nothing has worked yet.</p>
  <p>Below is all the pertinent kerberos config items I've been using.</p>
  <p><strong>Command to run jar on docker instance</strong></p>
  <pre><code>java -jar app.jar  -Djava.security.krb5.conf=/opt/krb5.conf  -Djava.security.auth.login.config=/opt/jaas.conf -Djavax.security.auth.useSubjectCredsOnly=false
  </code></pre>
  <p><strong>EXCEPTION</strong></p>
  <pre><code>Caused by: org.ietf.jgss.GSSException: Invalid name provided (Mechanism level: KrbException: Cannot locate default realm)
          at sun.security.jgss.krb5.Krb5NameElement.getInstance(Krb5NameElement.java:129) ~[na:1.8.0_252]
          at sun.security.jgss.krb5.Krb5MechFactory.getNameElement(Krb5MechFactory.java:95) ~[na:1.8.0_252]
          at sun.security.jgss.GSSManagerImpl.getNameElement(GSSManagerImpl.java:203) ~[na:1.8.0_252]
          at sun.security.jgss.GSSNameImpl.getElement(GSSNameImpl.java:477) ~[na:1.8.0_252]
          at sun.security.jgss.GSSNameImpl.init(GSSNameImpl.java:201) ~[na:1.8.0_252]
          at sun.security.jgss.GSSNameImpl.&lt;init&gt;(GSSNameImpl.java:170) ~[na:1.8.0_252]
          at sun.security.jgss.GSSNameImpl.&lt;init&gt;(GSSNameImpl.java:151) ~[na:1.8.0_252]
          at sun.security.jgss.GSSManagerImpl.createName(GSSManagerImpl.java:128) ~[na:1.8.0_252]
          at com.microsoft.sqlserver.jdbc.KerbAuthentication.intAuthInit(KerbAuthentication.java:58) ~[mssql-jdbc-7.4.1.jre8.jar!/:na]
  </code></pre>
  <p><strong>krb5.conf</strong></p>
  <pre><code>[libdefaults]
  default_realm = US.TEST.COM
  dns_lookup_kdc = true
  dns_lookup_realm = true
  ticket_lifetime = 86400
  renew_lifetime = 604800
  forwardable = true
  default_tgs_enctypes = rc4-hmac
  default_tkt_enctypes = rc4-hmac
  permitted_enctypes = rc4-hmac
  udp_preference_limit = 1
  
  [realms]
  US.TEST.COM = {
  kdc = crldap1.us.test.com
  admin_server =crldap1.us.test.com
  }
  
  [domain_realm]
   .us.test.com = US.TEST.COM
   us.test.com = US.TEST.COM
  
   
  
  [default_realm]
   .us.test.com = US.TEST.COM
   us.test.com = US.TEST.COM
  </code></pre>
  <p><strong>jaas.conf</strong></p>
  <pre><code>Client {
    com.sun.security.auth.module.Krb5LoginModule required
    useKeyTab=false
    useTicketCache=true
    doNotPrompt=true;
  };
  </code></pre>
  <p><strong>Connection String</strong></p>
  <pre><code>spring.datasource.url =jdbc:sqlserver://DBSERVER\\SERVER_DEV;databaseName=DB1;authenticationScheme=JavaKerberos;integratedSecurity=true;userName=user@US.TEST.COM;password=P@SSW0RD
  </code></pre>