Hi Lars,
The recommended way so far is to add classes to Payara Micro is to bundle the classes/JARs into a deployed WAR application. There is simply no other simple way how to do it.
Classloading of internal Payara Micro classes and everything found on the same classpath has changed in version 171. This change was made after careful thought with the aim to solve repetitive issues with the old way of packaging, when all classes from different internal modules and the classpath were packaged together in a flat structure, causing lot of collisions and unexpected behavior.
Since version 171, Payara Micro loads classes from within the payara-micro.jar file with a special classloader and ignores classes added on the classpath with the -cp argument. We're considering adding support for loading classes on the base classpath, but we haven't analyzed that yet thoroughly enough.
Your approach of putting the JARs into the payara-micro.jar could work, but due to optimizations we did to speed up the boot process, nested JARs have to be uncompressed - that's why you get the exception after you put the hazelcast JAR inside. The same optimization is also present for example in standalone JARs generated by Spring Boot framework. You may work around this by repackaging the original Hazelcast JAR as an uncompressed one and then place it inside Payara Micro JAR. We'll add support for properly adding external libraries into the main JAR via a command line argument or even support reading classes passed by the -cp option in the future, but I can't promise any time frame for that.
Ondrej
Dňa pondelok, 24. apríla 2017 14:59:05 UTC+2 Lars Lorenzen napísal(-a):