java.lang.NullPointerException

am Creating Classes that Migrate existing diagnosis data captured via the emrapi module. and added a link o the Admin page that triggers the migration . as far as i ithink, i have instatiated all the objects . but am getting a java.nullPointer exception here is the error log. https://hastebin.com/regemefaya.coffeescript

And here are my comits. https://github.com/openmrs/openmrs-module-emrapi/pull/152/commits/935acc5de3c7a06ac3f9748daa1303b90c652a5b

@dkayiwa @ssmusoke @wyclif @mogoodrich

Have you tried to run in debug mode to check which variable is null on that line?

1 Like

:wink: i actually had not done that. i was using my eyes to check :sunglasses:

but it compiles fine, and loads fine . …the problem comes wen i click the link. but let me try he debugg mode

hi @dkayiwa after running the sdk server in debug mode… using mvn openmrs-sdk:run -Dfork=false -Ddebug

here s the log. https://pastebin.com/sTG5qYtg

Does it run well if you do not run in debug mode?

@dkayiwa i think i havent got the question …

You are running the sdk in debug module. Do you still get this error if you run the sdk again but not in debug mode?

@dkayiwa here this is the log without the debug mode https://pastebin.com/rgMBt9D0

Does it help if you delete the contents of this folder? C:\Users\Dell.m2\repository

yes , i delted it , and ran the sdk again , i got a cleaner log wth few errors, but i still the java.lang.null.pointerException

i have seen the variable that is not instatiated

this is the other error i have now

https://hastebin.com/gerecizita.cpp

This looks like a messed up database. It could be easier to just set it up afresh.

1 Like

does that mean deleting the associated database and rebuiding it up again?

Yes it is.

1 Like

ok sir @dkayiwa , let me try that

your Actually ryt. ive seen another post which has the same error exactly as i have , and its reletaed to the database Character Set Encoding. all tables should have UTF8 CharSet …that wat ive tried to understand

ive deleted the database, and am trying to run the server again to rebuild the database , but its now giving me an error

java.lang.RuntimeException: Error occurred while trying to get the updates needed for the database. Unable to get a connection to the database.  Please check your openmrs runtime properties file and make sure you have the correct connection.username and connection.password set
	at org.openmrs.util.DatabaseUpdater.getUnrunDatabaseChanges(DatabaseUpdater.java:630)
	at org.openmrs.util.DatabaseUpdater.getUnrunDatabaseChanges(DatabaseUpdater.java:587)
	at org.openmrs.util.DatabaseUpdater.updatesRequired(DatabaseUpdater.java:252)
	at org.openmrs.web.Listener.setupNeeded(Listener.java:217)
	at org.openmrs.web.Listener.contextInitialized(Listener.java:179)
	at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:5077)
	at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5591)
	at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
	at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1574)
	at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1564)
	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
	at java.lang.Thread.run(Thread.java:748)
Caused by: java.lang.Exception: Unable to get a connection to the database.  Please check your openmrs runtime properties file and make sure you have the correct connection.username and connection.password set

how am i supposed to cnfigure the properties file , so that i can rebuid the database?