Closed rai-prashanna closed 1 year ago
I don't get compilation error after adding following dependency in pom.xml
however, the following lines of code never get executed.
om.loadEntrypoints();
String decision=om.evaluate(inputJson,"authz/policy/allow");
call om.loadEntrypoints() before evaluate() no more required.
If you want to check multiple entrypoints correctly loaded, check returned value of om.getEntrypoints().
Code: System.out.println(om.getEntrypoints()); Result: {opa/wasm/test/allowed=0}
Check "authz/policy/allow" exists.
I tested multiple entrypoints, there's no problem.
@sangkeon
This is the compilation error I get in my environment.
Tested on OpenJDK 64-Bit Server VM 18.9 (build 11.0.1+13, mixed mode), OPA 0.52.0 version
I created a repo that does interaction with wasm binary using opa-java-wasm library in Java.
link to the GitHub repo is https://github.com/rai-prashanna/test-opa-java-wasm
It's maven dependency scope issue.
Fixed in 0.2.3.
@sangkeon
Now, i don't get any compilation error but executions skip from the initialization of OPAModule without executing evaluate method.
When I added breakpoints, I could see that execution is happening till line 77 of OPAModule.class but after that execution exits from there as can be seen in this pictures also.
So execution happens never to this line om.evaluate(inputJson,"authz/policy/allow");
second picture of execution is as follows
My wasm binary is in this bundle
In my pc, your bundle works and returns result=[{"result":false}]
change your input string to "" and evaluate() called.
If it called and return result, it's input format issue.
Try to change JDK, json library and etc.
Thanks for your prompt response.
I wrote code like you did in picture.
I experiment with JDK 8 and JDK 11. None of them work.
Now, I get a different error.
My glibc version is
My os version is VERSION= ubuntu "20.04.6 LTS (Focal Fossa)"
Use java-opa-wasm 0.2.3_glibc2.31 version. (just downgraded wasmtime-java 0.14.0 to 0.13.0)
https://central.sonatype.com/artifact/io.github.sangkeon/java-opa-wasm/0.2.3_glibc2.31/versions
Thanks! Now, it works!
Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.6.0:compile (default-compile) on project performanceTesting: Compilation failure
cannot access io.github.kawamuray.wasmtime.Disposable [ERROR] class file for io.github.kawamuray.wasmtime.Disposable not found
I would appreciate your help. Thanks!