Do this process to check for what code it is throwing:
Turn the ignition key until the digital odometer displays, repeat three times in succession and then back to "On" (On/Off, On/Off, On/Off, On). At the fourth "On" the odometer will be replaced with codes. If no codes are present then "Done" will appear.
Once you get the code, post it here
Sounds like P0320...crankshaft positioning sensor. Very common in WJ's.
If so, look at NELLY246's thread, 'engine cuts out while driving.' I'd be willing to bet this is your issue, and I and others helped him diagnose and fix it himself.