Skip to main content

Hi all,

I have a query about the Cloud Java transformer. I need to read the 7zip file in my development using a Java transformer. To accomplish this, I constructed and tested a byte type java transformer. It works perfectly in developer studio projects.  I include the external libraries here to read the 7zip file content. They are listed below.

  • org.apache.commons.compress.archivers.sevenz.SevenZArchiveEntry
  • org.apache.commons.compress.archivers.sevenz.SevenZFile
  • org.apache.commons.compress.utils.SeekableInMemoryByteChannel

after creating a .jar file I added it to the transformer and run it using the routing address Response Transformer. Once it is running in the application, I got the following error in the application message.   

------------------------------------------------------------------------------------------------------

Error while storing response for message ID #387.

Caused by: ifs.fnd.base.SystemException: org/tukaani/xz/FilterOptions

Caused by: java.lang.reflect.InvocationTargetException: null

Caused by: java.lang.NoClassDefFoundError: org/tukaani/xz/FilterOptions

Caused by: java.lang.ClassNotFoundException: org.tukaani.xz.FilterOptions from oModule "deployment.ifsapp-int.ear" from Service Module Loader]

-------------------------------------------------------------------------------------------------------

Since this is a 7zip file it is mandatory to use 7zip external libraries in the transformer. Then I tried out this process with the .zip file type.  To do this I used the java standard library called “java.util.zip.*”.

When I tested it with the Java transformer in the application, it read the zip file content without issues.  I believe that when we use Java transformers in the program, the external libraries are not found. Is this a possibility? If that's the case, could you please advise me on how to incorporate these external libraries into the application?

Hi @isujlk 

 

You need to include the 3rd party libraries in your transformer .jar

To do that, add the jars in the build target in the build.xml

Eg:

Add 3rd party libraries in the lib folder of the dev studio project

add the 3rd party libs to the build xml build target

  <target name="build" depends="compile">
<jar jarfile="${dist}/MyTransformer-1.0.0.jar" basedir="${build}">
<fileset dir="${lib}" includes="3rd_party_jar_1.jar" />
<fileset dir="${lib}" includes="3rd_party_jar_n.jar" />
<manifest>
<attribute name="Transformer-class" value="TransformerMain"/>
</manifest>
</jar>
</target>

 

build the transformer jar.

 

Hope it helps!

Damith


Hi All,
 

Is it possible to add third party jar libraries (e.g. my-util-library.jar), which can then be imported later, for example, into the code of a java transformer similar to the libraries ifs.fnd.*, java.*
so that they are not included directly in the jar code of each transformer?

...
import ifs.fnd.base.IfsException;
import ifs.fnd.connect.xml.BinaryTransformer;
import java.io.ByteArrayOutputStream;
import my.util.*;
...


I found in the directory structure of the fndbas component such 2 places:

 

Image 1


 

Image 2


It seems that the appropriate place is the one shown in Image 2.

In addition to placing the jar files, are any additional XML configuration files required or do I need to add some entries in the existing XML configuration files?

Is this even possible to implement?

Regards,
Krzysztof


Reply