Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to start the module #39

Closed
MzeeAlii opened this issue Jul 24, 2017 · 9 comments
Closed

Unable to start the module #39

MzeeAlii opened this issue Jul 24, 2017 · 9 comments

Comments

@MzeeAlii
Copy link

I've tried to clone and build from sources and I had this error while trying to start the module.
This was the error: Unable to load/find moduleActivator:
'org.openmrs.module.teammodule.BasicModuleActivator' Module: Team Management Module

Then I tried to use the .omod file from Releases page: https://github.com/OpenSRP/opensrp-server/releases
There's this new error now: Error while trying to start module
Unable to update data model using liquibase.xml. Module: Team Management Module

@maimoonak
Copy link
Contributor

Which version of OpenMRS you are currently using?

@MzeeAlii
Copy link
Author

I'm on OpenMRS v2.0.5. Cloned and built from source.

@maimoonak
Copy link
Contributor

The current version on master branch is 1.x.x which was for openmrs 1.9.x to 1.11.x.

Could you try the branch/release 2.x.x of this module with your openmrs.

The error "Error while trying to start module Unable to update data model using liquibase.xml. Module: Team Management Module is due to liquibase discrepency. "

To reset your DB for new version
1 - Run query
SELECT * FROM openmrs.liquibasechangelog WHERE AUTHOR LIKE 'shak%';
2 - Delete row with ID column = teammodule-10.1.0A
3 - Drop table team_member_patient

Or alternatively reset your openmrs instance and install module 2.x.x again.

@MzeeAlii
Copy link
Author

Tried to checkout branch 2.x.x, after build it the output was teammodule-2.0.0B.omod then I did as you (@maimoonak) instructed i.e. reset my DB for new version.
At first SELECT * FROM openmrs.liquibasechangelog WHERE AUTHOR LIKE 'shak%'; gave 1 row, delete the row and drop the table (oh, there was no table team_member_patient at all). Restarted my OpenMRS hoping the problem is gone but.. NOT! Still the very same error and the query returns 0 rows now (Empty set). Strange. 🤔

@maimoonak
Copy link
Contributor

Your modules screen might be looking like this

image

1- Delete/remove the module from openmrs
2- Restart openmrs
3- Run following on DB

DROP TABLE IF EXISTS `openmrs`.`member_location`;
DROP TABLE IF EXISTS `openmrs`.`team_lead`; 
DROP TABLE IF EXISTS `openmrs`.`team_member_patient`;
DROP TABLE IF EXISTS `openmrs`.`team_member`;
DROP TABLE IF EXISTS `openmrs`.`team`;
DELETE FROM openmrs.liquibasechangelog where id like 'teammodule%';

4- Upload module 2.x.x again.

After uploading module it should look like this

image

image

@MzeeAlii
Copy link
Author

Man, I did as you said and .... Voila! You genius.. Thanks @maimoonak (BIG TIME!) It's been a third day trying different ways to solve this.

screenshot from 2017-07-25 14-16-25

@maimoonak
Copy link
Contributor

Cool.

This sometimes happens with OpenMRS modules. Ideally liquibase existing changesets should never be modified and if there is a modification required, it should be added as a new and subsequent changeset.

Liquibase makes entries in table liquibasechangelog to keep track of executed changesets with a checksum/hash. When changeset is modified the checksum is found different and this error is encountered.

In above script we removed all tables created by previous version of team module, and also deleted all liquibase entries made by this module to allow module installation start from point zero. Offcourse, if it were production server, we never had deleted the tables. Also we never delete liquibase entries to avoid already executed changesets run again (this sometimes can also cause failed installations)

@MzeeAlii
Copy link
Author

Copy that. 👍
Note taken.

@kizomanizo
Copy link

Followed @maimoonak process, all DELETES found nothing safe for the one that calls for team table deletion, I got a foreign key checking error, had to do some dirty work of disabling the check, deleting the table and enabling back the checks. It worked!

mysql> DROP TABLE IF EXISTS `openmrs`.`team`;
ERROR 1217 (23000): Cannot delete or update a parent row: a foreign key constraint fails
mysql> SET FOREIGN_KEY_CHECKS=0;
Query OK, 0 rows affected (0.00 sec)

mysql> DROP TABLE IF EXISTS `openmrs`.`team`;
Query OK, 0 rows affected (0.01 sec)

mysql> SET FOREIGN_KEY_CHECKS=1;
Query OK, 0 rows affected (0.00 sec)

mysql> DELETE FROM openmrs.liquibasechangelog where id like 'teammodule%';
Query OK, 11 rows affected (0.03 sec)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants