title: com.google.gdata.util.AuthenticationException: Error connecting with login URI
body: <p>I have written a Java application which I am launching with the following command:</p>
  
  <pre><code>java -jar MyApp.jar
  </code></pre>
  
  <p>The application uses Google's GData Java libraries to edit a Google Spreadsheet. When I run this application from my Mac, it runs fine. However, I need to run it on my dedicated server. When I upload it there and try to run it, I receive the following error:</p>
  
  <pre><code>$ java -jar MyApp.jar
  com.google.gdata.util.AuthenticationException: Error connecting with login URI
      at com.google.gdata.client.GoogleAuthTokenFactory.getAuthToken(GoogleAuthTokenFactory.java:489)
      at com.google.gdata.client.GoogleAuthTokenFactory.setUserCredentials(GoogleAuthTokenFactory.java:346)
      at com.google.gdata.client.GoogleService.setUserCredentials(GoogleService.java:362)
      at com.google.gdata.client.GoogleService.setUserCredentials(GoogleService.java:317)
      at org.graalcenter.stats.bot.GraalStatBot.main(GraalStatBot.java:42)
  Caused by: javax.net.ssl.SSLException: java.lang.RuntimeException: Unexpected error: java.security.InvalidAlgorithmParameterException: the trustAnchors parameter must be non-empty
      at sun.security.ssl.Alerts.getSSLException(Alerts.java:208)
      at sun.security.ssl.SSLSocketImpl.fatal(SSLSocketImpl.java:1611)
      at sun.security.ssl.SSLSocketImpl.fatal(SSLSocketImpl.java:1574)
      at sun.security.ssl.SSLSocketImpl.handleException(SSLSocketImpl.java:1557)
      at sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1150)
      at sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1127)
      at sun.net.www.protocol.https.HttpsClient.afterConnect(HttpsClient.java:423)
      at sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.connect(AbstractDelegateHttpsURLConnection.java:185)
      at sun.net.www.protocol.http.HttpURLConnection.getOutputStream(HttpURLConnection.java:850)
      at sun.net.www.protocol.https.HttpsURLConnectionImpl.getOutputStream(HttpsURLConnectionImpl.java:250)
      at com.google.gdata.client.GoogleAuthTokenFactory.makePostRequest(GoogleAuthTokenFactory.java:551)
      at com.google.gdata.client.GoogleAuthTokenFactory.getAuthToken(GoogleAuthTokenFactory.java:487)
      ... 4 more
  Caused by: java.lang.RuntimeException: Unexpected error: java.security.InvalidAlgorithmParameterException: the trustAnchors parameter must be non-empty
      at sun.security.validator.PKIXValidator.(PKIXValidator.java:75)
      at sun.security.validator.Validator.getInstance(Validator.java:178)
      at sun.security.ssl.X509TrustManagerImpl.getValidator(X509TrustManagerImpl.java:129)
      at sun.security.ssl.X509TrustManagerImpl.checkServerTrusted(X509TrustManagerImpl.java:225)
      at sun.security.ssl.X509TrustManagerImpl.checkServerTrusted(X509TrustManagerImpl.java:270)
      at sun.security.ssl.ClientHandshaker.serverCertificate(ClientHandshaker.java:973)
      at sun.security.ssl.ClientHandshaker.processMessage(ClientHandshaker.java:142)
      at sun.security.ssl.Handshaker.processLoop(Handshaker.java:533)
      at sun.security.ssl.Handshaker.process_record(Handshaker.java:471)
      at sun.security.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:904)
      at sun.security.ssl.SSLSocketImpl.performInitialHandshake(SSLSocketImpl.java:1116)
      at sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1143)
      ... 11 more
  Caused by: java.security.InvalidAlgorithmParameterException: the trustAnchors parameter must be non-empty
      at java.security.cert.PKIXParameters.setTrustAnchors(PKIXParameters.java:200)
      at java.security.cert.PKIXParameters.(PKIXParameters.java:120)
      at java.security.cert.PKIXBuilderParameters.(PKIXBuilderParameters.java:104)
      at sun.security.validator.PKIXValidator.(PKIXValidator.java:73)
      ... 22 more
  </code></pre>
  
  <p>This is the code that is causing the error:</p>
  
  <pre><code>    public static void main(String[] args) {
          FeedURLFactory factory = FeedURLFactory.getDefault();
          SpreadsheetService service = new SpreadsheetService("my-app");
  
          try {
              service.setUserCredentials(USER_NAME, USER_PASSWORD, ACCOUNT_TYPE);
          } catch (AuthenticationException ex) {
              ex.printStackTrace();
              System.exit(0);
          }
      }</code></pre>
  
  <p>I have tried Googling the error and it suggests that it is often caused by a proxy; however, I am not behind a proxy on my dedicated server. Other Java applications I have written work fine with the network.</p>
  
  <p>Any ideas how to fix this? All help is appreciated. Thanks!</p>