java.lang.NullPointerException

You also need to delete the runtime properties file. https://wiki.openmrs.org/display/docs/Overriding+OpenMRS+Default+Runtime+Properties

1 Like

ok @dkayiwa thx . i want to add some demoData. but i cant see the “referencede odata.createDemoPatientsOnNextStartup” any where as far as this link https://wiki.openmrs.org/display/RES/Demo+Data directs. can i just create that global property manually? as in can i add it in case it doesnt exist in my distributon?

@dkayiwa i still get the same eror , even after rebuilding the database

Are you using the SDK to set up a new instance of the reference application distribution?

yes its wat am using
 i tried the other means i.e copying the latest versions of modules into a standalone and it failed. so i can only use the sdk to set up and run the distributon that i need

So are you saying that using the SDK to set up a new instance of the openmrs reference application results into a failure on running the newly set up instance?

it doesnt fail to run , it only returns that error wen i click the mgrateDiagnosisData link link wc triggers data migration to the new table

it also failed to add demo data on the next startup after setting the “referencedemodata.createDemoPatientsOnNextStartup” GlobalProperty to 10

the error is thrown from here

 protected void setup(ConceptService conceptService, String conceptSourceName, ConceptSetDescriptorField primaryConceptField, ConceptSetDescriptorField... memberConceptFields) {
        try {
            String primaryConceptCode = primaryConceptField.getConceptCode();
            Concept primaryConcept = conceptService.getConceptByMapping(primaryConceptCode, conceptSourceName);
            if (primaryConcept == null) {
                throw new MissingConceptException("Couldn't find primary concept for " + getClass().getSimpleName() + " which should be mapped as " + conceptSourceName + ":" + primaryConceptCode);
@Override
	@SuppressWarnings("unchecked")
	public List<Concept> getConceptsByMapping(String code, String sourceName, boolean includeRetired) {
		Criteria criteria = sessionFactory.getCurrentSession().createCriteria(ConceptMap.class);
		
		// make this criteria return a list of concepts
		criteria.setProjection(Projections.property("concept"));
		
		//join to the conceptReferenceTerm table
		criteria.createAlias("conceptReferenceTerm", "term");
		
		// match the source code to the passed code
		if (Context.getAdministrationService().isDatabaseStringComparisonCaseSensitive()) {
			criteria.add(Restrictions.eq("term.code", code).ignoreCase());
		} else {
			criteria.add(Restrictions.eq("term.code", code));
		}
		
		// join to concept reference source and match to the h17Code or source name
		criteria.createAlias("term.conceptSource", "source");
		if (Context.getAdministrationService().isDatabaseStringComparisonCaseSensitive()) {
			criteria.add(Restrictions.or(Restrictions.eq("source.name", sourceName).ignoreCase(), Restrictions.eq(
			    "source.hl7Code", sourceName).ignoreCase()));
		} else {
			criteria.add(Restrictions.or(Restrictions.eq("source.name", sourceName), Restrictions.eq("source.hl7Code",
			    sourceName)));
		}
		
		criteria.createAlias("concept", "concept");
		
		if (!includeRetired) {
			// ignore retired concepts
			criteria.add(Restrictions.eq("concept.retired", false));
		} else {
			// sort retired concepts to the end of the list
			criteria.addOrder(Order.asc("concept.retired"));
		}
		
		// we only want distinct concepts
		criteria.setResultTransformer(DistinctRootEntityResultTransformer.INSTANCE);
		
		return (List<Concept>) criteria.list();
	}

am looking at that method in the HibernateConceptDAO.java

and i probably think am getting the error coz i do not have the required demo-data in the database
 thats y

throw new MissingConceptException("Couldn't find primary concept for " + getClass().getSimpleName() + " which should be mapped as " + conceptSourceName + ":" + primaryConceptCode);
that exception is thrown . thats wat am trying to undertsand. correct me if am wrong
@dkayiwa.

sir, could it be that , i get that error beacuse my database lack the proper demodata for primary concept?? :thinking: Couldn't find primary concept for DiagnosisMetadata which should be mapped as org.openmrs.module.emrapi:Diagnosis Concept Set ??? @dkayiwa

hello sir @dkayiwa, waiting for your help here

Can you list for me the steps you did up to the point where you set referencedemodata.createDemoPatientsOnNextStartup and then it results into errors? I just want to reproduce it locally.

  • i run the reference application on platforn 2.2.0 SNPSHOT VERSION using the sdk server.
  • i replaced the core apps module, web-rest services, and emrapi module, with the latest snapshot versions.
  • i then compiled the emrapi module (that contains the Migration changes) am working on .
  • when i click the migration Link , thats wen i get that error

Can you take a second look at my question?

, after starting all the modules , i then wanted to load some demodata, i first tried registering some patients , but was getting “UI FRAMEWORK ERROR, Telephone Number required” though the patients were saved anyway. thats wen i tried to load someData using the referencedemodata.createDemoPatientsOnNextStartup GlobalProperty. i set it to 10, but after restarting the server, the Data was not added .

Whenever you do not share logs, it is almost impossible to help you.

sometimes i get this error wen i start the sdk

https://hastebin.com/boyotaduho.rb

here is the log wen i retart the server and it starts succesfully

https://hastebin.com/keqefuhaja.bash

this is the log after i load the EMR-api that contains the migration classes

https://hastebin.com/enevizuwaf.nginx

lastly the error after i click the migrate link https://hastebin.com/acadumemaw.cpp

hi @dkayiwa. all the above are the logs to do with watever am trying to do. i dont know y the sdk fails to add demodata. is there any way out. but am sure , the link i added works

Can you list the exact steps of reproducing the demo data error?