Jgit + Dependencies (SLF4J)

Hi All,

I’m looking to build a couple of custom snaps to enable native git support within the platform via the jgit library.

I have reached the point where I am deploying the custom snap pack but getting the following exceptions when trying to invoke the snap:

on first execution i get:

loader constraint violation: when resolving method “org.slf4j.impl.StaticLoggerBinder.getLoggerFactory()Lorg/slf4j/ILoggerFactory;” the class loader (instance of org/eclipse/jetty/webapp/WebAppClassLoader) of the current class, org/slf4j/LoggerFactory, and the class loader (instance of java/net/FactoryURLClassLoader) for the method’s defining class, org/slf4j/impl/StaticLoggerBinder, have different Class objects for the type org/slf4j/ILoggerFactory used in the signature

further exections then fail with:

Could not initialize class org.eclipse.jgit.internal.storage.file.FileRepository

My feeling is that the issue is to do with the version of slf4j that is being used. this seems to be a core library for snaplogic however the version used is below the version required for the jgit dependency

I think the subsequent exception is a red herring (although open to any suggestions here also) the libraries required are definitely included in the build as i have checked and they are being brought through via maven dependencies.

as a side note it does appear that this is possible as i have recently managed to get this library working via the script snap in python, and calling the 3rd party libraries (happy to share that if it may be of interest to anyone).

Many thanks,

Can you exclude the SLF4J transitive dependency from your pom.xml (from whatever library is bringing it in)?

1 Like

Hi Robin,

I Believe I have tried that but then running into issues similar to this thread:

not sure if you would possibly be open to a remote session to review this and if theres any options we might have missed?

Many thanks,