War with Japan was not a surprise for most Americans. What was a surprise was that Japan could successfully attack the headquarters of the entire Pacific fleet, which had recently been moved from the mainland to Hawaii to be within better striking distance of Japan in time of war.
From the Wikapedia link above
A Gallup poll just before the attack on Pearl Harbor found that 52% of Americans expected war with Japan, 27% did not expect war, and 21% had no opinion.[31] While U.S. Pacific bases and facilities had been placed on alert on multiple occasions, U.S. officials doubted Pearl Harbor would be the first target. They expected the Philippines to be attacked first. This presumption was due to the threat that the air bases throughout the country and the naval base at Manila posed to sea lanes, as well as the shipment of supplies to Japan from territory to the south.[32] They also incorrectly believed that Japan was not capable of mounting more than one major naval operation at a time.[33]