How many wires are in the junction box?
If the lighting circuit is going through it then there should be a permanent live. Usually 2 or 3 live wires on the same terminal, with the switched live on another terminal going to the ceiling light.Test it with a live tester...