FHIR maven dependency problem


(Zach Raduban) #1

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!


(Prabodh Kotasthane) #2

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


(Daniel Kayiwa) #3

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


(Zach Raduban) #4

Okay. Here are the logs:

localhost.log

https://pastebin.com/KH7my1mQ

catalina.out

https://pastebin.com/NJwY9sVL


(Daniel Kayiwa) #5

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


(Zach Raduban) #6

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.


(Daniel Kayiwa) #7

How many modules are you running?


(Zach Raduban) #8

Only 1 sir.


(Daniel Kayiwa) #9

And what is the name of the .omod file?


(Zach Raduban) #10

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


(Daniel Kayiwa) #11

Can you share it and i try it out locally?


(Zach Raduban) #12

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>

(Daniel Kayiwa) #13

Did you resolve this?


(Zach Raduban) #14

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?


(Daniel Kayiwa) #15

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.


(Zach Raduban) #16

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