[slf4j-user] How can I prevent this Linkage Error?

larry.stamper at daimler.com larry.stamper at daimler.com
Fri Oct 9 23:19:14 CEST 2020


I am using an API which uses slf4j (it happens to be jcifs-ng, but I don't think that matters.) When I am able to define my classpath myself, I can call this API with no problem - slf4j finds no bindings and falls back on NOP. But when I call the API running under a service whose classpath I can't control, I get this error:

java.lang.LinkageError: loader constraint violation: when resolving method "org.slf4j.impl.StaticLoggerBinder.getLoggerFactory()Lorg/slf4j/ILoggerFactory;" the class loader (instance of chs/api/mgr/local/ExtraJarPluginClassLoader) of the current class, org/slf4j/LoggerFactory, and the class loader (instance of <bootloader>) for the method's defining class, org/slf4j/impl/StaticLoggerBinder, have different Class objects for the type org/slf4j/ILoggerFactory used in the signature
       at org.slf4j.LoggerFactory.getILoggerFactory(LoggerFactory.java:418)
       at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:357)
       at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:383)
       at jcifs.smb.NtlmPasswordAuthenticator.<clinit>(NtlmPasswordAuthenticator.java:58)

I don't use sl4j directly. Is there some way I can bind to NOP before I make any calls to the API?

Larry Stamper
MP9-OCS
DISYS (Digital Intelligence Systems)
Consulting Software Engineer
Cell: (503) 560-7004
larry.stamper at daimler.com<mailto:larry.stamper at daimler.com>


If you are not the addressee, please inform us immediately that you have received this e-mail by mistake, and delete it. We thank you for your support.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.qos.ch/pipermail/slf4j-user/attachments/20201009/5d63214f/attachment.html>


More information about the slf4j-user mailing list