FHIR maven dependency problem

Whenever I add a fhir dependency in my pom.xml, my UI fails and returns to the default “OpenMRS Platform Running!” screen, the screen shown whenever there is no legacy ui installed like the photo below (not mine).

I have tried using jar files and setting it in the classpath, but it shows me ClassNotFoundException when the fhir code is ran. I’m still trying to figure that one out too.

Does anyone have any idea why this is happening? The logs don’t show any clue toward the problem.

This is the dependency I add:

<dependency>
     <groupId>ca.uhn.hapi.fhir</groupId>
     <artifactId>hapi-fhir-structures-dstu3</artifactId>
     <version>3.3.0</version>
 </dependency>

Thank you for your replies!

Are you sure that you are using the .omod file for any of the ui module?

You also need to still share the logs. Just in case you are missing something obvious in them.

Okay. Here are the logs:

localhost.log

https://pastebin.com/KH7my1mQ

catalina.out

https://pastebin.com/NJwY9sVL

If you do not have the legacyui or referenceapplication modules, that is the expected screen.

I’m sorry for replying late as I focused on working on something else in the past few months. But sir @dkayiwa, I have a UI module, and what I use is the code from the legacyui module to create my own module with customized interface. The login page shows correctly, until I put the fhir maven dependencies. I need the hapi-fhir maven dependency in order to get and post patients to a fhir server.

Thank you for your attention.

How many modules are you running?

Only 1 sir.

And what is the name of the .omod file?

We named it “chitscore”. But it’s essentially the legacy-ui module with some changes to fit our client’s needs.

Can you share it and i try it out locally?

1 Like

Sir @dkayiwa I have asked permission to my superiors if I may share the code here, but they still have not replied. I tested it on the original legacy-ui code, and I have replicated it there. Without the dependencies the UI works, but upon injecting the dependencies, the UI is gone. You can try it locally using the Legacy-UI module.

Thank you for the help!

Legacy-UI Github Repo:

Added these dependencies in root pom.xml:

		<dependency>
		    <groupId>ca.uhn.hapi.fhir</groupId>
		    <artifactId>hapi-fhir-base</artifactId>
		    <version>3.5.0</version>
		</dependency>
		<dependency>
		    <groupId>ca.uhn.hapi.fhir</groupId>
		    <artifactId>hapi-fhir-structures-dstu3</artifactId>
		    <version>3.5.0</version>
		</dependency>
		<dependency>
		    <groupId>ca.uhn.hapi.fhir</groupId>
		    <artifactId>hapi-fhir-client</artifactId>
		    <version>3.5.0</version>
		</dependency>	

Added these dependencies in omod/pom.xml:

		<dependency>
		    <groupId>ca.uhn.hapi.fhir</groupId>
		    <artifactId>hapi-fhir-base</artifactId>
		</dependency>
		<dependency>
		    <groupId>ca.uhn.hapi.fhir</groupId>
		    <artifactId>hapi-fhir-structures-dstu3</artifactId>
		</dependency>
		<dependency>
		    <groupId>ca.uhn.hapi.fhir</groupId>
		    <artifactId>hapi-fhir-client</artifactId>
		</dependency>

Did you resolve this?

Sadly, I have not resolved this sir. I tried excluding some similar compile dependencies of openmrs with fhir, thinking that it might have been clashing with each other, but it didn’t work. And that prompted me to ask for help here.

Have you tried it out locally sir?

Adding these exclusions to the first two dependencies should fix it: https://pastebin.com/EkutxhfS

When you run mvn dependency:tree you will also notice that some of your dependencies like hapi-fhir-base is included in the others.

1 Like

Thank you sir. I see, I’ll just remove it.