Author: Abhishek Bathwal

Recently I worked on an application to read barcode images from URL or Base64 encoded payload and provide the result.

For that I have used a jar from Dynamsoft and created a java package importing the classes of barcode reader from dynamsoft and creating a class for ImageReader.

Below is the structure of the application and the Java package:

I wrote two static methods one for reading the normal URL of the image and another for reading the Base64 encoded payload.



Then, I wrote the below code to call the ImageReader class from dataweave:

When Executed locally on Windows OS it worked fine and returned expected results:

But when the same code is executed by deploying it over the server, then I was unable to find the static method for Base64 and returned with error:

So to overcome the error I changed the java code. In place of using multiple static methods, I used if else condition. This time I changed the package name and introduced a new variable in the static method to validate the if else condition. 0 – For Base64 and 1 – For URL.

New Code in dataweave:

New Java Code:



The development of the applications signifies that a java class can be called using dataweave and the Static method behaves differently on Linux and Windows OS.

Happy Learning!

Leave a Comment