NullPointerException in EncounterServiceTest , OpenMRS installation issue

0 views
Skip to first unread message

Magus Verma

unread,
May 15, 2014, 7:27:15 AM5/15/14
to d...@openmrs.org
I am new to OpenMRS and have been facing some issues with its installation 

I used the step by step guide for installing it as a core developers .. I cloned the latest openmrs-core repository and imported in eclipse as maven project

On running "maven clean install" I am getting this error message , (prior to this it downloads many files and runs tests for about 15 minutes) 


Tests in error: 
  saveEncounter_shouldAssignEncounterToVisitIfTheAssignToExistingOrNewHandlerIsRegistered(org.openmrs.api.EncounterServiceTest)

Tests run: 2573, Failures: 0, Errors: 1, Skipped: 27

[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO] 
[INFO] OpenMRS ........................................... SUCCESS [2.989s]
[INFO] openmrs-tools ..................................... SUCCESS [2.788s]
[INFO] openmrs-test ...................................... SUCCESS [0.569s]
[INFO] openmrs-api ....................................... FAILURE [12:54.074s]
[INFO] openmrs-web ....................................... SKIPPED
[INFO] openmrs-webapp .................................... SKIPPED
[INFO] openmrs-release-test .............................. SKIPPED
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 13:01.680s
[INFO] Finished at: Thu May 15 16:10:00 IST 2014
[INFO] Final Memory: 22M/148M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.5:test (default-test) on project openmrs-api: There are test failures.
[ERROR] 
[ERROR] Please refer to C:\Documents and Settings\Administrator\workspace\openmrs-core\api\target\surefire-reports for the individual test results.
[ERROR] -> [Help 1]
 
Content of org.openmrs.api.EncounterServiceTest.txt  (Present in  C:\Documents and Settings\Administrator\workspace\openmrs-core\api\target\surefire-reports)
-------------------------------------------------------------------------------
Test set: org.openmrs.api.EncounterServiceTest
-------------------------------------------------------------------------------
Tests run: 127, Failures: 0, Errors: 1, Skipped: 3, Time elapsed: 21.952 sec <<< FAILURE!
saveEncounter_shouldAssignEncounterToVisitIfTheAssignToExistingOrNewHandlerIsRegistered(org.openmrs.api.EncounterServiceTest)  Time elapsed: 0.32 sec  <<< ERROR!
java.lang.NullPointerException
at org.openmrs.api.handler.OpenmrsObjectSaveHandler.handle(OpenmrsObjectSaveHandler.java:83)
at org.openmrs.aop.RequiredDataAdvice.recursivelyHandle(RequiredDataAdvice.java:263)
at org.openmrs.aop.RequiredDataAdvice.recursivelyHandle(RequiredDataAdvice.java:226)
at org.openmrs.aop.RequiredDataAdvice.before(RequiredDataAdvice.java:129)
at org.springframework.aop.framework.adapter.MethodBeforeAdviceInterceptor.invoke(MethodBeforeAdviceInterceptor.java:50)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
at org.springframework.aop.framework.adapter.MethodBeforeAdviceInterceptor.invoke(MethodBeforeAdviceInterceptor.java:51)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)
at com.sun.proxy.$Proxy64.saveVisit(Unknown Source)
at org.openmrs.api.impl.EncounterServiceImpl.saveEncounter(EncounterServiceImpl.java:117)
at sun.reflect.GeneratedMethodAccessor733.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:317)
at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:183)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:150)
at org.springframework.transaction.interceptor.TransactionInterceptor$1.proceedWithInvocation(TransactionInterceptor.java:96)
at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:260)
at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:94)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)
at com.sun.proxy.$Proxy32.saveEncounter(Unknown Source)
at sun.reflect.GeneratedMethodAccessor733.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:317)
at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:183)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:150)
at org.openmrs.aop.LoggingAdvice.invoke(LoggingAdvice.java:125)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
at org.springframework.aop.framework.adapter.MethodBeforeAdviceInterceptor.invoke(MethodBeforeAdviceInterceptor.java:51)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
at org.springframework.aop.framework.adapter.MethodBeforeAdviceInterceptor.invoke(MethodBeforeAdviceInterceptor.java:51)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)
at com.sun.proxy.$Proxy33.saveEncounter(Unknown Source)
at org.openmrs.api.EncounterServiceTest.saveEncounter_shouldAssignEncounterToVisitIfTheAssignToExistingOrNewHandlerIsRegistered(EncounterServiceTest.java:1833)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:47)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:44)
at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)
at org.springframework.test.context.junit4.statements.RunBeforeTestMethodCallbacks.evaluate(RunBeforeTestMethodCallbacks.java:74)
at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27)
at org.springframework.test.context.junit4.statements.RunAfterTestMethodCallbacks.evaluate(RunAfterTestMethodCallbacks.java:83)
at org.springframework.test.context.junit4.statements.SpringRepeat.evaluate(SpringRepeat.java:72)
at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:231)
at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:88)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:238)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:63)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:236)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:53)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:229)
at org.springframework.test.context.junit4.statements.RunBeforeTestClassCallbacks.evaluate(RunBeforeTestClassCallbacks.java:61)
at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27)
at org.springframework.test.context.junit4.statements.RunAfterTestClassCallbacks.evaluate(RunAfterTestClassCallbacks.java:71)
at org.junit.runners.ParentRunner.run(ParentRunner.java:309)
at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.run(SpringJUnit4ClassRunner.java:174)
at org.apache.maven.surefire.junit4.JUnit4TestSet.execute(JUnit4TestSet.java:59)
at org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.executeTestSet(AbstractDirectoryTestSuite.java:115)
at org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.execute(AbstractDirectoryTestSuite.java:102)
at org.apache.maven.surefire.Surefire.run(Surefire.java:180)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.apache.maven.surefire.booter.SurefireBooter.runSuitesInProcess(SurefireBooter.java:350)
at org.apache.maven.surefire.booter.SurefireBooter.main(SurefireBooter.java:1021)


My Machine:
Microsoft Windows XP [Version 5.1.2600](C) Copyright 1985-2001 Microsoft Corp.
C:\Documents and Settings\Administrator>java -version
java version "1.7.0_55"
Java(TM) SE Runtime Environment (build 1.7.0_55-b13)
Java HotSpot(TM) Client VM (build 24.55-b03, mixed mode, sharing)

I have followed every step of the step by step guide installed all required eclipse plugins and have tomcat and mysql installed and running , tried JDK 1.6,1.7,1.8 but nothing has helped in above error. 

I would really appreciate some help on this.

 

Mhawila A. Mhawila

unread,
May 15, 2014, 7:34:51 AM5/15/14
to d...@openmrs.org
Magus,
Try skipping the tests.


--
OpenMRS Developers: http://go.openmrs.org/dev
Post: d...@openmrs.org | Unsubscribe: dev+uns...@openmrs.org
Manage your OpenMRS subscriptions at https://id.openmrs.org/

To unsubscribe from this group and stop receiving emails from it, send an email to dev+uns...@openmrs.org.



--
Best regards,
 
Mhawila A. Mhawila

Harsha Kumara

unread,
May 15, 2014, 8:00:53 AM5/15/14
to d...@openmrs.org
Hi Magus,
Yeas as Mhawila suggest you can run mvn clean install -Dmaven.test.skip=true but it's not always recommand. We always try to stabilize our build. I have build the latest master branch now. Not got any error. Can you switch to java 1.6 and try build it again? May be that can be the issue. Make sure you using the right version. 

Thanks,
harsha
Harsha Kumara
Software Engineer
WSO2 Inc.
Sri Lanka.

magus...@iiitd.ac.in

unread,
May 15, 2014, 9:52:32 AM5/15/14
to d...@openmrs.org
Thanks, it worked on skipping test cases, also thanks for the quick reply!

Mhawila A. Mhawila

unread,
May 15, 2014, 10:08:58 AM5/15/14
to d...@openmrs.org
Magus,
That is good, but it is even better if you follow Harsha's advice.

haraneesh reddy

unread,
Feb 14, 2015, 9:02:31 PM2/14/15
to d...@openmrs.org
All - I am using jdk 1.7.0_65 and I am getting this error on 1.12 version of OpenMRS. Is this related to JDK version? If so what is the version to be used?
...
org.openmrs.api.EncounterServiceTest.txt

Mhawila A. Mhawila

unread,
Feb 14, 2015, 10:01:18 PM2/14/15
to d...@openmrs.org
Hi haraneesh,
I am running mvn clean install on java 1.6.0_65 successfully with all tests passing. Could you try to run JDK6 instead and see what happens.

-
Willa.

--
OpenMRS Developers: http://om.rs/dev
Post: d...@openmrs.org | Unsubscribe: dev+uns...@openmrs.org
Manage your OpenMRS subscriptions: http://om.rs/id
 
Visit OpenMRS Talk at http://om.rs/talk for chat and discussions!

To unsubscribe from this group and stop receiving emails from it, send an email to dev+uns...@openmrs.org.

haraneesh reddy

unread,
Feb 15, 2015, 12:43:14 AM2/15/15
to d...@openmrs.org
Thanks Willa. Java SDK version jdk1.7.0_76 compiles the openmrs 1.12.0. However other versions of JDK 1.7 throw errors.

...
Reply all
Reply to author
Forward
0 new messages