There is a lot of research going on with all the various types of weapons being described.
The first and most fundamental problem with high energy lasers, particle beams or electromagnetic accelerators ("Rail guns") is the power supply. Factory sized laser cutters are wired into the city power grid; an AC-130 is not.
The second problem is power control. When you press the trigger, you are closing a circuit which has megawatts of energy behind it. The sudden surge of energy through the system can blow a lot of circuitry, imagine lining up for a shot and hearing the equivalent of circuit breakers popping (or being electrocuted!)
The third problem is heat dissipation, as has been mentioned. A typical laser only converts a small percentage (3-10%, depending on the type) of the energy to laser light, and other systems are not any better. If you have a 3 Megawatt shot, you have
hundreds of Megawatts of energy surging through the system as waste heat.
After that, pointing and tracking are almost trivial
Possible countermeasures might include covering the target with a foamed material that "burns away" when struck by a laser or particle beam, having the target rotate to prevent the beam from staying on one spot on the target (missiles or projectiles only), emitting opaque clouds of smoke to absorb the laser beam, powerful magnetic fields to deflect the particle beams, and elaborate arrays of active and passive armour to deflect/absorb a rail gun projectile.
Just hit them with a beam of anti-matter I say! ;D