How can I fix this issue "Failed to load ApplicationContext"?

Hi all! Recently, I want to test my module controller, but it reported this error, and the following figure shows my test code.

So, can anyone tell me how to fix this problem?

hey @d404d may you please check the error-link

I think there is no problem with it.

I can use it

I changed some parts of the code, but it reported the same error.

@d404d When I try to view the error you’re reporting, I get this:

So, it’s not really possible to see what the error is. You can probably see the same error message if you try to access that URL via a private window. Maybe try posting the error log as as Gist on GitHub?

Thank you for the reminder! And I have put on the Gist.

I tried to add the ContextConfiguration directly, but still can’t work :scream_cat:

can we look at this entire class of yours Project1Activator.class

Yes, please.

But, is there any relationship between the Project1Activator and Project1Controller?

Which version of the JDK are you compiling with? And what JDK version are you targetting in your pom.xml? For the most part, when working on OMRS, you’ll need to target JDK 8, if not just use JDK 8, unless your project depends on openmrs-core 2.4.0 or later and any other modules you depend on are updated to recent versions.

PS The error I see in the Gist (thanks for that!) is this:

ASM ClassReader failed to parse class file - probably due to a new Java class file version that isn't supported yet

Hi Ian, thanks for your answer! Actually, I and my team members are using the JDK 8 and the version of openmrs-core is 2.4.0. So do I need to update the pom.xml?

And when your IDE launches the test, it’s definitely using JDK 8?

Yes, it is. This is my project structure.

<project xmlns="" xmlns:xsi=""


	<description>no description</description>




			<!-- Importing versions from refapp distro -->

			<name>OpenMRS Nexus Repository</name>
			<name>Maven Repository Switchboard</name>
			<name>OpenMRS Nexus Repository</name>



And this is my pom.xml file. Does anyone know what should I add to make sure the version of asm can match my jdk?

Ah… if you’re targeting platform 1.11 (or really 1.x) you need to compile for Java 7 rather than Java 8. If you want to use Java 8 features, you probably need to target a minimum of OpenMRS 2.0.0.

OK, I will try to update it. Thank you

Sorry, you mean this part


Yes… if you change that to 2.0.0, it should support Java 8

1 Like

Hi Ian, I changed the openmrsPlatformVersion to 2.0.0.


But, I meet a new problem, that this module can not find out this dependency.