Uploaded image for project: 'OpenMRS Core'
  1. OpenMRS Core
  2. TRUNK-5180

MessageSourceService not found on startup in APIException

    XMLWordPrintable

Details

    Description

      Changes in TRUNK-4500 introduced a localized call to APIException

      throw new APIException("error.context.null", (Object[]) null);

      in Context.java

      which leads to problems when setting up OpenMRS, since APIExceptions like for example setting a too short password lead to a 404 on the client. Under the hood the APIException is trying to get the translated message for a key via the MessageSourceService which cannot be found.

      Logs:

      ERROR - Context.getServiceContext(249) |2017-06-26 20:44:33,711| serviceContext is null. Creating new ServiceContext()
      Listener.contextDestroyed: Error while shutting down openmrs:
      ERROR - Listener.contextDestroyed(569) |2017-06-26 20:44:33,714| Listener.contextDestroyed: Error while shutting down openmrs:
      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.context.Context.getContextDAO(Context.java:160)
      at org.openmrs.api.context.Context.openSession(Context.java:709)
      at org.openmrs.web.Listener.contextDestroyed(Listener.java:557)
      at org.eclipse.jetty.server.handler.ContextHandler.callContextDestroyed(ContextHandler.java:843)
      at org.eclipse.jetty.servlet.ServletContextHandler.callContextDestroyed(ServletContextHandler.java:543)
      at org.eclipse.jetty.server.handler.ContextHandler.stopContext(ContextHandler.java:824)
      at org.eclipse.jetty.servlet.ServletContextHandler.stopContext(ServletContextHandler.java:353)
      at org.eclipse.jetty.webapp.WebAppContext.stopWebapp(WebAppContext.java:1374)
      at org.eclipse.jetty.maven.plugin.JettyWebAppContext.stopWebapp(JettyWebAppContext.java:332)
      at org.eclipse.jetty.webapp.WebAppContext.stopContext(WebAppContext.java:1343)
      at org.eclipse.jetty.server.handler.ContextHandler.doStop(ContextHandler.java:870)
      at org.eclipse.jetty.servlet.ServletContextHandler.doStop(ServletContextHandler.java:269)
      at org.eclipse.jetty.webapp.WebAppContext.doStop(WebAppContext.java:535)
      at org.eclipse.jetty.maven.plugin.JettyWebAppContext.doStop(JettyWebAppContext.java:429)
      at org.eclipse.jetty.util.component.AbstractLifeCycle.stop(AbstractLifeCycle.java:89)
      at org.eclipse.jetty.maven.plugin.JettyRunMojo.restartWebApp(JettyRunMojo.java:530)
      at org.eclipse.jetty.maven.plugin.JettyRunMojo$1.onPathWatchEvents(JettyRunMojo.java:401)
      at org.eclipse.jetty.util.PathWatcher.notifyOnPathWatchEvents(PathWatcher.java:1156)
      at org.eclipse.jetty.util.PathWatcher.run(PathWatcher.java:1360)
      at java.lang.Thread.run(Thread.java:745)

      see commit that introduced this
      https://github.com/openmrs/openmrs-core/commit/da12f21c545d8c4994dccbd2d08bc4c962811d9d

      interesting is that one issue caused by this change was found and reverted
      https://github.com/openmrs/openmrs-core/pull/1276

      Gliffy Diagrams

        Attachments

          Issue Links

            Activity

              People

                dkayiwa Daniel Kayiwa
                teleivo Ivo Ulrich
                Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                  Created:
                  Updated:
                  Resolved: