1 Kings 2:28-31
Adonijah was David's 4th son and the logical choice to succeed the throne. He was half-brother to Solomon. Adonijah and Joab (the general) planned to take the throne. However, David declared Solomon the king. Joab and Adonijah went to the altar for safety, but judgment had come. Joab feared for his life, he knew judgment was coming, but he waited until the end to seek forgiveness. King Solomon said to come forth, yet Joab refused and died there at the altar. Adonijah was dismissed but later made another attempt and was executed.
Adonijah and his general Joab figured they would be sheltered by grasping the horns of the altar of burnt offerings in the Tabernacle. They planned to put themselves under God's protection, but it did not work. Solomon conceded Adonijah a relief, however, Joab would not relinquish the horns of the altar, so he died there. The punishment fits the crime of murder like Joab.
Man's customs do not always follow God's will. God's purpose is fulfilled despite man's actions. Outward resort to ordinances does not win salvation. If man waits to hear his last rites, he will die there. Sacraments do not work - communion. Waiting until the deathbed to look at a minister instead of Christ does not work. Feelings of dread, despair, or despondency do not work. Yes, Christ will save a soul that is lost and that is truly repentant, but why wait?
Joab had consumed his time on earth attempting to protect his position as David's general. Twice David attempted to remove him, and on both occasions, Joab deceptively killed his opponents before they could assume their roles. Since Joab was in his administration, David was eventually liable for these deaths. In any case, for political and military reasons, David chose not to openly rebuff Joab. But rather, he had placed a curse on Joab and his family. In rebuffing Joab, Solomon was openly pronouncing David was not part of Joab's violations, in this way expelling the blame from David and setting it on Joab where it should have been. (2 Samuel 3:17-30, 2 Samuel 20:4-10)
Nothing can substitute for Christ's work and role His role in salvation.