It's true that they did have problems towards the end.
Around 2000 they seemed to have problems with piston skirts - others will disagree, but it seems to be 99-02 with the most frequent piston skirt droppage. Mine has started to chatter ... we'll see what happens.
Overheating - someone else already mentioned that. The radiator on the 4.0L Cherokee is smaller than the 2.5L cherokee. The Cherokee XJ was never meant for such a large (physical size) engine and there had to be compromises. With that said, I can go off roading on a 90 degree day, beat on it pretty good with the AC on and not go above 220. 220 is safe for these. A new radiator is on the list for me.
Also, it's important to remember that the 4.0 was designed to run at 210-220. They NEED to run that temperature to be most efficient. If your 4.0 is running at 180 or below ... it's going to get poor mileage and you won't be getting the oil up to the proper temperature.
They are a great engine for what they are. Simple, 12 valve 6 cylinder, old style engine. Modern engines can make a lot more power and be more efficient ... but they are significantly more complex.
A lot of people are under the false assumption that they are only good under 1500RPM. They are most efficient around 2K or a hair above. Quite a few people I have seen get BETTER highway mileage when swapping out the 3.07 gears (5 speed) for 3.55 gears. The best mileage I ever got out of one was on a 2004 Wrangler Rubicon with 4.10 gears.
The emissions ended up killing them. The last few years of the 4.0 had to be loaded with catalysts to get them to meet California emissions.
I love the Jeep 4.0 engine. I'll probably be adding another vehicle equipped with one to the fleet soon.
The reality is - it's an agricultural engine by today's standards. Not a lot of power (decent torque though), not "green", inefficient and can't wind it up to 7K RPM to get higher numbers out of it.