This is usually caused by not baking the cake long enough. Make sure to bake the cake until a toothpick inserted into the center comes out clean.