On a state visit to Japan, the US president put himself at odds with his hosts and his own advisers.