Your shields are probably using the same pins and causing conflicting pins. I don't know if you have considered this, but is the same problem that i am struggling with and don't know how to resolve it.
I am trying a code that works correctly if I try it with the shield separated, but when I try it with the whole system it reset at first.
The GSM shield communicates with the Arduino using a variation of SoftwareSerial, on pins 2 and 3.
The (deprecated) XBee shield has jumpers that define what pins are used by the Arduino to talk to the XBee. Neither of you has said anything about which position the jumpers are in.