Unable to run OpenMRS sdk [Resolved]

Hello everyone!

I recently changed my Operating system to Ubuntu 20.04 and tried to setup the machine for development.

I have open-jdk 8 installed,

openjdk version "1.8.0_292"
OpenJDK Runtime Environment (build 1.8.0_292-8u292-b10-0ubuntu1~20.04-b10)
OpenJDK 64-Bit Server VM (build 25.292-b10, mixed mode)

on my machine and mysql 8.0.25

mysql  Ver 8.0.25 for Linux on x86_64 (MySQL Community Server - GPL)

I have been following the wiki document, how to setup the OpenMRS Sdk. I have selected to run a Distribution having Reference application 2.12-SNAPSHOT

i have successfully installed the openmrs-sdk plugin and server on my machine but on running the command mvn openmrs-sdk:run -DserverId=server_name i get the following errors on the browser and console log .

HTTP Status 500 – Internal Server Error

Type Exception Report

Message Error creating bean with name 'sessionFactory': FactoryBean which is currently in creation returned null from getObject

Description The server encountered an unexpected condition that prevented it from fulfilling the request.

Exception

org.springframework.beans.factory.BeanCurrentlyInCreationException: Error creating bean with name 'sessionFactory': FactoryBean which is currently in creation returned null from getObject
	org.springframework.beans.factory.support.FactoryBeanRegistrySupport.doGetObjectFromFactoryBean(FactoryBeanRegistrySupport.java:183)
	org.springframework.beans.factory.support.FactoryBeanRegistrySupport.getObjectFromFactoryBean(FactoryBeanRegistrySupport.java:135)
	org.springframework.beans.factory.support.AbstractBeanFactory.getObjectForBeanInstance(AbstractBeanFactory.java:1828)
	org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.getObjectForBeanInstance(AbstractAutowireCapableBeanFactory.java:1265)
	org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:261)
	org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:207)
	org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:1115)
	org.springframework.orm.hibernate5.support.OpenSessionInViewFilter.lookupSessionFactory(OpenSessionInViewFilter.java:195)
	org.springframework.orm.hibernate5.support.OpenSessionInViewFilter.lookupSessionFactory(OpenSessionInViewFilter.java:180)
	org.springframework.orm.hibernate5.support.OpenSessionInViewFilter.doFilterInternal(OpenSessionInViewFilter.java:131)
	org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119)
	org.openmrs.web.filter.StartupFilter.doFilter(StartupFilter.java:108)
	org.openmrs.web.filter.StartupFilter.doFilter(StartupFilter.java:108)
	org.openmrs.web.filter.StartupFilter.doFilter(StartupFilter.java:108)
	org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:201)
	org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119)

Note The full stack trace of the root cause is available in the server logs.
Apache Tomcat/7.0.100

I have read a thread where @kdaud talked something about mysql encrypting folder so a connection cannot be made :roll_eyes:

Where might i have gone wrong. @sharif @mozzy @reagan @kdaud @herbert24 @dkayiwa @ibacher and anyone who uses Ubuntu.

Thanks

Oh sorry for the above error!

I stand to be corrected but I suppose the error may be because you used the wrong server name. If your server name is not name, I would propose you used mvn openmrs-sdk:run command which will list all the names of the servers you have created and you choose the one you want to run.

1 Like

I also did that and i got the same error.

which version of reference application did you set up ?

1 Like

Share the full server side log via pastebin.com

@dkayiwa the quote above is the full log hosted at pastebin.com

Actually, i have just realized that some console logs are missing. The database setup reached 99% before throwing that error. Am going to re-run the command and share the full log.

I was setting up Reference application 2.12

@dkayiwa, rerunning the server with the command, $ mvn openmrs-sdk:run -DserverId=securitygsoc gives me a new error :man_facepalming: terminal log - Pastebin.com

short browser log.

The following error occurred at startup:
Unable to start OpenMRS. Error thrown was: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'initPathMatcher' defined in URL [jar:file:/home/joshua/openmrs/securitygsoc/.openmrs-lib-cache/webservices.rest/lib/webservices.rest-omod-2.4-2.31.0-SNAPSHOT.jar!/org/openmrs/module/webservices/rest/InitPathMatcher.class]: Post-processing of merged bean definition failed; nested exception is java.lang.IllegalStateException: Failed to introspect Class [org.openmrs.module.webservices.rest.InitPathMatcher] from ClassLoader [{ModuleClassLoader: uid=1172400448; webservices.rest}]

org.openmrs.module.ModuleException: Unable to start OpenMRS. Error thrown was: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'initPathMatcher' defined in URL [jar:file:/home/joshua/openmrs/securitygsoc/.openmrs-lib-cache/webservices.rest/lib/webservices.rest-omod-2.4-2.31.0-SNAPSHOT.jar!/org/openmrs/module/webservices/rest/InitPathMatcher.class]: Post-processing of merged bean definition failed; nested exception is java.lang.IllegalStateException: Failed to introspect Class [org.openmrs.module.webservices.rest.InitPathMatcher] from ClassLoader [{ModuleClassLoader: uid=1172400448; webservices.rest}]
	at org.openmrs.web.WebDaemon.startOpenmrs(WebDaemon.java:65)
	at org.openmrs.web.Listener.contextInitialized(Listener.java:193)
	at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:5197)
	at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5720)
	at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
	at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1705)
	at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1695)
	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
	at java.lang.Thread.run(Thread.java:748)
Caused by: javax.servlet.ServletException: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'initPathMatcher' defined in URL [jar:file:/home/joshua/openmrs/securitygsoc/.openmrs-lib-cache/webservices.rest/lib/webservices.rest-omod-2.4-2.31.0-SNAPSHOT.jar!/org/openmrs/module/webservices/rest/InitPathMatcher.class]: Post-processing of merged bean definition failed; nested exception is java.lang.IllegalStateException: Failed to introspect Class [org.openmrs.module.webservices.rest.InitPathMatcher] from ClassLoader [{ModuleClassLoader: uid=1172400448; webservices.rest}]
	at org.openmrs.web.Listener.startOpenmrs(Listener.java:265)
	at org.openmrs.web.WebDaemon$1.run(WebDaemon.java:42)
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'initPathMatcher' defined in URL [jar:file:/home/joshua/openmrs/securitygsoc/.openmrs-lib-cache/webservices.rest/lib/webservices.rest-omod-2.4-2.31.0-SNAPSHOT.jar!/org/openmrs/module/webservices/rest/InitPathMatcher.class]: Post-processing of merged bean definition failed; nested exception is java.lang.IllegalStateException: Failed to introspect Class [org.openmrs.module.webservices.rest.InitPathMatcher] from ClassLoader [{ModuleClassLoader: uid=1172400448; webservices.rest}]
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:571)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:516)
	at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:324)
	at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234)
	at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:322)
	at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:202)
	at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:897)
	at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:879)
	at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:551)
	at org.openmrs.module.ModuleUtil.refreshApplicationContext(ModuleUtil.java:889)
	at org.openmrs.module.web.WebModuleUtil.refreshWAC(WebModuleUtil.java:845)
	at org.openmrs.web.Listener.performWebStartOfModules(Listener.java:638)
	at org.openmrs.web.Listener.performWebStartOfModules(Listener.java:618)
	at org.openmrs.web.Listener.startOpenmrs(Listener.java:257)
	... 1 more
Caused by: java.lang.IllegalStateException: Failed to introspect Class [org.openmrs.module.webservices.rest.InitPathMatcher] from ClassLoader [{ModuleClassLoader: uid=1172400448; webservices.rest}]
	at org.springframework.util.ReflectionUtils.getDeclaredFields(ReflectionUtils.java:734)
	at org.springframework.util.ReflectionUtils.doWithLocalFields(ReflectionUtils.java:666)
	at org.springframework.orm.jpa.support.PersistenceAnnotationBeanPostProcessor.buildPersistenceMetadata(PersistenceAnnotationBeanPostProcessor.java:427)
	at org.springframework.orm.jpa.support.PersistenceAnnotationBeanPostProcessor.findPersistenceMetadata(PersistenceAnnotationBeanPostProcessor.java:408)
	at org.springframework.orm.jpa.support.PersistenceAnnotationBeanPostProcessor.postProcessMergedBeanDefinition(PersistenceAnnotationBeanPostProcessor.java:335)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyMergedBeanDefinitionPostProcessors(AbstractAutowireCapableBeanFactory.java:1093)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:568)
	... 14 more
Caused by: java.lang.NoClassDefFoundError: Lorg/springframework/web/servlet/mvc/annotation/AnnotationMethodHandlerAdapter;
	at java.lang.Class.getDeclaredFields0(Native Method)
	at java.lang.Class.privateGetDeclaredFields(Class.java:2583)
	at java.lang.Class.getDeclaredFields(Class.java:1916)
	at org.springframework.util.ReflectionUtils.getDeclaredFields(ReflectionUtils.java:729)
	... 20 more
Caused by: java.lang.ClassNotFoundException: org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter
	at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1951)
	at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1794)
	at org.openmrs.module.ModuleClassLoader.loadClass(ModuleClassLoader.java:572)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:351)
	... 24 more

Just create a brand new server using sdk set up.

3 Likes

hey @dkayiwa! The server seams to execute infinitely! Its taking longer than it has ever taken. Actually, it has been running for the last 2 hours :roll_eyes:

It is now showing

Actually, i redirected the output of the terminal to an empty text file. By the time i terminated the server, the text-file was 570 MBs :rofl: I think, there was a resource that was tried to be accessed repeatedly but very attempt was failing.

I have hosted part of the terminal log because of limitations at pastebin hence will display the terminal logs and errors in parts. first part of the terminal error - Pastebin.com

I have read some Talk threads of the errors got by individuals that tried to run the sdk before me but I havent seen any resource to solve my problem. I ran this server on windows several times before i switched to Ubuntu. Though Ubuntu installations is as simple as running a simple terminal command, the configurations required block progress

Oh sorry! am seeing this Caused by: java.lang.IllegalStateException: EntityManagerFactory is closed

1 Like

Have you confirmed if the database has started? You can start it from command-line.

Year sure! i started it from the terminal before i started the server.

Choose version 2.11.0

Choosing a earlier version of the reference application (2.11.0) has worked for me

thanks

1 Like