For gravity, I think someone already mentioned it it's not so much as gravity attracting something without mass, it's more space and time itself bend around an object with mass, so light can travel in what it thinks is a straight line but is actually a curved path.
How about this one. Take a box with two infinitely reflective mirrors, and place a photon inside so that it bounces back and forth forever. Even though that photon has no mass, it will contribute to the mass of the box!