Java FlightXML Program Error


#1

I am using the java program that is provided. I have an api key and a username and I have used those in the code I copied and pasted. I have also complete all the necessary imports. When I run the code it prints out the first line “Print Enroute to Aircraft” and then throws the following error:

Exception in thread “main” com.sun.xml.internal.ws.client.ClientTransportException: The server sent HTTP status code 401: Authorization Required

The account with the api key I am trying to use is different from the account I am logged into now. I’m not sure what the error means, but could that cause an issue?

Thanks for your help!


#2

401 means that the HTTP request Authorization header is not being supplied (missing entirely), so it is being rejected due to lack of credentials.

Which Java example are you using (we provide 3 variants)?


#3

I am using the Netbeans version.


#4

You should double check the credentials. In the Authenticator you should have something like (example credentials):
return new PasswordAuthentication(“rsonecha”, “111aaa”.toCharArray());