That's only necessary if there are other things on the JPanel (buttons other panels etc..)
The problem is that your image is null, as for why, I am not sure, but that is the reason that the dimension with img.getWidth(), and height is throwing a null pointer exception, and it's also the reason that draw image is doing nothing, the documentation states that if img is null nothing will happen.
as for why the image is null, I am not sure, It may be that ImageIO doesn't recognize the file type, try another image, or even changing JPG to lowercase, other than that I don't know