Is it an AC or DC solenoid? It matters, a lot, because the AC ones rely on their inductance to limit their current and if you connect DC to them, they will overheat and/or destroy your driver transistor. DC solenoids rely on their winding resistance to limit their current; if you feed them AC at their rated voltage, they won't actuate reliably.
If you need to drive an AC solenoid, you can't just use a simple BJT.