ERROR: PleskFatalException : Unable to remove hosting: SiteAppManager: Provided Client object is invalid. 2

ERROR: PleskFatalException
Unable to remove hosting: SiteAppManager: Provided Client object is invalid.

Solution: you have to login to psa’s database via MysqlQuery Browser or any other client you want and then the following steps

1) find the domain id, just go to the client of the domain, and in the domain select list,
put your mouse over the domain name, in the status bar of the browser you will see something like:
https://yourserver.tld:8443/domains/dom_ctrl.php3?dom_id=865&previous_page=domains
the domain id there is “dom_id=865”.

2)open the psa database in mysql
3)run: SELECT * FROM SiteApps where dom_id=’865′;
you will see the application in 1 line, then delete it
4)run: DELETE FROM SiteApps where dom_id=’865′;

try again to delete the domain from Plesk.

after that if you receive the error:

ERROR: PleskFatalException
Cannot delete database which is in use by a site application

do the above:
2)open the psa database in mysql
2)run: SELECT * FROM data_bases where dom_id=’865′;
you will see the lines with the databases the domain has,
3)run: DELETE FROM FROM data_bases where dom_id=’865′;

After the 3rd step you will be able to delete the domain from Plesk, just
dont forget to manualy delete the databases (given from step 2) from the mysql server.