Closed kephale closed 6 years ago
@kephale Was there also an SLF4J binding error beforehand? Or nothing else? See e.g. this SO post, which might be related.
Yes, that seems to be true. It looks like there are 2 Loggers on the classpath:
SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/home/kharrington/Fiji.app/jars/slf4j-simple-1.7.25.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/home/kharrington/Fiji.app/jars/logback-classic-1.2.3.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
SLF4J: Actual binding is of type [org.slf4j.impl.SimpleLoggerFactory]
Error while executing the main() method of class 'net.imagej.Main':
java.lang.IllegalStateException: Unable to acquire the logger context
at io.dropwizard.logging.LoggingUtil.getLoggerContext(LoggingUtil.java:46)
at io.dropwizard.logging.BootstrapLogging.bootstrap(BootstrapLogging.java:45)
at io.dropwizard.Application.bootstrapLogging(Application.java:38)
at io.dropwizard.Application.<init>(Application.java:26)
at net.imagej.server.ImageJServer.<init>(ImageJServer.java:64)
at net.imagej.server.DefaultImageJServerService$1.<init>(DefaultImageJServerService.java:66)
at net.imagej.server.DefaultImageJServerService.start(DefaultImageJServerService.java:66)
at net.imagej.server.console.ServerArgument.handle(ServerArgument.java:76)
at org.scijava.console.DefaultConsoleService.processArgs(DefaultConsoleService.java:102)
at net.imagej.legacy.LegacyConsoleService.processArgs(LegacyConsoleService.java:81)
at org.scijava.AbstractGateway.launch(AbstractGateway.java:97)
at net.imagej.Main.main(Main.java:55)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at net.imagej.launcher.ClassLauncher.launch(ClassLauncher.java:279)
at net.imagej.launcher.ClassLauncher.run(ClassLauncher.java:186)
at net.imagej.launcher.ClassLauncher.main(ClassLauncher.java:77)
I tracked this down to a slf4j dependency coming in through SciView. If I uninstall it, then imagej-server works just fine.
Should I add slf4j exclusions into SciView (like the ones in the imagej-server pom.xml)?
I believe the issue is not a Maven-related problem with SciView, since SciView marks the slf4j-simple
dependency as runtime+optional, so it won't affect downstream projects depending on it.
The problem is one of deployment: unfortunately, Dropwizard has a hard assumption about its SLF4J logging implementaiton, which is evil, but not easy to work around. So for now (as long as imagej-server is built on dropwizard), the easiest way to avoid this issue is to ensure that only one SLF4J binding is on the classpath: Dropwizard's assumed binding. That means slf4j-simple has to go. The slf4j-simple
JAR was uploaded to the SciView update site, but should not be necessary—I have now marked it obsolete, which hopefully avoids the exception above.
See also this Gitter discussion.
fresh Fiji on a Dell Ubuntu, installed imagej-server update site.