As a part of GSoC 2015, I have been working on moving the Legacy UI to a new module.
Things Done:
I moved the components from openmrs-core that are included in the admin ( from openmrs-core\webapp\src\main\webapp\WEB-INF\view\admin - including concepts, users, index.jsp etc ) to the location here in the new module: openmrs-module-legacyui\api\src\main\java\org\openmrs\module\legacyui\admin
I can perfectly build the module
I can perfectly build the core without the admin folder in the above mention location.
However, there is an API exception that occurs when I deploy the module and click on Admin UI.
An error has occurred!!
The following error has occurred somewhere on this page
org.openmrs.api.Context.APIException: A user context must first be passed to setUserContext()...use Context.openSession() and (closeSession() to prevent memory leaks!) before using the API."
Unable to understand what I have missed on, maybe the controller functionality which needs to be included. But I was trying as a initial step to at least get the UI part if not for working.
Looking at the logs the root cause is because you have no controller and jsp mapped to /openmrs/module/legacyui/index, you might not need the controller but the index.jsp file should be present in your module.
Note: As the post seems too long -
The information in {} can be seen only for reference, but has been repeated quite some times so maybe ignored if known already.
Included for clear description
2 . In index.jsp, changed the location of the included files
{
from users/*
to admin/users/*
Because, I moved index to the webapp instead of keeping it in webapp/admin.
}
I am trying for admin/users as for now and hence: recent change+ In localheader.jsp for users, changed the context pathfrom /admin/users/to /module/legacyui/admin/users/
The error message says no mapping found for ‘/openmrs/module/legacyui/admin/users/users.l
ist’, are you sure you registered a url mapping for it? Because looking at your webApplicationContext.xml file i don’t see its mapping
There is no mapping required for UserListController since there is a requestmapping on the controller, I didnt quite understand where to include the module path for this controller as @darius suggested changing the RequestMapping isnt a good idea.
Do you suggest that I should look into any other way to map the users.jsp form to the UserListController?
However, in core it works fine without the mapping, with just the @RequestMapping and the return value.
Then the URL you are entering in the browser is incorrrect, you need to enter /openmrs/admin/users/users.list for it to work because that is what is defined in the UserListController