I am currently integrating a Java library with a Fantom-based application and have encountered a JFFI-related issue. Specifically, I am attempting to reference a simple Java class from Fantom. While no method is being actively invoked, the application fails during class loading with a JFFI error when the Java class is used within an Axon function.
Here is a brief summary of the setup:
The Java class is a plain POJO with no external dependencies.
I have placed the compiled JAR under <fantom_home>/lib/java/ext and confirmed it appears using fan compilerJava::ClassPath.
The Java class is referenced from a Fantom class, which is then called via Axon.
The error occurs even before any Java method is invoked—only referencing the class causes the issue.
I have reviewed the documentation and ensured the JAR is structured correctly.
Reference: https://fantom.org/doc/docLang/JavaFFI
However, the problem persists, and I would appreciate your guidance on resolving this issue.
//Skyspark Axon Function, that is the start point of the program
Naren S Thu 26 Jun
Dear Team,
I am currently integrating a Java library with a Fantom-based application and have encountered a JFFI-related issue. Specifically, I am attempting to reference a simple Java class from Fantom. While no method is being actively invoked, the application fails during class loading with a JFFI error when the Java class is used within an Axon function.
Here is a brief summary of the setup:
The Java class is a plain POJO with no external dependencies.
I have placed the compiled JAR under <fantom_home>/lib/java/ext and confirmed it appears using fan compilerJava::ClassPath.
The Java class is referenced from a Fantom class, which is then called via Axon.
The error occurs even before any Java method is invoked—only referencing the class causes the issue.
I have reviewed the documentation and ensured the JAR is structured correctly.
Reference: https://fantom.org/doc/docLang/JavaFFI
However, the problem persists, and I would appreciate your guidance on resolving this issue.
//Skyspark Axon Function, that is the start point of the program
() => do
end
//Fantom Axon Function call JavaTest.fan print function @Axon @NoDoc
//Fantom Class make Java declaration using [java] com.wesco.service::JavaTestService class JavaTest {
}
Axon Function Error: errLast:
Please let me know if you need any logs or a minimal reproducible project.
Naren S Fri 27 Jun
Solution for the Error:
When creating a connector and deploying it to SkySpark, you need to ensure that your JAR file is placed in both of the following locations:
<fantom_home>/lib/java/ext
skyspark-3.x.x/lib/java/ext
This ensures that SkySpark can recognize and load the Java classes from your JAR properly.