Trouble while running OpenMRS module. whole process stuck on refreshing context

Hello Everyone,

I’m trying to run my OpenMRS module, but the initial setup process is not complete. The installing process stuck on ServiceContext.startRefreshingContext(823) | Refreshing Context while updating the database.

Can you please share your log details?

@wyclif! I have attached the detailed log file.

openmrelog.docx (14.1 KB)

For better view

Is this the default openmrs platform 2.0.6 or do you have some extra modules?

What happens when you restart tomcat?

except the legacyui-1.3.3.omod module all other is the default modules. I have to restart the tomcat two and three times but the setup process stuck on the same point (INFO - EhCacheManagerFactoryBean.afterPropertiesSet(129) |2018-05-25 11:18:45,795| Initializing EhCache CacheManager). : :

I have resolved this issue thanks everyone.

@shujaat it is always good to share how you resolved it in order to help others who may face the same in future.

1 Like

In my case I have called the services context before Context refreshing, therefore the process stuck on the context refreshing.

@RequestMapping(value = "module/${rootArtifactid}/")
public class TestController {

   TestService service = Context.getService(TestServiceImpl.class);  //I have comment this line  and  
     called withing the @RequestMapping method

According the Openmrs.api.context -> ServiceContext.class

     public <T extends Object> T getService(Class<? extends T> cls) {
          if the context is refreshing, wait until it is done -- otherwise, a null service might be

Can you please share full log details?

1 Like

@wyclif This issue is resolved. The problem which @Shujaat faced was related to OpenMRS refreshing context. While running openmrs server, the process would stuck on ServiceContext.startRefreshingContext stage and would no longer proceed.

On looking closely at the code, the problem occurred because of trying to access the service before the context was set up, i.e before Refreshing Context completed successfully. He was trying to access the service on the class-level in the controller but the service is actually available after OpenMRS is set up.

Thanks @wyclif and @dkayiwa

this was really helpful to me thanks getting the same problem when installing reference app on amazon t2 micro instance.

can any one please help with this ? Everything works well with my local machiene.

CC: @dkayiwa

Is this all that you have in the logs?

No. It has a huge log.

Can the reference app built if the RAM is just 1GB?

more Log. Have tried deleting the old server and installing the new one. Every time it reahes 99% and get stuck.

Which versions of tomcat and java are you running?

java 1.8 and

got this error while running a new Instance on aws Memory Insufficient .

The Isuue is running openmrs reference app on t2.micro instance which only provides 1GB RAM. Running on my Local machiene found that its Requires 894 MB approx so the app could not be able to launch.

Changing to t2.small with 2GB Ram worked.

Thanks All