If you get Invalid License File when you login to cpanel after a hostname change you need to update your cpanel license file by:
Login to to SSH using your root login and run the following from command line:
cd /
./usr/local/cpanel/cpkeyclt
This will update your license information and fix the error.