platform warning due to owa extension

Hi,

when I run a current 2.2.0-SNAPSHOT of the platform using the openmrs-sdk I get

WARN - Module.expandExtensionNames(573) |2018-03-11 12:36:57,211| owa: Unable to create instance of class defined for extension point: org.openmrs.admin.list
java.lang.NoClassDefFoundError: org/openmrs/module/web/extension/AdministrationSectionExt
	at java.lang.ClassLoader.defineClass1(Native Method)
	at java.lang.ClassLoader.defineClass(ClassLoader.java:763)
	at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
	at java.net.URLClassLoader.defineClass(URLClassLoader.java:467)
	at java.net.URLClassLoader.access$100(URLClassLoader.java:73)
	at java.net.URLClassLoader$1.run(URLClassLoader.java:368)
	at java.net.URLClassLoader$1.run(URLClassLoader.java:362)
	at java.security.AccessController.doPrivileged(Native Method)
	at java.net.URLClassLoader.findClass(URLClassLoader.java:361)
	at org.openmrs.module.ModuleClassLoader.loadClass(ModuleClassLoader.java:640)
	at org.openmrs.module.ModuleClassLoader.loadClass(ModuleClassLoader.java:559)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
	at org.openmrs.module.Module.expandExtensionNames(Module.java:565)
	at org.openmrs.module.Module.getExtensions(Module.java:492)
	at org.openmrs.module.ModuleFactory.startModuleInternal(ModuleFactory.java:701)
	at org.openmrs.api.context.Daemon$1.run(Daemon.java:74)
Caused by: java.lang.ClassNotFoundException: org.openmrs.module.web.extension.AdministrationSectionExt
	at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1856)
	at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1705)
	at org.openmrs.module.ModuleClassLoader.loadClass(ModuleClassLoader.java:566)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
	... 16 more

which stems from the fact that the class

org/openmrs/module/web/extension/AdministrationSectionExt

is in the legacyui and not in the platform.

Is this more than just a warning? Could it be an issue in the OWA? If the OWA needs the legacyui why do we ship it without?

The OWA module has two things. The API and a UI for managing open web apps. The UI requires the legacyui module. Without this UI, one can use the newly created addon manager to manage open web apps and hence not require the legacyui module. So the above is just a warning.

We should change our module loading code such that it doesn’t report a noisy message like this in the case of something that is expected behavior.

Simplistic approach is to just catch this error and do something like:

log.debug("$moduleName refers to missing extension class $classname.")

A bit nicer for the end user would be to special-case the classnames that used to be in openmrs-core and are now in the legacyui module and do something like:

log.info("$moduleName is trying to add an item to the legacy admin UI. If you want to see this, then install the Legacy UI module")

The correct fix would probably be to change the openmrs-core module framework to allow modules to indicate whether an extension is required or not (defaults to false), and so if a required extension is missing we should fail hard, but if it’s optional then we don’t need a noisy error message. (I do not think this is worth the effort.)

I see the same error (see below) when I try to start the Groovy module. The groovy admin links don’t appear on the old-school admin page. The Legacy UI module is installed and running. Create a ticket?

OpenMRS 2.1.3 Legacy UI Module 1.3.3 Groovy 2.2.4

WARN - Module.expandExtensionNames(575) |2018-08-14 17:38:02,378| groovy: Unable to find class definition for extension: org.openmrs.admin.list java.lang.NoClassDefFoundError: org/openmrs/module/web/extension/AdministrationSectionExt …

Yes create a ticket for the groovy module, which needs to be aware of the legacyui module in its config.xml