Hi @altair141, why do you pass a new Properties object to Context.startup(...) instead of using props. Not that this is the cause of the error, still working through that.
Hi @altair141 I did some more digging and found out that the Context class has some fields, namely contextDAO and serviceContext which are being managed by Spring. Spring has not been initialized in your case, hence the null contextDAO.
PS: You should try the REST approach, since this is no longer supported.
Hi, @gwasilwa, I have searched, but i have not found information to initialize Spring in openmrs. Do You know how to initialize openmrs? or do You know of any example published?
About rest, this is the second option, but the priority is OpenMrs-API
Any one Resolve that problem please Share me.
How to resolve Context is null Error
log4j:WARN No appenders could be found for logger (org.openmrs.api.context.Context).
log4j:WARN Please initialize the log4j system properly.
Exception in thread “main” org.openmrs.api.APIException: contextDAO is null
at org.openmrs.api.context.Context.getContextDAO(Context.java:162)
at org.openmrs.api.context.Context.openSession(Context.java:740)
at org.openmrs.api.context.Context.startup(Context.java:903)
at Test.main(Test.java:23)
I want connect openmrs data for fetching Person record via our own code .how this possible
I am Getting Error
log4j:WARN No appenders could be found for logger (org.openmrs.api.context.Context).log4j:WARN Please initialize the log4j system properly.Exception in thread "main" org.openmrs.api.APIException: contextDAO is null
at org.openmrs.api.context.Context.getContextDAO(Context.java:162)
at org.openmrs.api.context.Context.openSession(Context.java:740)
at org.openmrs.api.context.Context.startup(Context.java:903)
at Test.main(Test.java:23)