Did you make any configuration changes to 4.2.3? Such as editing any existing configuration file, defining a messaging destinations xml file, or deploying a *-ds.xml file? If so, figure out how to make the corresponding changes in 5.1.0. (Messaging has changed so the destinations file will need changes, database connectivity hasn't so your *-ds.xml files should work without any changes.)
Then deploy your app and fix any issues that arrise.