You have posted in Mountain Lion
This is the OS version that first had Messages.
The most common cause of Messages 7 (It continued from iChat 6) is the lack of a Serial Number that can be read by the OS.
This can be caused by the Mother/logic board being replaced and the Serial Number not "Flashed" back to the new board.
Use the Apple Logo menu top left and then About this Mac
The version number line can be clicked and it will change twice it will change form OS X 10.7.x to numbers an letters on Apple's own numbering system for the OS and then to the Serial Number.
Don't post the Serial Number just let us know if it is there.
You can get similar issue with later version of the OS if the Mac User account is Migrated to the new computer.
In this case open Keychain Access and delete the IDS item that lists your Apple ID and the words Auth Token (IDS: YourApple ID-AUth Token)
If those are not the answer then use this Users Tip When the iMessages account will not Login
7:56 pm Sunday; November 12, 2017
iMac 2.5Ghz i5 2011 (Sierra)
G4/1GhzDual MDD (Leopard 10.5.8)
MacBookPro 2Gb (Snow Leopard 10.6.8)
Mac OS X (10.6.8),
iPhone 6 iOS 11.x and an iPad (2)