The Abarbanel also maintains that Rebbe Akiva made a mistake:
Rebbe Akiva wanted Moshiach so badly that he believed that Bar Kochba was Moshiach [today there are thousands who make the same mistake about someone else for the same reason]. He saw him winning battles and said that this proves that Hashem is with him. The Abarbanel goes further and says that as a punishment for the AVEIRAH of supporting Bar Kochba, Rebbe Akiva died his horrific death.
The lessons according to this explanation:
1] Someone we want something so badly we lose our subjectivity. We must never confusre our desires with reality.
2] Just because someone is successful doesn't mean that Hashem is happy with him. Bar Kochba was a great general but that doesn't mean that he found favor in the eyes of Hashem. Today people say that since the a project [be it what it is] is successful, it means that Hashem is in favor. The truth is that it doesn't mean that He is in favor. It doesn't mean that He is NOT in favor. We don't know what Hashem is thinking. הנסתרות לה' אלקינו והנגלות לנו ובנינו עד עולם. All we have is the revealed Torah to follow and don't know the secrets of Hashem.
3] Rebbe Akiva made a mistake. Cut him some slack!!! Why the macabre punishment? The answer is that we get punished for mistakes as well - especially great people.
There is a gemara [yoma 19b] that explicates this principle:
ת"ר מעשה בצדוקי אחד שהתקין מבחוץ והכניס ביציאתו היה שמח שמחה גדולה פגע בו אביו אמר. לו בני אף על פי שצדוקין אנו מתיראין אנו מן הפרושים אמר לו כל ימי הייתי מצטער על המקרא הזה (ויקרא טז, ב) כי בענן אראה על הכפורת אמרתי מתי יבוא לידי ואקיימנו עכשיו שבא לידי לא אקיימנו אמרו לא היו ימים מועטין עד שמת והוטל באשפה והיו תולעין יוצאין מחוטמו ויש אומרים ביציאתו ניגף דתני רבי חייא כמין קול נשמע בעזרה שבא מלאך וחבטו על פניו ונכנסו אחיו הכהנים ומצאו ככף רגל עגל בין כתפיו שנאמר (יחזקאל א, ז) ורגליהם רגל ישרה וכף רגליהם ככף רגל עגל:
Our Rabbis taught: There was a Sadducee who had arranged the incense without, and then brought it inside [against the halacha that you arrange the incense inside].
As he left he was exceedingly glad.
On his coming out his father met him and said to him: My son, although we are Sadducees, we are afraid of the Pharisees.
He replied: "All my life was I aggrieved because of this scriptural verse: For I appear in the cloud upon the ark-cover. I would say: When shall the opportunity come to my hand so that I might fulfill it. Now that such opportunity has come to my hand, should I not have fulfilled it?"
It is reported that it took only a few days until he died and was thrown on the dungheap and worms came forth from his nose.
Some say: He was smitten as he came out [of the Holy of Holies].
He was mamesh moser nefesh. He was a "tzadik" of a Tzduki. But he was wrong and paid the price. [See the Sichos Mussar of Rav Chaim Shmuelevitz הסכנה שבטעות].
4] Even great people make mistakes and they remain great. It's not the end of the world. Rebbe Akiva remains the GREATEST!