larsquitsch
Returning Observer

java.security.AccessControlException

Hello,

I've created modul to push data to an algolia search engine (elastic). The push works fine if the executable is executed as a script from the Sitearchitect. But when i try to call it as job on the server i end up with (java.security.AccessControlException) access denied ("java.lang.RuntimePermission" "accessDeclaredMembers")
even with the checkbox "all rights" of the module ticked.  

The stacktrace looks like this:

 

ERROR 23.01.2024 10:02:59.229{dNR=} (de.espirit.firstspirit.server.scheduler.ScriptTaskExecutor): error during script execution : com.algolia.search.exceptions.AlgoliaRuntimeException: com.fasterxml.jackson.databind.exc.InvalidDefinitionException: Failed on call to `getDeclaredMethods()` on class `java.io.Serializable`, problem: (java.security.AccessControlException) access denied ("java.lang.RuntimePermission" "accessDeclaredMembers")
 at [Source: (GZIPInputStream); line: 1, column: 1]
com.algolia.search.exceptions.AlgoliaRuntimeException: com.fasterxml.jackson.databind.exc.InvalidDefinitionException: Failed on call to `getDeclaredMethods()` on class `java.io.Serializable`, problem: (java.security.AccessControlException) access denied ("java.lang.RuntimePermission" "accessDeclaredMembers")
 at [Source: (GZIPInputStream); line: 1, column: 1]
	at com.algolia.search.HttpTransport.lambda$executeWithRetry$0(HttpTransport.java:173)
	at java.base/java.util.concurrent.CompletableFuture$UniCompose.tryFire(CompletableFuture.java:1072)
	at java.base/java.util.concurrent.CompletableFuture$Completion.exec(CompletableFuture.java:479)
	at java.base/java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:290)
	at java.base/java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(ForkJoinPool.java:1020)
	at java.base/java.util.concurrent.ForkJoinPool.scan(ForkJoinPool.java:1656)
	at java.base/java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1594)
	at java.base/java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:183)

 

Running on FS 2022.1

Does anyone have an idea what is going wrong here?

Best regards,
Lars

0 Kudos
2 Replies
Windmüller
Crownpeak employee

Hello Lars,

have you tried wrapping your call in AccessController#doPrivileged?

0 Kudos
larsquitsch
Returning Observer

@Windmüller Sorry for my late response, but wrapping the call with doPrivileged did also not work 😞
But thanks for the help.

0 Kudos