Install and customize a new module in openmrs core v2.2.0-SNAPSHOT

Hello! I’m new in openmrs community, i want to build and install a new module in openmrs core v2.2.0-SNAPSHOT. I followed the instructions described in documentation, but i have some problem. I have successfully created the module using Maven Archetype. When i import it in opemmrs dashboard the link of module is not visible and it is impossible to use it. What would i solved this problem, please?

What errors are you getting? You can try https://wiki.openmrs.org/display/docs/OpenMRS+SDK too over the maven archetype

After importing from dashboard area it is not visible in the dashboard are. Is there any configuration to make it visible in the dashboard are?

when i use Openmrs SDK i have this problem.

If you want to enable remote debugging by default when running the server, specify the port number here (e.g. 1044). Leave blank to disable debugging. (Do not do this on a production server) (default: ‘no debugging’):

Which database would you like to use?:

  1. MySQL 5.6 (requires pre-installed MySQL 5.6)
  2. MySQL 5.6 in SDK docker container (requires pre-installed Docker)
  3. Existing docker container (requires pre-installed Docker)

Which one do you choose? [1/2/3]: 1

The distribution requires MySQL database. Please specify database uri (-DdbUri) (default: ‘jdbc:mysql://localhost:3306/@DBNAME@’):

Please specify database username (-DdbUser) (default: ‘root’): root [INFO] ------------------------------------------------------------------------ [INFO] BUILD FAILURE [INFO] ------------------------------------------------------------------------ [INFO] Total time: 01:00 h [INFO] Finished at: 2017-03-20T12:38:48+01:00 [INFO] Final Memory: 21M/274M [INFO] ------------------------------------------------------------------------ [ERROR] Failed to execute goal org.openmrs.maven.plugins:openmrs-sdk-maven-plugin:3.8.2:setup (default-cli) on project standalone-pom: Failed to setup server: NullPointerException -> [Help 1] [ERROR] [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch. [ERROR] Re-run Maven using the -X switch to enable full debug logging. [ERROR] [ERROR] For more information about the errors and possible solutions, please read the following articles: [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException

Try creating a user with a password, root with a blank password tends to cause issues

OK. I will try it. But it’s not my first problem.


After creating module using Maven Archtype, is there any configuration to enable it in dashboard after installation (manage module in dashboard)?

@dariuso can you look at your tomcat logs? You could be getting errors. If you are referring to the one in the legacy ui, then your module needs to have this: https://github.com/openmrs/openmrs-module-addresshierarchy/blob/master/omod/src/main/resources/config.xml#L25

This is my tomcat log.

WARN - Module.expandExtensionNames(575) |2017-03-20 14:04:18,206| basicexample: Unable to find class definition for extension: 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:760) 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:637) at org.openmrs.module.ModuleClassLoader.loadClass(ModuleClassLoader.java:556) at java.lang.ClassLoader.loadClass(ClassLoader.java:357) at org.openmrs.module.Module.expandExtensionNames(Module.java:567) at org.openmrs.module.Module.getExtensions(Module.java:494) at org.openmrs.module.ModuleFactory.stopModule(ModuleFactory.java:1248) at org.openmrs.module.ModuleFactory.stopModule(ModuleFactory.java:1086) at org.openmrs.module.web.controller.ModuleListController.onSubmit(ModuleListController.java:261) at org.springframework.web.servlet.mvc.SimpleFormController.processFormSubmission(SimpleFormController.java:274) at org.springframework.web.servlet.mvc.AbstractFormController.handleRequestInternal(AbstractFormController.java:275) at org.springframework.web.servlet.mvc.AbstractController.handleRequest(AbstractController.java:146) at org.springframework.web.servlet.mvc.SimpleControllerHandlerAdapter.handle(SimpleControllerHandlerAdapter.java:50) at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:943) at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:877) at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:966) at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:868) at javax.servlet.http.HttpServlet.service(HttpServlet.java:707) at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:842) at javax.servlet.http.HttpServlet.service(HttpServlet.java:790) at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:816) at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1686) at org.openmrs.module.web.filter.ForcePasswordChangeFilter.doFilter(ForcePasswordChangeFilter.java:60) at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1669) at org.openmrs.module.web.filter.ModuleFilterChain.doFilter(ModuleFilterChain.java:73) at org.openmrs.module.web.filter.ModuleFilter.doFilter(ModuleFilter.java:57) at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1669) at org.openmrs.web.filter.OpenmrsFilter.doFilterInternal(OpenmrsFilter.java:109) at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1669) at org.springframework.orm.hibernate4.support.OpenSessionInViewFilter.doFilterInternal(OpenSessionInViewFilter.java:150) at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1669) at org.openmrs.web.filter.StartupFilter.doFilter(StartupFilter.java:106) at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1669) at org.openmrs.web.filter.StartupFilter.doFilter(StartupFilter.java:106) at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1669) at org.openmrs.web.filter.StartupFilter.doFilter(StartupFilter.java:106) at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1669) at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:88) at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1669) at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:581) at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:143) at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:548) at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:226) at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1156) at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:511) at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:185) at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1088) at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141) at org.eclipse.jetty.server.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:213) at org.eclipse.jetty.server.handler.HandlerCollection.handle(HandlerCollection.java:109) at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:119) at org.eclipse.jetty.server.Server.handle(Server.java:517) at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:306) at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:242) at org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:245) at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:95) at org.eclipse.jetty.io.SelectChannelEndPoint$2.run(SelectChannelEndPoint.java:75) at org.eclipse.jetty.util.thread.strategy.ExecuteProduceConsume.produceAndRun(ExecuteProduceConsume.java:213) at org.eclipse.jetty.util.thread.strategy.ExecuteProduceConsume.run(ExecuteProduceConsume.java:147) at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:654) at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:572) at java.lang.Thread.run(Thread.java:745) Caused by: java.lang.ClassNotFoundException: org.openmrs.module.web.extension.AdministrationSectionExt at org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy.loadClass(SelfFirstStrategy.java:50) at org.codehaus.plexus.classworlds.realm.ClassRealm.unsynchronizedLoadClass(ClassRealm.java:271) at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClass(ClassRealm.java:247) at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClass(ClassRealm.java:239) at org.eclipse.jetty.webapp.WebAppClassLoader.loadClass(WebAppClassLoader.java:470) at org.eclipse.jetty.webapp.WebAppClassLoader.loadClass(WebAppClassLoader.java:421) at org.openmrs.module.ModuleClassLoader.loadClass(ModuleClassLoader.java:563) at java.lang.ClassLoader.loadClass(ClassLoader.java:357) … 73 more

You could use http://pastebin.com/ to share such long files. Please make sure your AdministrationSectionExt class is well provided in the extension tag within your config.xml in your project

This is my config.xml file. Please look and tell me.

<?xml version="1.0" encoding="UTF-8"?>
<!-- Module Properties -->
<id>${project.parent.artifactId}</id>
<name>${project.parent.name}</name>
<version>${project.parent.version}</version>
<package>${project.parent.groupId}.${project.parent.artifactId}</package>
<author>clinton.tsafack</author>
<description>
	${project.parent.description}
</description>
<updateURL>https://modules.openmrs.org/modules/download/${project.parent.artifactId}/update.rdf</updateURL>
<require_version>${openMRSVersion}</require_version>
<!-- / Module Properties -->


<!-- Module Activator -->
<activator>${project.parent.groupId}.${project.parent.artifactId}.BasicExampleActivator</activator>


<!-- Adds link to admin page -->
<extension>
	<point>org.openmrs.admin.list</point>
	<class>${project.parent.groupId}.${project.parent.artifactId}.extension.html.AdminList</class>
</extension>

<!-- Maps hibernate file's, if present -->
<mappingFiles>
			
	BasicExample.hbm.xml
			
</mappingFiles>

<!-- Internationalization -->
<!-- All message codes should start with ${project.parent.artifactId}. -->
<messages>
	<lang>en</lang>
	<file>messages.properties</file>
</messages>
<messages>
	<lang>fr</lang>
	<file>messages_fr.properties</file>
</messages>
<messages>
	<lang>es</lang>
	<file>messages_es.properties</file>
</messages>
<!-- /Internationalization -->

Log after importing module. WARN - Module.expandExtensionNames(575) |2017-03-20 14:34:01,635| basicexample: Unable to find class definition for extension: 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:760) 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:637) at org.openmrs.module.ModuleClassLoader.loadClass(ModuleClassLoader.java:556) at java.lang.ClassLoader.loadClass(ClassLoader.java:357) at org.openmrs.module.Module.expandExtensionNames(Module.java:567) at org.openmrs.module.Module.getExtensions(Module.java:494) at org.openmrs.module.ModuleFactory.stopModule(ModuleFactory.java:1248) at org.openmrs.module.ModuleFactory.stopModule(ModuleFactory.java:1086) at org.openmrs.module.web.controller.ModuleListController.onSubmit(ModuleListController.java:261) at org.springframework.web.servlet.mvc.SimpleFormController.processFormSubmission(SimpleFormController.java:274) at org.springframework.web.servlet.mvc.AbstractFormController.handleRequestInternal(AbstractFormController.java:275) at org.springframework.web.servlet.mvc.AbstractController.handleRequest(AbstractController.java:146) at org.springframework.web.servlet.mvc.SimpleControllerHandlerAdapter.handle(SimpleControllerHandlerAdapter.java:50) at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:943) at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:877) at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:966) at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:868) at javax.servlet.http.HttpServlet.service(HttpServlet.java:707) at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:842) at javax.servlet.http.HttpServlet.service(HttpServlet.java:790) at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:816) at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1686) at org.openmrs.module.web.filter.ForcePasswordChangeFilter.doFilter(ForcePasswordChangeFilter.java:60) at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1669) at org.openmrs.module.web.filter.ModuleFilterChain.doFilter(ModuleFilterChain.java:73) at org.openmrs.module.web.filter.ModuleFilter.doFilter(ModuleFilter.java:57) at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1669) at org.openmrs.web.filter.OpenmrsFilter.doFilterInternal(OpenmrsFilter.java:109) at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1669) at org.springframework.orm.hibernate4.support.OpenSessionInViewFilter.doFilterInternal(OpenSessionInViewFilter.java:150) at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1669) at org.openmrs.web.filter.StartupFilter.doFilter(StartupFilter.java:106) at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1669) at org.openmrs.web.filter.StartupFilter.doFilter(StartupFilter.java:106) at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1669) at org.openmrs.web.filter.StartupFilter.doFilter(StartupFilter.java:106) at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1669) at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:88) at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1669) at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:581) at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:143) at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:548) at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:226) at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1156) at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:511) at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:185) at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1088) at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141) at org.eclipse.jetty.server.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:213) at org.eclipse.jetty.server.handler.HandlerCollection.handle(HandlerCollection.java:109) at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:119) at org.eclipse.jetty.server.Server.handle(Server.java:517) at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:306) at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:242) at org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:245) at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:95) at org.eclipse.jetty.io.SelectChannelEndPoint$2.run(SelectChannelEndPoint.java:75) at org.eclipse.jetty.util.thread.strategy.ExecuteProduceConsume.produceAndRun(ExecuteProduceConsume.java:213) at org.eclipse.jetty.util.thread.strategy.ExecuteProduceConsume.run(ExecuteProduceConsume.java:147) at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:654) at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:572) at java.lang.Thread.run(Thread.java:745) Caused by: java.lang.ClassNotFoundException: org.openmrs.module.web.extension.AdministrationSectionExt at org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy.loadClass(SelfFirstStrategy.java:50) at org.codehaus.plexus.classworlds.realm.ClassRealm.unsynchronizedLoadClass(ClassRealm.java:271) at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClass(ClassRealm.java:247) at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClass(ClassRealm.java:239) at org.eclipse.jetty.webapp.WebAppClassLoader.loadClass(WebAppClassLoader.java:470) at org.eclipse.jetty.webapp.WebAppClassLoader.loadClass(WebAppClassLoader.java:421) at org.openmrs.module.ModuleClassLoader.loadClass(ModuleClassLoader.java:563) at java.lang.ClassLoader.loadClass(ClassLoader.java:357) … 73 more

@dariuso did you see my previous post? :slight_smile:

Yes i am. But the problem is not legacyui module.


I think i see the origin of the problem. I have installed openmrs v2.2.0-SNAPSHOT. But in creation module i choose the default value in this question: OpenMRS version to depend on: 1.8.2: and the file AdministrationExtensionList.java is not present in openmrs v2.2.0-SNAPSHOT.

@dariuso did you even try to do what i told you? Of course you will also need to have the legacyui module in your modules folder.

OK. Thanks you @dkayiwa. It works very well now.

Thanks for your helps to everyone

1 Like