cancel
Showing results for 
Search instead for 
Did you mean: 

Deploy Maven Application in iFlow

01-31-2023 1:40 PM
kaisand28 Explorer
1020 views 5 comments
0 Likes
SAP Managed Tags
Subscribe

When I deploy a compiled Maven application JAR in an iFlow and the Maven application accesses files under resources in the JAR itself the files cannot be found. When I run this locally there are no problems. This is how I try to do it:

ClassLoader classLoader = Thread.currentThread().getContextClassLoader()

InputStream inStream = classLoader.getResourceAsStream("/Workday.xsd")

How can I access the resources in a Maven project deployed to CPI?

0 Likes

Accepted Solutions (0)

Answers (1)

Answers (1)

0 Likes

Hello Andre,

it works for me:

InputStream ris = getClass().getResourceAsStream("/name.txt")
kaisand28
Explorer
0 Likes

Hi Ilya,

thank you for your answer.

It does not work for me. The InputStream is null. The xsd is under resources in the JAR.

0 Likes

you'd better to check it in JAR. In my case (gradle-driven build) /src/resources translates to root folder of JAR so this code works well. I checked it in CPI of course. Do you use Eclipse resource loader? it shadows some data.

0 Likes

A clarification: my code is put into JAR, close to resource. It's not groovy script on CPI-side, it's groovy-packaged into JAR code.