A hydraulic excavator comprising: an electric motor; a hydraulic pump driven by the electric motor; a hydraulic device (2A, 3A, 8D, 8E, 8F) driven by pressurized oil delivered from the hydraulic pump; an electricity storage device that supplies power to the electric motor; an inverter provided between the electricity storage device and the electric motor to convert the power; a main controller that controls the hydraulic pump and the hydraulic device (2A, 3A, 8D, 8E, 8F); an electricity storage device controller (22, 43) that controls the electricity storage device; an equipment controller (27, 42, 51) that controls the electric motor, the inverter and the electricity storage device controller (22, 43); and a relay (23, 24, 25) connecting or disconnecting an electrical circuit to which the inverter and the electricity storage device are connected, characterized in that: the equipment controller (27, 42, 51) and the electricity storage device controller (22, 43) each include an excitation current control section (30, 31, 42A, 43A) that controls supply and stop of an excitation current in the relay, when a state of the electricity storage device is determined to be an abnormal state requiring the stop of the excitation current in the relay, the electricity storage device controller (22, 43) transmits an abnormal signal to the equipment controller (27, 42, 51), and the equipment controller (27, 42, 51) executes stop processing of the electric motor and the inverter based upon the abnormal signal from the electricity storage device controller (22, 43), then stops the excitation current in the relay by the excitation current control section (31, 42A) of the equipment controller (27, 42, 51), and transmits a signal of a state of the relay to the electricity storage device controller (22, 43). an electric motor; a hydraulic pump driven by the electric motor; a hydraulic device (2A, 3A, 8D, 8E, 8F) driven by pressurized oil delivered from the hydraulic pump; an electricity storage device that supplies power to the electric motor; an inverter provided between the electricity storage device and the electric motor to convert the power; a main controller that controls the hydraulic pump and the hydraulic device (2A, 3A, 8D, 8E, 8F); an electricity storage device controller (22, 43) that controls the electricity storage device; an equipment controller (27, 42, 51) that controls the electric motor, the inverter and the electricity storage device controller (22, 43); and a relay (23, 24, 25) connecting or disconnecting an electrical circuit to which the inverter and the electricity storage device are connected, characterized in that: the equipment controller (27, 42, 51) and the electricity storage device controller (22, 43) each include an excitation current control section (30, 31, 42A, 43A) that controls supply and stop of an excitation current in the relay, when a state of the electricity storage device is determined to be an abnormal state requiring the stop of the excitation current in the relay, the electricity storage device controller (22, 43) transmits an abnormal signal to the equipment controller (27, 42, 51), and the equipment controller (27, 42, 51) executes stop processing of the electric motor and the inverter based upon the abnormal signal from the electricity storage device controller (22, 43), then stops the excitation current in the relay by the excitation current control section (31, 42A) of the equipment controller (27, 42, 51), and transmits a signal of a state of the relay to the electricity storage device controller (22, 43). the equipment controller (27, 42, 51) and the electricity storage device controller (22, 43) each include an excitation current control section (30, 31, 42A, 43A) that controls supply and stop of an excitation current in the relay, when a state of the electricity storage device is determined to be an abnormal state requiring the stop of the excitation current in the relay, the electricity storage device controller (22, 43) transmits an abnormal signal to the equipment controller (27, 42, 51), and the equipment controller (27, 42, 51) executes stop processing of the electric motor and the inverter based upon the abnormal signal from the electricity storage device controller (22, 43), then stops the excitation current in the relay by the excitation current control section (31, 42A) of the equipment controller (27, 42, 51), and transmits a signal of a state of the relay to the electricity storage device controller (22, 43).