ImageJ-Matlab log4j error

ImageJ-Matlab appears to run fine in R2015a. However, I do get this log4j error upon startup:

log4j:WARN No appenders could be found for logger (org.bushe.swing.event.EventService).
log4j:WARN Please initialize the log4j system properly.
[ERROR] Cannot create plugin: class='org.scijava.plugins.scripting.javascript.JavaScriptScriptLanguage', name='JavaScript', priority=0.0, enabled=true, pluginType=ScriptLanguage
java.lang.IllegalArgumentException: No such script engine: javascript
    at org.scijava.script.AdaptedScriptLanguage.findFactory(AdaptedScriptLanguage.java:151)
    at org.scijava.script.AdaptedScriptLanguage.<init>(AdaptedScriptLanguage.java:73)
    at org.scijava.plugins.scripting.javascript.JavaScriptScriptLanguage.<init>(JavaScriptScriptLanguage.java:59)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
    at java.lang.Class.newInstance(Class.java:442)
    at org.scijava.plugin.PluginInfo.createInstance(PluginInfo.java:304)
    at org.scijava.plugin.DefaultPluginService.createInstance(DefaultPluginService.java:236)
    at org.scijava.plugin.DefaultPluginService.createInstances(DefaultPluginService.java:225)
    at org.scijava.plugin.DefaultPluginService.createInstancesOfType(DefaultPluginService.java:216)
    at org.scijava.plugin.AbstractSingletonService.initInstances(AbstractSingletonService.java:125)
    at org.scijava.plugin.AbstractSingletonService.getInstances(AbstractSingletonService.java:72)
    at org.scijava.script.DefaultScriptService.initScriptLanguageIndex(DefaultScriptService.java:347)
    at org.scijava.script.DefaultScriptService.scriptLanguageIndex(DefaultScriptService.java:312)
    at org.scijava.script.DefaultScriptService.getIndex(DefaultScriptService.java:119)
    at org.scijava.script.DefaultScriptService.canHandleFile(DefaultScriptService.java:235)
    at org.scijava.script.ScriptFinder.discoverScripts(ScriptFinder.java:131)
    at org.scijava.script.ScriptFinder.discoverScripts(ScriptFinder.java:125)
    at org.scijava.script.ScriptFinder.findScripts(ScriptFinder.java:94)
    at org.scijava.script.DefaultScriptService.initScripts(DefaultScriptService.java:388)
    at org.scijava.script.DefaultScriptService.scripts(DefaultScriptService.java:330)
    at org.scijava.script.DefaultScriptService.getScripts(DefaultScriptService.java:169)
    at net.imagej.legacy.LegacyService.getScriptsAndNonLegacyCommands(LegacyService.java:609)
    at net.imagej.legacy.IJ1Helper.addMenuItems(IJ1Helper.java:676)
    at net.imagej.legacy.LegacyService.initialize(LegacyService.java:472)
    at org.scijava.service.ServiceHelper.createServiceRecursively(ServiceHelper.java:353)
    at org.scijava.service.ServiceHelper.createExactService(ServiceHelper.java:269)
    at org.scijava.service.ServiceHelper.loadService(ServiceHelper.java:231)
    at org.scijava.service.ServiceHelper.createServiceRecursively(ServiceHelper.java:340)
    at org.scijava.service.ServiceHelper.createExactService(ServiceHelper.java:269)
    at org.scijava.service.ServiceHelper.loadService(ServiceHelper.java:231)
    at org.scijava.service.ServiceHelper.loadService(ServiceHelper.java:194)
    at org.scijava.service.ServiceHelper.loadServices(ServiceHelper.java:166)
    at org.scijava.Context.<init>(Context.java:278)
    at org.scijava.Context.<init>(Context.java:234)
    at org.scijava.Context.<init>(Context.java:174)
    at org.scijava.Context.<init>(Context.java:160)
    at net.imagej.ImageJ.<init>(ImageJ.java:76)
    at net.imagej.Main.launch(Main.java:61)
    at net.imagej.matlab.ImageJMATLAB.launch(ImageJMATLAB.java:151)
    at net.imagej.matlab.ImageJMATLAB.start(ImageJMATLAB.java:105)
    at net.imagej.matlab.ImageJMATLAB.start(ImageJMATLAB.java:92)
    at net.imagej.matlab.ImageJMATLAB.start(ImageJMATLAB.java:81)
1 Like

Very sorry for the delay in reply, @ericbarnhill.

I assume you switched your MATLAB over to Java 8 as instructed?

Even if so, JavaScript in Java 8 is a funny beast because the JavaScript library is on the Java extensions path. I heard they are going to change this in Java 9, fortunately. But for now, we have this annoying error in cases where the JavaScript extension in jre/lib/ext is either not present, or not available to the JVM for some reason. I guess in the case of MATLAB, it is the latter, since MATLAB interfaces with Java in its own special way.

For now, one way to work around the problem is to delete the jars/scripting-javascript-x.y.z.jar file from your ImageJ installation. This is fine as long as you do not need to run JavaScript scripts.

As for the first two lines about log4j, those are actually a separate error from the big stack trace about JavaScript. Does your ImageJ installation have jars/logback-classic-1.1.1.jar? That library is supposed to provide the special sauce that log4j needs here… but maybe there is some MATLAB-specific reason it doesn’t work…

1 Like