Undoubtedly your Yj has had problems with the aging 4wd vacuum lines and you've either caught them early or been caught with your pants down and been without 4wd. There are several options to fixing this problems starting with the obvious: replacing the lines. But if you've done a motor swap and don't have that vacuum access anymore or just gone to TJ shafts for the larger ujoint or chromoly for strength you would need to do something about your stock vacuum lines and lack of 4wd light.
The obvious thing to do is to look down and see where the shifter is and go from there. If you have a body lift or have lowered the transfer case the obvious might not be so obvious. So here is a recap of a cheaper alternative to the TJ shaft swap above which is just locking the e-clips over. Dodger did a great write up so I won't reinvent the wheel. Here is a link and what it should look like when locked
Notice the configuration of the fork locked off to the side and the vacuum actuated shaft is immobile.
Now on to the electrical side of it. Yanking the vacuum hoses is easy and you only need to locate where they come out to the battery along the firewall and plug it off and discard the rest. I would show a pic but I sent the spaghetti monster to Gage.
Then comes the removal of the old vacuum switch from the transfer case but dont install the new one yet, some fitting will have to be done.Its 1/16" to remove the old one and a 7/8" for the new one. The shorter the better for end wrenches. I will ge the TJ switch number later but I remember they're $17 because I just threw away the receipt yesterday. Here it is:
Or crown # J8134473 it has a longer detent ball that will close the switch better.
Once that's in locate the rest of the wiring specifically this plug for the newer cad styles
Notice how close the pin holes are together?
It doesn't matter. Off with its head!
Strip the wires and twist them together but keep them isolated from the rest of the jeep.
Then jump inside and turn on the acc and look for this:
Next you'll need one of these
Looks like this with two wires
Go ahead and connect it to the two bare wires from the cad. Orientation doesn't matter, its a switch. Then drop the wiring all the way down and feed it over the transmission and toward the transfer case. At this point the plug didn't fit so I had to do some cutting of small tabs inside the switch area to accommodate the plug.
Now you can use the aforementioned 7/8" end wrench to install the TJ switch once you know the plug fits. When I installed it the first time it didn't work. I yanked the plug and filled every crevice with dielectric grease and plugged it back in. I cycled through the gears in the transfer case and lo and behold it worked! It just shows that checking your connections is always worth the effort.