Welcome! Please see the About page for a little more info on how this works.

0 votes
in Java Interop by

The problem here might be more related to the pf4j default classloader but still:

I have a clojure plugin generating a class

(gen-class
 :name myplugin.SomeExtension
 :implements [plugin.SomeExtensionPoint]
 :prefix "-"
 :impl-ns my-plugin.some-extension)

The plugin jar is loaded in my clojure application using pf4j. When it is compiled with lein jar the class loads (but then I naturally have to put any plugin dependencies in the apps project.clj). When compiled with lein uberjar it fails with:

 Execution error (IllegalStateException) at myplugin.SomeExtension/<clinit> (REPL:-1).
; Attempting to call unbound fn: #'clojure.core/refer

with top of call stack

jdk.internal.reflect.NativeConstructorAccessorImpl/newInstance0 (NativeConstructorAccessorImpl.java:-2)
jdk.internal.reflect.NativeConstructorAccessorImpl/newInstance (NativeConstructorAccessorImpl.java:62)
jdk.internal.reflect.DelegatingConstructorAccessorImpl/newInstance (DelegatingConstructorAccessorImpl.java:45)
java.lang.reflect.Constructor/newInstance (Constructor.java:490)
java.lang.Class/newInstance (Class.java:584)
org.pf4j.DefaultExtensionFactory/create (DefaultExtensionFactory.java:38)
org.pf4j.ExtensionWrapper/getExtension (ExtensionWrapper.java:37)
org.pf4j.AbstractPluginManager/getExtensions (AbstractPluginManager.java:971)

I've struggled a bit but I am unsure about exactly what happens here and how to solve it?
Any ideas are most welcome!

(and the uberjar profile uses {:aot :all :omit-source true})

Please log in or register to answer this question.

...