Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Running fits.sh throws "Failed to instantiate SLF4J LoggerFactory" in 1.5.2 release #316

Closed
bbarberBPL opened this issue Apr 29, 2022 · 9 comments

Comments

@bbarberBPL
Copy link

I just updated to the recent 1.5.2 release locally and tried testing it using a bash shell (ie: /path/to/fits/fits.sh -i /path/to/file.tif) and it it now throwing the error in the title. I verified my $FITS_HOME environment variable is still pointing to the correct folder and all the jars get appended to the $APPCLASSPATH in fits-env.sh. Here is the full stack trace I captured.

java.lang.NoClassDefFoundError: org/apache/logging/log4j/spi/AbstractLoggerAdapter
        at java.base/java.lang.ClassLoader.defineClass1(Native Method)
        at java.base/java.lang.ClassLoader.defineClass(ClassLoader.java:1017)
        at java.base/java.security.SecureClassLoader.defineClass(SecureClassLoader.java:174)
        at java.base/jdk.internal.loader.BuiltinClassLoader.defineClass(BuiltinClassLoader.java:800)
        at java.base/jdk.internal.loader.BuiltinClassLoader.findClassOnClassPathOrNull(BuiltinClassLoader.java:698)

        at java.base/jdk.internal.loader.BuiltinClassLoader.loadClassOrNull(BuiltinClassLoader.java:621)
        at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:579)
        at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178)
        at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:522)
        at org.slf4j.impl.StaticLoggerBinder.<clinit>(StaticLoggerBinder.java:36)
        at org.slf4j.LoggerFactory.bind(LoggerFactory.java:150)
        at org.slf4j.LoggerFactory.performInitialization(LoggerFactory.java:124)
        at org.slf4j.LoggerFactory.getILoggerFactory(LoggerFactory.java:417)
        at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:362)
        at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:388)
        at edu.harvard.hul.ois.fits.Fits.<init>(Fits.java:162)
        at edu.harvard.hul.ois.fits.Fits.<init>(Fits.java:125)
        at edu.harvard.hul.ois.fits.Fits.<init>(Fits.java:114)
        at edu.harvard.hul.ois.fits.Fits.constructFits(Fits.java:317)
        at edu.harvard.hul.ois.fits.Fits.main(Fits.java:295)
Caused by: java.lang.ClassNotFoundException: org.apache.logging.log4j.spi.AbstractLoggerAdapter
        at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:581)
        at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178)
        at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:522)
        ... 20 more
Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/logging/log4j/spi/AbstractLoggerAdapter
        at java.base/java.lang.ClassLoader.defineClass1(Native Method)
        at java.base/java.lang.ClassLoader.defineClass(ClassLoader.java:1017)
        at java.base/java.security.SecureClassLoader.defineClass(SecureClassLoader.java:174)
        at java.base/jdk.internal.loader.BuiltinClassLoader.defineClass(BuiltinClassLoader.java:800)
        at java.base/jdk.internal.loader.BuiltinClassLoader.findClassOnClassPathOrNull(BuiltinClassLoader.java:698)
        at java.base/jdk.internal.loader.BuiltinClassLoader.loadClassOrNull(BuiltinClassLoader.java:621)

        at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:579)
        at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178)
        at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:522)
        at org.slf4j.impl.StaticLoggerBinder.<clinit>(StaticLoggerBinder.java:36)
        at org.slf4j.LoggerFactory.bind(LoggerFactory.java:150)
        at org.slf4j.LoggerFactory.performInitialization(LoggerFactory.java:124)
        at org.slf4j.LoggerFactory.getILoggerFactory(LoggerFactory.java:417)
        at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:362)
        at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:388)
        at edu.harvard.hul.ois.fits.Fits.<init>(Fits.java:162)
        at edu.harvard.hul.ois.fits.Fits.<init>(Fits.java:125)
        at edu.harvard.hul.ois.fits.Fits.<init>(Fits.java:114)
        at edu.harvard.hul.ois.fits.Fits.constructFits(Fits.java:317)
        at edu.harvard.hul.ois.fits.Fits.main(Fits.java:295)
Caused by: java.lang.ClassNotFoundException: org.apache.logging.log4j.spi.AbstractLoggerAdapter
        at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:581)
        at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178)
        at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:522)
        ... 20 more

My machine/environment specs are

OS: Pop!_OS 20.04
Java version: openjdk version "11.0.15" 2022-04-19
@cudevmaxwell
Copy link

Running into this issue as well. Adding log4j-api-2.17.2.jar and log4j-core-2.17.2.jar to the libs directory fixes this issue... but then returns Exception in thread "main" java.lang.NoClassDefFoundError: org/w3c/dom/ElementTraversal, meaning #256 isn't actually resolved.

@daveneiman
Copy link
Contributor

Will have an update for this shortly. The exception was being thrown when running FITS in Java 8 but not Java 11.

@cudevmaxwell
Copy link

Really appreciate the update and your work, thanks @daveneiman.

@daveneiman
Copy link
Contributor

Hello - please check out this 1.5.3 release. I should resolve the above problems when running under Java 8.
https://github.com/harvard-lts/fits/releases/tag/1.5.3

@cudevmaxwell
Copy link

The new release (1.5.3) is working great in our environment. Tested with a manual run and from our Hyrax based IR stack. Thanks again @daveneiman!

@daveneiman
Copy link
Contributor

@cudevmaxwell Turns out we've identified that this release, which upgraded to log4j2, still contains log4j (1) jar files within Tika and Droid. Will be trying to sort out the implications.

@bbarberBPL
Copy link
Author

The release(1.5.3) is working on my end now too(both via terminal and my through my rails app). Thanks for the quick fix @daveneiman!

@pwinckles
Copy link
Contributor

@daveneiman Why did you remove the log4j2 dependencies in this commit: 519a4ab

Those are required for the logging to work. The main branch does not currently work.

@daveneiman
Copy link
Contributor

This has been fixed in in the main branch.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants