Error Compiling Reporting Compatibility Module

I get this error when I try running “mvn clean install” on the master branch of reporting compatibility module.

What could be causing this?

Note: I am running on java 6.

Compile it on Java 8

It is still throwing the same errors

Can i look at the log when you compile on java 8?

@willa in addition to Daniel’s comment, please see what java version is mvn using. try mvn -v
see to it that it points to java 8. :slight_smile:

Thanks @pralay & @dkayiwa, the problem was me compiling the old code. Apparently my “upstream” was pointing to the wrong destination so every time I did pull the changes I was getting a status the branch is already up to date which was not.

1 Like

@dkayiwa as we discussed via IRC I was trying to compile the module to work with version 1.11.5. The current latest version (1.5.8) does not work well on 1.11.5 because the UI breaks for some elements due to updated version of Spring. The good thing is the master is already updated to address this issue so I just needed to go back to a commit prior to the one changing the required version of OpenMRS from 1.7 to 2.0. I checked out the commit creating a new branch, unfortunately building it hasn’t been successful so far.

I ran a “mvn clean install -X” and below is what is displayed repetitively for every test class.


T E S T S

Forking command line: /bin/sh -c cd /Users/willa/Projects/openmrs/modules/openmrs-module-reportingcompatibility/api && /System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/bin/java -jar /Use rs/willa/Projects/openmrs/modules/openmrs-module-reportingcompatibility/api/target/surefire/surefirebooter3521342718567675918.jar /Users/willa/Projects/openmrs/modules/openmrs-module-reportingcompatibil ity/api/target/surefire/surefire5190311892099737892tmp /Users/willa/Projects/openmrs/modules/openmrs-module-reportingcompatibility/api/target/surefire/surefire504489056638232303tmp Running org.openmrs.cohort.CohortUtilTest ERROR - TestContextManager.prepareTestInstance(309) |2016-03-24 08:49:30,726| Caught exception while allowing TestExecutionListener [org.springframework.test.context.support.DependencyInjectionTestExecu tionListener@5981f6b] to prepare test instance [org.openmrs.cohort.CohortUtilTest@4636acab] java.lang.IllegalStateException: Failed to load ApplicationContext at org.springframework.test.context.CacheAwareContextLoaderDelegate.loadContext(CacheAwareContextLoaderDelegate.java:99) at org.springframework.test.context.TestContext.getApplicationContext(TestContext.java:122) at org.springframework.test.context.support.DependencyInjectionTestExecutionListener.injectDependencies(DependencyInjectionTestExecutionListener.java:109) at org.springframework.test.context.support.DependencyInjectionTestExecutionListener.prepareTestInstance(DependencyInjectionTestExecutionListener.java:75) at org.springframework.test.context.TestContextManager.prepareTestInstance(TestContextManager.java:307) at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.createTest(SpringJUnit4ClassRunner.java:211) at org.springframework.test.context.junit4.SpringJUnit4ClassRunner$1.runReflectiveCall(SpringJUnit4ClassRunner.java:288) at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12) at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.methodBlock(SpringJUnit4ClassRunner.java:284) 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:53) at org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:123) at org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:104) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at org.apache.maven.surefire.util.ReflectionUtils.invokeMethodWithArray(ReflectionUtils.java:164) at org.apache.maven.surefire.booter.ProviderFactory$ProviderProxy.invoke(ProviderFactory.java:110) at org.apache.maven.surefire.booter.SurefireStarter.invokeProvider(SurefireStarter.java:175) at org.apache.maven.surefire.booter.SurefireStarter.runSuitesInProcessWhenForked(SurefireStarter.java:107) at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:68) Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘org.springframework.transaction.interceptor.TransactionAttributeSourceAdvisor#0’ defined in class path resource [applicationContext-service.xml]: Cannot resolve reference to bean ‘transactionInterceptor’ while setting bean property ‘transactionInterceptor’; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘transactionInterceptor’ defined in class path resource [applicationContext-service.xml]: Cannot resolve reference to bean ‘transactionManager’ while setting bean property ‘transactionManager’; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘transactionManager’ defined in class path resource [applicationContext-service.xml]: Cannot resolve reference to bean ‘sessionFactory’ while setting bean property ‘sessionFactory’; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘sessionFactory’ defined in URL [file:/Users/willa/Projects/openmrs/modules/openmrs-module-reportingcompatibility/api/target/test-classes/TestingApplicationContext.xml]: Invocation of init method failed; nested exception is org.hibernate.InvalidMappingException: Could not parse mapping document from resource ReportObject.hbm.xml Related cause: org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘patientService’ defined in class path resource [applicationContext-service.xml]: Cannot resolve reference to bean ‘patientServiceTarget’ while setting bean property ‘target’; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘patientServiceTarget’ defined in class path resource [applicationContext-service.xml]: Cannot resolve reference to bean ‘patientDAO’ while setting bean property ‘patientDAO’; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘patientDAO’ defined in class path resource [applicationContext-service.xml]: Cannot resolve reference to bean ‘sessionFactory’ while setting bean property ‘sessionFactory’; nested exception is org.springframework.beans.factory.BeanCurrentlyInCreationException: Error creating bean with name ‘sessionFactory’: FactoryBean which is currently in creation returned null from getObject

Some googling brought up this thread. I wonder if it might have something to do with this issue considering that OpenMRS 2.0.0-SNAPSHOT on which the master of the module now depends and compile successfully uses hibernate core without modification while the 1.12.0-SNAPSHOT on which the commit I branched out from uses the modified hibernate provided by OpenMRS.

@willa, i have created a 1.x branch of the module. Pull this and compile. Then tell us if all is well.

Thanks @dkayiwa I have pulled and I am able to compile. Now are there any things I need to do release other than running “mvn release:prepare”

@willa i have made an update to the 1.x branch. So try it out again and see if it runs well and has the fixes you are looking for.

@dkayiwa FWIW I noticed there are files that have been moved from core to RCM. Apparently these files have been moved after 1.11.5, that is why trying to run the 1.x version on anything 1.11 or earlier creates the Class loader issues.

The easy fix I have adapted is to create a branch off 1.5.8 tag and back port the UI fixes need to make the module display correctly. You can see the changes here. I have decided to call that version 1.5.8.1.

Thanks so much for you help.