
Hello,
I have created a java class 'poc 'and have packaged it under a package 'dec', I have the java class and package under src/main/java, but when I am trying to reference this class and a method 'abc' in data weave, I get this below error:
Scripting language error on expression '%dw 2.0
import java!dec::poc
output application/json
---
{
a: poc::abc("dGF...'. Reason: Unable to resolve reference of poc::abc
This is how my dataweave expression looks like;
%dw 2.0
import java!dec::poc
output application/json
---
{
a: poc::abc("dGFubWF5")
}
Not sure how to resolve this.
Forum Ambassador Manish Kumar Yadav (Hitachi Energy)
Hi ,
This error occurred only in Mule 4.x because of Metadata .
Mule 4 is very sensitive towards metadata. So please try below possible solution.
I am assuming your method in Java class is Static method or if not then you need to intialize Constructor using new .
Possible solution:
- Don't use any subflow just try to complete everything in one flow ( This answer does not look good but please try)
- Updates your runtime to Latest I am sure it will work
- if you are using any component Which requires Metadata then please set.
- Even if this error occurred at design time Still if you run your code it will work I guess.
Thank and regards,
Manish Kumar Yadav
MuleSoft Forum Moderator