[ome-devel] Sl4j classpath issues in deployed Matlab

Munro, Ian i.munro at imperial.ac.uk
Fri Mar 31 19:52:59 BST 2017


Thanks Curtis.
I just wondered if anyone had come across this while working on the BF Matlab plugin as it must be related somehow, although how
changing that can affect Cocoa I really can’t imagine.

Ian


On 31 Mar 2017, at 19:48, Curtis Rueden <ctrueden at wisc.edu<mailto:ctrueden at wisc.edu>> wrote:

Hi Ian,

Quick searches suggest that that error is some macOS Cocoa error message. I am guessing it is generated by MATLAB itself. I doubt there is anything you can do about it, although perhaps the old "binary code search" trick might help you isolate what triggers it. That is: comment out half your code, such that the remaining half still runs. Run it. See if the error happens. If the error happens, command another half of the remaining code. Or if it doesn't occur, uncomment half of the commented code. Ideally, this process can eventually whittle down the commented code to a single line. You can then investigate whether there is an alternative approach to that line of code, which avoids triggering the issue.

You could also write a support ticket to Mathworks, although of course you should still create a MCVE to send to them. So you'll want to narrow down the problem regardless.

Regards,
Curtis

--
Curtis Rueden
LOCI software architect - https://loci.wisc.edu/software
ImageJ2 lead, Fiji maintainer - https://imagej.net/User:Rueden
Did you know ImageJ has a forum? http://forum.imagej.net/


On Fri, Mar 31, 2017 at 1:25 PM, Munro, Ian <i.munro at imperial.ac.uk<mailto:i.munro at imperial.ac.uk>> wrote:
Evening all

So Curtis’ suggested solution, which is to remove the sl4j bindings from bioformats-package.jar as follows:

zip -d bfmatlab/bioformats_package.jar 'org/slf4j/impl/*’

seems to work. Thanks Curtis.

However I now get:
"2017-03-31 19:15:14.579 FLIMfit[29709:165086] Failed to connect (typePopUp) outlet from (NSViewController) to (NSPopUpButton): missing setter or instance variable”
with the deployed version only.

Does anyone have any idea how messing with bio-formats_package could generate that or has anyone even seen anything similar?

Thanks

Ian


On 31 Mar 2017, at 15:30, Munro, Ian <i.munro at imperial.ac.uk<mailto:i.munro at imperial.ac.uk>> wrote:

Thanks Curtis

Ian


On 31 Mar 2017, at 15:28, Curtis Rueden <ctrueden at wisc.edu<mailto:ctrueden at wisc.edu>> wrote:

Hi Ian,

> Is there any other component, or combination of components that I can
> try ?

Two possibilities come to mind:

1) Use the Bio-Formats JARs piecemeal, excluding the logback-common dependency from your dependency hierarchy. You can lean on Maven to resolve your dependencies.

2) Massage the bioformats_package/loci_tools archive to stop shipping any SLF4J bindings.

I filed PR #300 which pursues option (2); maybe it helps you.
https://github.com/flimfit/FLIMfit/pull/300

In the longer term, I encourage the Bio-Formats team to purge the logback-classic dependency. It should be bundled only with the command line tools.

Regards,
Curtis

--
Curtis Rueden
LOCI software architect - https://loci.wisc.edu/software
ImageJ2 lead, Fiji maintainer - https://imagej.net/User:Rueden
Did you know ImageJ has a forum? http://forum.imagej.net/


On Fri, Mar 31, 2017 at 8:41 AM, Munro, Ian <i.munro at imperial.ac.uk<mailto:i.munro at imperial.ac.uk>> wrote:
Hi Again

Is there any other component, or combination of components that I can try ?

Thanks

Ian


On 31 Mar 2017, at 10:29, Munro, Ian <i.munro at imperial.ac.uk<mailto:i.munro at imperial.ac.uk>> wrote:

Hi Sebastien

Unfortunately replacing bioformats_package.jar with loci_tools.jar has simply replaced the previous warning
with :

SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/Applications/MATLAB/MATLAB_Runtime/v91/java/jarext/slf4j/slf4j-log4j12.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/Users/imunro/Library/Application%20Support/.mcrCache9.1/FLIMfi0/BFMatlab/loci_tools.jar!/org/slf4j/impl/StaticLoggerBinder.class]


Best,

Ian

On 30 Mar 2017, at 14:40, Munro, Ian <i.munro at imperial.ac.uk<mailto:i.munro at imperial.ac.uk>> wrote:

Thanks Sebastien

I’ll give that a try and let you know.

Ian


On 30 Mar 2017, at 14:32, Sebastien Besson (Staff) <s.besson at dundee.ac.uk<mailto:s.besson at dundee.ac.uk>> wrote:

Hi Ian,

I think Curtis summarised the nature of the warning which should be harmless albeit
annoying. For reference, OME was historically using log4j and switched to logback
as the default logging implementation a few years ago [1].

Moving towards individual JARs as Curtis suggests might be the best way to enable full
control of the dependencies and prevent conflict in an environment like MATLAB.

In the short term, a third alternative might be to use the loci_tools.jar rather than
bioformats_package.jar. The only difference between both bundle JARs is effectively the
logging implementation shipped (log4j vs logback).

Best,
Sebastien

[1] https://github.com/openmicroscopy/bioformats/pull/889/

On 30 Mar 2017, at 13:49, Munro, Ian <i.munro at imperial.ac.uk<mailto:i.munro at imperial.ac.uk>> wrote:

Thanks Curtis

Sounds like 2) would be the way to go then.

Ian


On 30 Mar 2017, at 13:30, Curtis Rueden <ctrueden at wisc.edu<mailto:ctrueden at wisc.edu>> wrote:

Hi Ian,

> SLF4J: Class path contains multiple SLF4J bindings.

Maybe the docs about that are helpful?
https://www.slf4j.org/codes.html#multiple_bindings

> if anyone has any thoughts on a work-around that would be great.

The error message suggests that MATLAB now ships its own SLF4J binding. This makes sense, since best practice is for apps (like MATLAB and Fiji) to choose and ship a binding, rather than for libraries to mandate one. Otherwise, this situation can happen. Bio-Formats embeds an SLF4J binding into the bioformats_package.jar via its dependency on logback-classic. (Specifically: metakit and ome-common and bio-formats_plugins and bio-formats_tools all depend on it.)

Fiji's strategy is to ship logback-classic as its chosen SLF4J binding; fortunately, Fiji bundles no other libraries with conflicting bindings. But since MATLAB now ships its own, a different solution is needed. There are a couple of possibilities:

1) Change Bio-Formats to no longer depend on any JARs which include an SLF4J binding. This would be a desirable change in general.

2) Change FLIMfit to stop using bioformats_package in favor of the individual Bio-Formats JARs, and exclude the logback-classic dependency from its dependency hierarchy.

Regards,
Curtis

--
Curtis Rueden
LOCI software architect - https://loci.wisc.edu/software
ImageJ2 lead, Fiji maintainer - https://imagej.net/User:Rueden
Did you know ImageJ has a forum? http://forum.imagej.net/


On Thu, Mar 30, 2017 at 5:34 AM, Munro, Ian <i.munro at imperial.ac.uk<mailto:i.munro at imperial.ac.uk>> wrote:
Good afternoon

I wondered if anyone has any thoughts on an issue we’re currently having.
The next release of our FLIMfit application is nearly ready for release.
However when running the deployed version we get a warning:

SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/Applications/MATLAB/MATLAB_Runtime/v91/java/jarext/slf4j/slf4j-log4j12.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/Users/imunro/Library/Application%20Support/.mcrCache9.1/FLIMfi0/BFMatlab/bioformats_package.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.

see also https://github.com/flimfit/FLIMfit/issues/299

Thiis seems to be a warning only but if anyone has any thoughts on a work-around that would be great.
NB this arose with the recent move to Matlab 2016b.

Many Thanks

Ian


_______________________________________________
ome-devel mailing list
ome-devel at lists.openmicroscopy.org.uk<mailto:ome-devel at lists.openmicroscopy.org.uk>
http://lists.openmicroscopy.org.uk/mailman/listinfo/ome-devel

_______________________________________________
ome-devel mailing list
ome-devel at lists.openmicroscopy.org.uk<mailto:ome-devel at lists.openmicroscopy.org.uk>
http://lists.openmicroscopy.org.uk/mailman/listinfo/ome-devel

_______________________________________________
ome-devel mailing list
ome-devel at lists.openmicroscopy.org.uk<mailto:ome-devel at lists.openmicroscopy.org.uk>
http://lists.openmicroscopy.org.uk/mailman/listinfo/ome-devel


The University of Dundee is a registered Scottish Charity, No: SC015096
_______________________________________________
ome-devel mailing list
ome-devel at lists.openmicroscopy.org.uk<mailto:ome-devel at lists.openmicroscopy.org.uk>
http://lists.openmicroscopy.org.uk/mailman/listinfo/ome-devel

_______________________________________________
ome-devel mailing list
ome-devel at lists.openmicroscopy.org.uk<mailto:ome-devel at lists.openmicroscopy.org.uk>
http://lists.openmicroscopy.org.uk/mailman/listinfo/ome-devel



_______________________________________________
ome-devel mailing list
ome-devel at lists.openmicroscopy.org.uk<mailto:ome-devel at lists.openmicroscopy.org.uk>
http://lists.openmicroscopy.org.uk/mailman/listinfo/ome-devel


_______________________________________________
ome-devel mailing list
ome-devel at lists.openmicroscopy.org.uk<mailto:ome-devel at lists.openmicroscopy.org.uk>
http://lists.openmicroscopy.org.uk/mailman/listinfo/ome-devel

_______________________________________________
ome-devel mailing list
ome-devel at lists.openmicroscopy.org.uk<mailto:ome-devel at lists.openmicroscopy.org.uk>
http://lists.openmicroscopy.org.uk/mailman/listinfo/ome-devel


_______________________________________________
ome-devel mailing list
ome-devel at lists.openmicroscopy.org.uk<mailto:ome-devel at lists.openmicroscopy.org.uk>
http://lists.openmicroscopy.org.uk/mailman/listinfo/ome-devel


_______________________________________________
ome-devel mailing list
ome-devel at lists.openmicroscopy.org.uk<mailto:ome-devel at lists.openmicroscopy.org.uk>
http://lists.openmicroscopy.org.uk/mailman/listinfo/ome-devel

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openmicroscopy.org.uk/pipermail/ome-devel/attachments/20170331/4f8fa568/attachment.html>


More information about the ome-devel mailing list