Error running initialsetup when installing OpenMRS

Hi everyone! I’m trying to install OpenMRS on my local machine. So I was able to run mvn clean install and then mvn jetty:run http://localhost:8080/openmrs also works fine except for the last page When I fill in all details and go to the last page I get the following error:


Problem accessing /openmrs/initialsetup. Reason:

    Server Error
Caused by:

org.openmrs.api.APIException: Service not found: interface org.openmrs.messagesource.MessageSourceService
	at org.openmrs.api.context.ServiceContext.getService(
	at org.openmrs.api.context.ServiceContext.getMessageSourceService(
	at org.openmrs.api.context.Context.getMessageSourceService(
	at org.openmrs.api.APIException.<init>(
	at org.openmrs.api.PasswordException.<init>(
	at org.openmrs.api.ShortPasswordException.<init>(
	at org.openmrs.util.OpenmrsUtil.validatePassword(
	at org.openmrs.web.filter.initialization.InitializationFilter.doPost(
	at org.openmrs.web.filter.StartupFilter.doFilter(
	at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(
	at org.openmrs.web.filter.StartupFilter.doFilter(
	at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(
	at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(
	at org.springframework.web.filter.OncePerRequestFilter.doFilter(
	at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(
	at org.eclipse.jetty.servlet.ServletHandler.doHandle(
	at org.eclipse.jetty.server.handler.ScopedHandler.handle(
	at org.eclipse.jetty.server.session.SessionHandler.doHandle(
	at org.eclipse.jetty.server.handler.ContextHandler.doHandle(
	at org.eclipse.jetty.servlet.ServletHandler.doScope(
	at org.eclipse.jetty.server.session.SessionHandler.doScope(
	at org.eclipse.jetty.server.handler.ContextHandler.doScope(
	at org.eclipse.jetty.server.handler.ScopedHandler.handle(
	at org.eclipse.jetty.server.handler.ContextHandlerCollection.handle(
	at org.eclipse.jetty.server.handler.HandlerCollection.handle(
	at org.eclipse.jetty.server.handler.HandlerWrapper.handle(
	at org.eclipse.jetty.server.Server.handle(
	at org.eclipse.jetty.server.HttpChannel.handle(
	at org.eclipse.jetty.server.HttpConnection.onFillable(
	at org.eclipse.jetty.util.thread.strategy.ExecuteProduceConsume.produceAndRun(
	at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(
	at org.eclipse.jetty.util.thread.QueuedThreadPool$
Powered by Jetty:// 9.3.3.v20150827

I’m running openmrs on OS X 10.12.3 (16D32).

✗ java -version
java version "1.8.0_77"
Java(TM) SE Runtime Environment (build 1.8.0_77-b03)
Java HotSpot(TM) 64-Bit Server VM (build 25.77-b03, mixed mode)

MySQL version is 5.6.35-1debian8 (within a docker)

How can I solve this error, please?


What version of OpenMRS platform are you running?

I have just checked out the github repo and I’m in a master branch. Where do I check the version?

It’s 2.2.0 according to pom.xml file

You probably need to first rebuild the project by running mvn clean install before trying again

Such an error (in browser) is just a symptom where the the underlying cause is in the server log.

I did that several times already.

Where can I get this log?

The command line output is pretty same

ERROR - Context.getServiceContext(249) |2017-04-06 17:07:23,397| serviceContext is null. Creating new ServiceContext()

and then stack trace

You need to share the entire command line log. You can paste it at

There you go!

There must be more than just this on your commandline log.

Well. I did “clean install” again, did “jetty:run” went to the website went through all the steps and received the error again and here’s the output:

there’s nothing more than this

Just go to this in your browser to complete the setup localhost:8080/openmrs

But it gives me the same error in a browser! That was the initial problem!

After getting that browser error, your command line log should now have more than what you sent.

I’m sorry, but I’m not lying to you. That’s the only output that it gives me. Here’s a “screenshot” (photo). Of the browser error and console output.

And also a full log starting with

git clone then mvn clean install and then mvn jetty:run

Ok. The problem is that the ServiceContext is not loaded. Doing further debugging.

Ok. So the problem is here. When I tried to do do an advanced setup at the final step it asked for admin’s password. Then it needed to validate the password. For validating it tried to get some service out of the spring context with this code: But the service context could not be loaded and that caused an error (dunno why though).

If you want to have advanced settings for your application but getting this error, you have to do the following. Enter all the settings in “advanced” mode. Get to that error page. Then go to the first page again (by that moment you must have all your settings saved in the session), choose the “simple” installation option, you would be able to complete installation and run OpenMRS (with default admin password of course).

I will do further investigation why doesn’t that application context load.

Stay in touch!

1 Like