And the night following the Lord stood by him, and said, Be of good cheer, Paul: for as thou hast testified of me in Jerusalem, so must thou bear witness also at Rome.
Note 1 at Ac 23:11: Because the Lord told Paul to be of good cheer, it can be assumed that Paul needed cheering up. During a previous imprisonment, Paul and Silas cheered themselves up through the power of the Holy Ghost and broke into songs of praise at midnight (Ac 16:25). It can only be speculated as to what the differences might have been in this instance.
One possible difference may have been Paul's confidence level--whether he was doing what the Lord wanted him to do. Before Paul was thrown in jail in Philippi, he had been given a vision in which he was told to go to that city and preach the Gospel (Ac 16:9). Paul was assured that the Lord had sent him to Philippi (Ac 16:10).
In this instance, Paul had received two prophecies warning him against going to Jerusalem (see note 4 at Ac 21:4 and note 2 at Ac 21:11). It is possible that Paul was contemplating whether or not he had missed God (see note 2 at this verse).
It is true that our ability to rejoice in trying situations is increased when we know that we are in that position at God's leading and not because of our own stubbornness.
Note 2 at Ac 23:11: It cannot be said for certain that Paul was in any disobedience in going to Jerusalem (see note 1 at this verse). However, if there were any questions as to whether or not the Lord's blessing was still upon Paul, they were all erased as the Lord Jesus Himself cheered Paul up and reassured him that he would preach the Gospel in Rome.
This might lead some to expect that there would be no more problems; the Lord had spoken. However, we find that Paul was left in prison another two years just to please the Jews (Ac 24:27). At that time, the Jews made another attempt to kill Paul (Ac 25:2-3), and Paul finally appealed to the judgment seat of Caesar (Ac 25:10-11). This led to a long and dangerous voyage to Rome, where Paul fasted for many days to assure his safety and the safety of the others on the ship.
Being in the Lord's will does not guarantee us the absence of problems (see note 3 at Ac 16:10).