Page 1 of 1

Plugin runs in eclipse, fails in FIJI

PostPosted: Tue Oct 11, 2016 2:41 pm
by lando.wark
I've made an ImageJ plugin for use in automation macros that will upload an image to an OMERO server by scraping the filepath of the image.
I'm having an odd problem in that when I test the plugin using Eclipse, everything runs fine, image is uploaded and I can see it using the webclient. However, when I load the plugin in FIJI it fails out with the error posted below showing up in the console and the exception posted below that popping up.
I've managed to fix the console error by adding the Apache Commons Collections 3.2.2 jar to the FIJI jars folder, however the exception remains. I've tried adding the ini4j jar to FIJI jars and to the dependencies of the plugin itself, but it still remains.
Does anyone have any experience with this or suggestions for a fix?

omero.gateway.exception.DSOutOfServiceException: Cannot log in. User credentials not valid
at omero.gateway.Gateway.login(Gateway.java:1145)
at omero.gateway.Gateway.connect(Gateway.java:246)
at landon.IJ.IJ_Omero.run(IJ_Omero.java:56)
at ij.IJ.runUserPlugIn(IJ.java:217)
at ij.IJ.runPlugIn(IJ.java:181)
at ij.Executer.runCommand(Executer.java:137)
at ij.Executer.run(Executer.java:66)
at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.NoClassDefFoundError: org/apache/commons/collections/CollectionUtils
at omero.gateway.model.ExperimenterData.getDefaultGroup(ExperimenterData.java:261)
at omero.gateway.Gateway.login(Gateway.java:1134)
... 7 more
Caused by: java.lang.ClassNotFoundException: org.apache.commons.collections.CollectionUtils
at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
... 9 more
Could not load projectsomero.gateway.exception.DSOutOfServiceException: Null SecurityContext
at omero.gateway.Gateway.getConnector(Gateway.java:1439)
at omero.gateway.Gateway.getPojosService(Gateway.java:632)
at omero.gateway.facility.BrowseFacility.getProjects(BrowseFacility.java:497)
at omero.gateway.facility.BrowseFacility.getProjects(BrowseFacility.java:453)
at landon.IJ.IJ_Omero.run(IJ_Omero.java:72)
at ij.IJ.runUserPlugIn(IJ.java:217)
at ij.IJ.runPlugIn(IJ.java:181)
at ij.Executer.runCommand(Executer.java:137)
at ij.Executer.run(Executer.java:66)
at java.lang.Thread.run(Thread.java:745)
Could not load projectsomero.gateway.exception.DSOutOfServiceException: Null SecurityContext
at omero.gateway.Gateway.getConnector(Gateway.java:1439)
at omero.gateway.Gateway.getPojosService(Gateway.java:632)
at omero.gateway.facility.BrowseFacility.getProjects(BrowseFacility.java:497)
at omero.gateway.facility.BrowseFacility.getProjects(BrowseFacility.java:453)
at landon.IJ.IJ_Omero.run(IJ_Omero.java:72)
at ij.IJ.runUserPlugIn(IJ.java:217)
at ij.IJ.runPlugIn(IJ.java:181)
at ij.Executer.runCommand(Executer.java:137)
at ij.Executer.run(Executer.java:66)
at java.lang.Thread.run(Thread.java:745)
Exception in thread "Omero Import"

==========================================================================================
java.lang.NoClassDefFoundError: org/ini4j/IniFile
at ome.formats.importer.ImportConfig.<init>(ImportConfig.java:213)
at ome.formats.importer.ImportConfig.<init>(ImportConfig.java:199)
at landon.IJ.IJ_Omero.run(IJ_Omero.java:101)
at ij.IJ.runUserPlugIn(IJ.java:217)
at ij.IJ.runPlugIn(IJ.java:181)
at ij.Executer.runCommand(Executer.java:137)
at ij.Executer.run(Executer.java:66)
at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.ClassNotFoundException: org.ini4j.IniFile
at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
... 8 more

Re: Plugin runs in eclipse, fails in FIJI

PostPosted: Tue Oct 11, 2016 6:34 pm
by lando.wark
Okay, so the correct answer seems to be that an older version of the ini4j jar was needed for connecting to OMERO server. Placing ini4j-0.4.0.jar in the FIJI jars folder solved the problem and my plugin runs pretty smooth.
If anyone needs this answer the jar can be downloaded from:
http://repo2.maven.org/maven2/org/ini4j/ini4j/0.4.0/

Re: Plugin runs in eclipse, fails in FIJI

PostPosted: Fri Oct 14, 2016 3:29 pm
by bramalingam
Hi,

Thank you for sharing your issue.
Glad that you were able to solve the issue on your own.

Yes we can confirm that the ini4j jar is one of the dependencies that will is required when you are writing an upload script.

Please take a look at the example script in the following link,
viewtopic.php?f=6&t=7977#p16587

Specifically:
OMEROMetadataStoreClient store;
store = config.createStore();
store.logVersionInfo(config.getIniVersionNumber());

highlights the importance of the ini4j dependency.

A similar implementation was carried out in one of our partner projects, FLIMfit as well (Matlab tool for analysing FLIM images) and even there the ini4j is downloaded and added to the MATLAB class path as a dependency,
https://github.com/imperial-photonics/F ... ure.sh#L50

Hope that helps.

Best,
Balaji