Error: Report Evaluation Failing for XLS reports (with Core 2.4)

@icrc.thonorio what are the full details of your environment? War version, all modules and versions, java version, operating system?

It looks to me like maybe something in your environment is causing a different XML parser or different set of POI libraries from getting loaded than expected.

The reporting module hasn’t been updated to have any build profiles against the 2.3.x, 2.4.x, or 2.5.x lines of OpenMRS core yet (unfortunately). It would be great if someone had the bandwidth to add these profiles into the reporting module and then corresponding build plans into Bamboo as is done with the 1.9-2.2 version we are currently building and testing against. This would help identify this kind of problem sooner.


1 Like

Hi @mseaton,

You can find the environment information in the link bellow:

Also, this environment may have to much clutter, if you feel the need, I can ty to use the reference application for further testing.

Hi @gcliff

By doing a quick search in the imported dependencies I’m able to found the class ZipPackagePropertiesMarshaller as a part of POI

And since the POI version at rune time seems to remain the same, I´m not sure why its not found.

The key part here is the Could not initialize class which is different from a plain NoClassDefFoundError. NoClassDefFoundError means that a valid class couldn’t be found and is raised either when the class isn’t present on the classpath or, as in this case, when there’s an exception thrown when trying to initialize the class (in which case the classloader can’t load the class definition).

As @mseaton said, this is likely because of a different XML parser being loaded. Specifically, the ZipPackagePropertiesMarshaller extends the PackagePropertiesMarshaller which has this static initializer block, which is likely throwing an exception.

Unfortunately, without the full log it’s hard to tell more than that. There’s likely to be a “Caused by” entry later in the stack trace you provided a snippet of that might have more detail on what happened.

If I had to make a guess this looks like a commit that might’ve broken things (assuming 1.21.0 works). (The reasoning here is that adding a module to the aware of list makes that’s module’s classpath part of the existing module’s classpath, so it’s entirely possible that after that change, it’s loading some other class from it’s changed classpath than it was using before).

Hi @ibacher

I tried to test if the problem was related to the version 1.22.0-SNAPSHOT by running 1.21.0.

But still seem to have the same issue.

On another note, Not sure if this may be relevant, but I notice that the error I get is different the first time I try to run a report.

The Error in question:

@mseaton for the record, we have decided to do just that. Hopefully errors will popup that way that can be solve through debugging Spring tests.

@icrc.thonorio will start looking into adding a 2.4 profile first and will ask for help on the Slack channel if necessary.

That’s great - thanks @mksd and @icrc.thonorio ! Definitely reach out on slack with any issues.

Hi @mseaton, @mksd, @dkayiwa

I did create 2 new profiles (for 2.3 and 2.4), however the api-test seems to throw a lot of ERRORS.

Because of that, I needed to Update the file TestingApplicationContext (can be seen bellow) and add a new ReportTestDataset-openmrs-“VERSION”.xml file.

This solved the great majority of the Errors but 7 of them still stand.

All seem to be related with “EvaluationException: Failed to evaluate Error evaluating because: null”

One of the failing tests:

public void evaluate_shouldReturnAllOrdersForAVisit() throws Exception {
		VisitEvaluationContext context = new VisitEvaluationContext();
		context.setBaseVisits(new VisitIdSet(1));
		OrderForVisitDataDefinition d = new OrderForVisitDataDefinition();
		EvaluatedVisitData vd = Context.getService(VisitDataService.class).evaluate(d, context);
		Assert.assertEquals(expectedOrders.intValue(), ((List) vd.getData().get(1)).size());

Pom File:


TestingApplicationContext: (Similar issue Problem running tests against OpenMRS Core 2.3.0- - #3 by mogoodrich)

<property name="packagesToScan">

Do you have a draft pull request that reproduces it?

Hi @dkayiwa

I just created the following PR: RA-1947 - Added profiles for Openmrs platform 2.3 and 2.4 by icrc-toliveira · Pull Request #217 · openmrs/openmrs-module-reporting · GitHub

Also I should also specify that the majority the tests I did where using the profile for 2.4.

I have just pulled the changes in your pull request and locally run mvn clean install successfully.

Hi @dkayiwa

I´m not to familiar with maven profiles, but I don´t think this one is executed from the get-go

How it looks from my side if I don´t enable it (Intellij):


I have been using this mvn package -P 2.4 to run the mentioned profile

@icrc.thonorio - I also get errors while trying to build with your 2.4 profile, but that’s not surprising to me. I do get different errors than you were describing - mine appear to be related to Mockito version changes.

Hello @dkayiwa @mseaton @icrc.thonorio @ibacher @sharif @isears

I am trying to implement anti-csrf strategies to make OMRS more secure. Below is a PR of what i have done in core.

My ambition is to create a csrf token from core, which can also be accessed in the referenceapplication-module on the login page, to verify that the request is coming from an authorised source.

I think what i added in core works, but the reference application was using an earlier version on openmrs so i decided to update it to the version having my security configurations, 2.5-SNAPSHOT This also raised the need to change the version of some modules to the latest release.

Currently seeking, i am facing an error allergy_reaction refers to an unmapped class: org.openmrs.Allergy - Even adding the “package to scan” property didn’t work.

<property name="packagesToScan">

If anyone is interested i reproducing it locally, here are my changes in this module

Any suggestions are warmly appreciated. Thanks

@jnsereko - these errors can be annoying to track down. What I’m seeing in your error log is this:

[jar:file:/home/joshua/.m2/repository/org/openmrs/module/appframework-api/2.16.0/appframework-api-2.16.0-tests.jar!/TestingApplicationContext.xml]: Invocation of init method failed; nested exception is org.hibernate.MappingException: An association from the table allergy_reaction refers to an unmapped class: org.openmrs.Allergy
Caused by: org.hibernate.MappingException: An association from the table allergy_reaction refers to an unmapped class: org.openmrs.Allergy

This tells me that it isn’t the referenceapplication module’s TestingApplicationContext.xml file that is at issue still, but rather the one in a dependency - specifically in the appframework module. It is likely that this module has not yet been upgraded to support building against OpenMRS core 2.5. See here:

Hope this helps, Mike

Hey @mseaton This makes alot of sense. Maybe understanding it will help.

This was really difficult to track on my side

Hello @mseaton I have added the packagesToScan property to the appframework and changed its version in the reference-application-module to 2.17.0-SNAPSHOT, so that this change is accessed.

However, i am having an error

Caused by: org.hibernate.cache.CacheException: 
net.sf.ehcache.CacheException: Another CacheManager with same name 'hibernateCache' already exists in the same VM. Please provide unique names for each CacheManager in the config or do one of the following:
1. Use one of the CacheManager.create() static factory methods to reuse same CacheManager with same name or create one if necessary
2. Shutdown the earlier cacheManager before creating new one with same name.
The source of the existing CacheManager is: DefaultConfigurationSource [ ehcache.xml or ehcache-failsafe.xml ]
Caused by: net.sf.ehcache.CacheException: 

the full log is CacheManager with same name 'hibernateCache' already exists in the same VM. -

I have spent three days now finding possible ways of resolving this but all resources I have accessed haven’t solved my issue.

below are my attempts;

  1. Attempt one; Making the cache shareable from core openmrs-core/ at master · openmrs/openmrs-core · GitHub through cacheManagerFactoryBean.setShared(true); to make this shared

  2. Attempt two; tried adding the ehcache.xml file and the ehcache-api.xml to the TestingApplicationContext.xml like;

        <!--  default properties must be set in the -->
    <bean id="hibernateCache"  class="org.springframework.cache.ehcache.EhCacheManagerFactoryBean" scope="singleton">
         <property name="shared" value="true"/>
         <property name="configLocation">

How can i solve this? cc @ibacher @dkayiwa @mksd and anyone else.

Thank you so much

Did you resolve this?

hello @dkayiwa

Not yet. Am still being blocked here.

Can you share the changes that you have made to the appframework module?