title: Cannot get TGT from AD
body: <p>I'm trying to get a TGT for authentication from the Active Directory using JAVA.</p>
  
  <p>This is my code:</p>
  
  <pre><code>try
  {
      URL localURL = super.getClass().getResource("jaas_ntlm_configuration.txt");
      System.setProperty("java.security.auth.login.config", localURL.toString());
  
      LoginContext localLoginContext = new LoginContext("GetLoginNameKerberos", new SampleCallbackHandler());
  
      localLoginContext.login();
  
      Subject localSubject = localLoginContext.getSubject();
  
      .....
  }
  catch (LoginException localLoginException) {
      localLoginException.printStackTrace();
  }
  </code></pre>
  
  <p>This code works on one server, however, on other server it fails on "localLoginContext.login();" with this output:</p>
  
  <pre><code>&gt;&gt;&gt;KinitOptions cache name is C:\Users\x\krb5cc_x
  LSA: Found Ticket
  LSA: Made NewWeakGlobalRef
  LSA: Found PrincipalName
  LSA: Made NewWeakGlobalRef
  LSA: Found DerValue
  LSA: Made NewWeakGlobalRef
  LSA: Found EncryptionKey
  LSA: Made NewWeakGlobalRef
  LSA: Found TicketFlags
  LSA: Made NewWeakGlobalRef
  LSA: Found KerberosTime
  LSA: Made NewWeakGlobalRef
  LSA: Found String
  LSA: Made NewWeakGlobalRef
  LSA: Found DerValue constructor
  LSA: Found Ticket constructor
  LSA: Found PrincipalName constructor
  LSA: Found EncryptionKey constructor
  LSA: Found TicketFlags constructor
  LSA: Found KerberosTime constructor
  LSA: Finished OnLoad processing
  &gt;&gt; Acquire default native Credentials
  LSA: Found KrbCreds constructor
  LSA: Got handle to Kerberos package
  LSA: Response size is 1556
  LSA: Principal domain is SUB.DOMAIN.COM
  LSA: Name type is 1
  LSA: Name count is 1
  LSA: Principal domain is SUB.DOMAIN.COM
  LSA: Name type is 2
  LSA: Name count is 2
  LSA: Session key all zero. Stop.
  &gt;&gt;&gt; Found no TGT's in LSA
  javax.security.auth.login.LoginException: Unable to obtain Princpal Name for authentication
      at com.sun.security.auth.module.Krb5LoginModule.promptForName(Unknown Source)
      at com.sun.security.auth.module.Krb5LoginModule.attemptAuthentication(Unknown Source)
      at com.sun.security.auth.module.Krb5LoginModule.login(Unknown Source)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
      at java.lang.reflect.Method.invoke(Unknown Source)
      at javax.security.auth.login.LoginContext.invoke(Unknown Source)
      at javax.security.auth.login.LoginContext.access$000(Unknown Source)
      at javax.security.auth.login.LoginContext$4.run(Unknown Source)
      at javax.security.auth.login.LoginContext$4.run(Unknown Source)
      at java.security.AccessController.doPrivileged(Native Method)
      at javax.security.auth.login.LoginContext.invokePriv(Unknown Source)
      at javax.security.auth.login.LoginContext.login(Unknown Source)
      at my.test.MyTest.main(MyTest.java:123)
  </code></pre>
  
  <p>Can you please help me understanding what is the problem?</p>
  
  <p>Thanks.</p>