GSOC 2023: Improving the OpenMRS Developer Experience: Updating the SDK - Updates and Discussion

I am seeing the following error on logs. Any thoughts?? @dkayiwa @ibacher @jnsereko

WARN - ModuleFactory.loadAdvice(892) |2023-05-18T17:53:45,078| Could not load advice point: org.openmrs.module.appointments.service.AppointmentServiceDefinitionService
java.lang.NoClassDefFoundError: org/ict4h/atomfeed/transaction/AFTransactionWork
	at java.lang.Class.getDeclaredConstructors0(Native Method) ~[?:1.8.0_362]
	at java.lang.Class.privateGetDeclaredConstructors(Class.java:2671) ~[?:1.8.0_362]
	at java.lang.Class.getConstructor0(Class.java:3075) ~[?:1.8.0_362]
	at java.lang.Class.newInstance(Class.java:412) ~[?:1.8.0_362]
	at org.openmrs.module.AdvicePoint.getClassInstance(AdvicePoint.java:61) ~[openmrs-api-2.5.0.jar:?]
	at org.openmrs.module.ModuleFactory.loadAdvice(ModuleFactory.java:882) [openmrs-api-2.5.0.jar:?]
	at org.openmrs.module.ModuleUtil.refreshApplicationContext(ModuleUtil.java:913) [openmrs-api-2.5.0.jar:?]
	at org.openmrs.module.web.WebModuleUtil.refreshWAC(WebModuleUtil.java:844) [openmrs-web-2.5.0.jar:?]
	at org.openmrs.web.Listener.performWebStartOfModules(Listener.java:611) [openmrs-web-2.5.0.jar:?]
	at org.openmrs.web.Listener.performWebStartOfModules(Listener.java:591) [openmrs-web-2.5.0.jar:?]
	at org.openmrs.web.Listener.startOpenmrs(Listener.java:259) [openmrs-web-2.5.0.jar:?]
	at org.openmrs.web.WebDaemon$1.run(WebDaemon.java:42) [openmrs-web-2.5.0.jar:?]
Caused by: java.lang.ClassNotFoundException: org.ict4h.atomfeed.transaction.AFTransactionWork
	at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1412) ~[catalina.jar:9.0.74]
	at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1220) ~[catalina.jar:9.0.74]
	at org.openmrs.module.ModuleClassLoader.loadClass(ModuleClassLoader.java:564) ~[openmrs-api-2.5.0.jar:?]
	at java.lang.ClassLoader.loadClass(ClassLoader.java:351) ~[?:1.8.0_362]
	... 12 more
WARN - ModuleFactory.loadAdvice(892) |2023-05-18T17:53:45,080| Could not load advice point: org.openmrs.module.appointments.service.AppointmentsService
java.lang.NoClassDefFoundError: org/ict4h/atomfeed/transaction/AFTransactionWork
	at java.lang.Class.getDeclaredConstructors0(Native Method) ~[?:1.8.0_362]
	at java.lang.Class.privateGetDeclaredConstructors(Class.java:2671) ~[?:1.8.0_362]
	at java.lang.Class.getConstructor0(Class.java:3075) ~[?:1.8.0_362]
	at java.lang.Class.newInstance(Class.java:412) ~[?:1.8.0_362]
	at org.openmrs.module.AdvicePoint.getClassInstance(AdvicePoint.java:61) ~[openmrs-api-2.5.0.jar:?]
	at org.openmrs.module.ModuleFactory.loadAdvice(ModuleFactory.java:882) [openmrs-api-2.5.0.jar:?]
	at org.openmrs.module.ModuleUtil.refreshApplicationContext(ModuleUtil.java:913) [openmrs-api-2.5.0.jar:?]
	at org.openmrs.module.web.WebModuleUtil.refreshWAC(WebModuleUtil.java:844) [openmrs-web-2.5.0.jar:?]
	at org.openmrs.web.Listener.performWebStartOfModules(Listener.java:611) [openmrs-web-2.5.0.jar:?]
	at org.openmrs.web.Listener.performWebStartOfModules(Listener.java:591) [openmrs-web-2.5.0.jar:?]
	at org.openmrs.web.Listener.startOpenmrs(Listener.java:259) [openmrs-web-2.5.0.jar:?]
	at org.openmrs.web.WebDaemon$1.run(WebDaemon.java:42) [openmrs-web-2.5.0.jar:?]
Caused by: java.lang.ClassNotFoundException: org.ict4h.atomfeed.transaction.AFTransactionWork
	at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1412) ~[catalina.jar:9.0.74]
	at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1220) ~[catalina.jar:9.0.74]
	at org.openmrs.module.ModuleClassLoader.loadClass(ModuleClassLoader.java:564) ~[openmrs-api-2.5.0.jar:?]
	at java.lang.ClassLoader.loadClass(ClassLoader.java:351) ~[?:1.8.0_362]
	... 12 more
WARN - ModuleFactory.loadAdvice(892) |2023-05-18T17:53:45,082| Could not load advice point: org.openmrs.module.appointments.service.AppointmentRecurringPatternService
java.lang.NoClassDefFoundError: org/ict4h/atomfeed/transaction/AFTransactionWork
	at java.lang.Class.getDeclaredConstructors0(Native Method) ~[?:1.8.0_362]
	at java.lang.Class.privateGetDeclaredConstructors(Class.java:2671) ~[?:1.8.0_362]
	at java.lang.Class.getConstructor0(Class.java:3075) ~[?:1.8.0_362]
	at java.lang.Class.newInstance(Class.java:412) ~[?:1.8.0_362]
	at org.openmrs.module.AdvicePoint.getClassInstance(AdvicePoint.java:61) ~[openmrs-api-2.5.0.jar:?]
	at org.openmrs.module.ModuleFactory.loadAdvice(ModuleFactory.java:882) [openmrs-api-2.5.0.jar:?]
	at org.openmrs.module.ModuleUtil.refreshApplicationContext(ModuleUtil.java:913) [openmrs-api-2.5.0.jar:?]
	at org.openmrs.module.web.WebModuleUtil.refreshWAC(WebModuleUtil.java:844) [openmrs-web-2.5.0.jar:?]
	at org.openmrs.web.Listener.performWebStartOfModules(Listener.java:611) [openmrs-web-2.5.0.jar:?]
	at org.openmrs.web.Listener.performWebStartOfModules(Listener.java:591) [openmrs-web-2.5.0.jar:?]
	at org.openmrs.web.Listener.startOpenmrs(Listener.java:259) [openmrs-web-2.5.0.jar:?]
	at org.openmrs.web.WebDaemon$1.run(WebDaemon.java:42) [openmrs-web-2.5.0.jar:?]
Caused by: java.lang.ClassNotFoundException: org.ict4h.atomfeed.transaction.AFTransactionWork
	at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1412) ~[catalina.jar:9.0.74]
	at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1220) ~[catalina.jar:9.0.74]
	at org.openmrs.module.ModuleClassLoader.loadClass(ModuleClassLoader.java:564) ~[openmrs-api-2.5.0.jar:?]
	at java.lang.ClassLoader.loadClass(ClassLoader.java:351) ~[?:1.8.0_362]
	... 12 more

You can ignore the above error. Can you navigate to your equivalent of this page and tell us if you have any locations listed? OpenMRS - Login

It only has a one unknown location. Should I add the locations in dev3 manually?

Ps: My add locations page lacks tags “Login Location”, “Facility Location”.

In your OpenMRS application data folder (/var/lib/OpenMRS/) add a configuration directory with these contents: openmrs-distro-referenceapplication/distro/configuration at main · openmrs/openmrs-distro-referenceapplication · GitHub

Then restart tomcat.

I tried this on the server I created with the SDK. After running the server I got an error.

ERROR - SqlExceptionHelper.logExceptions(142) |2023-05-18T20:20:40,495| Column 'uuid' cannot be null

So I removed the configuration directory and restart the server. Now everything works fine. Any reasons why I got errors earlier??

The configuration folder in the OpenMRS data directory has the metadata required by O3 and it is loaded by the initializer module.

So why did I get an error when I ran the server with the configuration directory???

ERROR - SqlExceptionHelper.logExceptions(142) |2023-05-18T20:20:40,495| Column 'uuid' cannot be null

I cannot tell without looking at the full log.

I created a new server and reproduced the error.

  1. When omod.initializer is present in distro.properties, the following error occurs.

Unable to find/resolve artifact. Failure to find org.openmrs.module:initializer-omod:jar:2.5.0 in https://mavenrepo.openmrs.org/public was cached in the local repository, resolution will not be reattempted until the update interval of openmrs-repo has elapsed or updates are forced

  1. I removed omod.initializer from distro.properties and set up the server using the following command:

mvn openmrs-sdk:setup -DserverId=serverName -Ddistro=distro.properties

The server installation was successful.

  1. I manually copied the initializer omod file to the module directory.

  2. I copied the configuration folder to the application directory.

  3. I started the server. The initial setup began but got stuck at 99% while updating the database. Logs: https://pastebin.com/CQKuT8vF.

  4. After restarting the server, the following errors appeared in the log: https://pastebin.com/fHGEwgec

  5. I removed the configurations folder and restarted the server. Now the server works fine with O3.

Can you list the modules in your modules folder?

Screenshot from 2023-05-19 16-51-34

Can you do a fresh setup with only the modules that O3 requires?

Sure. Do I have any extra modules???

Also, should I copy the configuration folder??

Yes you need the configuration folder for the metadata that O3 requires. The github link that i gave you earlier to a pom.xml file has the list of modules for O3.

1 Like

I ran a server with only the modules in pom.xml and the SPA module. Despite encountering a java.sql.SQLIntegrityConstraintViolationException: Column 'uuid' cannot be null error, I continued to wait, and eventually, the initial setup was completed successfully. OpenMRS with O3 is now functioning properly. I now realize that I might have mistakenly assumed that the setup had stalled at 99% during the previous build process with the additional modules.

Logs: O3 - Pastebin.com

These are the steps I did to deploy the O3

To allow developers to deploy O3 with the sdk, we should include a tag like “enableMFE” when running the OpenMRS SDK. When the user sets the value of that tag to true, the SDK should automatically execute the mentioned steps and deploy the server. Any thoughts or recommendations??

cc: @dkayiwa @ibacher @jnsereko

How about simply including the O3 reference application in the list of items under this prompt? You can deploy the following versions of distribution:

can’t we have both @dkayiwa. Since we have only one version of the 3.x Reference application not like Reference application 2.x

Having that option looks like a shortcut.