Error loading a fat jar plugin (User Defined Functions)

I copied a fat jar (including all dependencies jars) as a plugin.
When I start the database it fails with this error:

... Caused by: org.neo4j.kernel.lifecycle.LifecycleException: Component 'org.neo4j.procedure.impl.GlobalProceduresRegistry@65fe2691' was successfully initialized, but failed to start. Please see the attached cause exception "class org.neo4j.resources.CpuClock$2 has interface org.neo4j.resources.CpuClock as super class".

My code does not access any Neo4J resources like CpuClock.
The resources included in the jar are sparkjava and freemarker.

Before I had my code as a simple jar which loaded alright, but gave a "Class not found" error when I tried to use my functions.

I'm using Neo4J 4.1.0 with Desktop 1.3.10

I would appreciate any informed information.