Useful as long as you have the nuclear reactor and massive battery banks necessary to power the things.
Additionally the batteries will have a lifespan, much like those on hybrid and electric vehicles (which can easily be a third the cost of a new vehicle, and making them a lot more expensive to purchase as used working vehicles 10 years later like you can combustion engine vehicles because you will need a battery that is worth more than the blue book value, but that is another topic.)
The batteries will slowly degrade and the charge they can hold will as well, so eventually they will have to be replaced at enormous cost. The massive charge and discharge required in the system will accelerate battery degradation.
The system altogether is expensive and any problem with a component brings the advanced weapon to a halt.
Traditional guns are more independent of each other. If one is damaged, destroyed, or simply has some problems the others can continue to work while that one is serviced.
If there is a short or electrical, battery, or power issue with a rail gun armed vessel you have the whole battery of rail guns is down until the system is back up.
This makes them more sensitive to unexpected problems and maintenance issues.
This would also appear to me to make them a lot more vulnerable to damage. Not a huge issue attacking weak nations without forces able to reach and damage a protected naval vessel at sea, but a liability in fighting forces that can actually inflict damage to naval vessels. Instead of the loss of what is directly damaged, the entire system may be offline because one portion of the system is damaged.