If you check the api docs for the Arduino MQTT client, you will see that you need to specify the password argument, as well as the username. When connecting to Xively, you use your api key as the username and null for the password:
client.connect("arduinoMQTT", "APIKEY",null)
You should probably use something more unique than arduinoMQTT as a client identifier.
source share