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:

HTTP ERROR 500

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(ServiceContext.java:641)
	at org.openmrs.api.context.ServiceContext.getMessageSourceService(ServiceContext.java:458)
	at org.openmrs.api.context.Context.getMessageSourceService(Context.java:479)
	at org.openmrs.api.APIException.<init>(APIException.java:69)
	at org.openmrs.api.PasswordException.<init>(PasswordException.java:39)
	at org.openmrs.api.ShortPasswordException.<init>(ShortPasswordException.java:30)
	at org.openmrs.util.OpenmrsUtil.validatePassword(OpenmrsUtil.java:1860)
	at org.openmrs.web.filter.initialization.InitializationFilter.doPost(InitializationFilter.java:663)
	at org.openmrs.web.filter.StartupFilter.doFilter(StartupFilter.java:159)
	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)
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?

Thanks!

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 pastebin.com

There you go! https://pastebin.com/PtME8QVC

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:

https://pastebin.com/ugTMWmVH

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