We're Hiring!

java 7 watch service to auto upload

General and open developer discussion about using OMERO APIs from C++, Java, Python, Matlab and more! Please new questions at https://forum.image.sc/tags/omero
Please note:
Historical discussions about OMERO. Please look for and ask new questions at https://forum.image.sc/tags/omero

If you are having trouble with custom code, please provide a link to a public repository, ideally GitHub.

java 7 watch service to auto upload

Postby ebbwdan » Thu Jul 04, 2013 11:28 pm

Hi!

I am trying to use Java 7's watch service as a way of monitoring directories for changes and when new images are placed in a directory I am trying to get it to connect to an Omero server and trigger the image upload. I can sort of get it to work and have based the server connection and upload on this example:

https://gist.github.com/chris-allan/1710116

The connection is made, the watcher detects the file and starts the upload but it never completes and I don't get an error message. Can anybody help with this please?

The code is here:

https://gist.github.com/ebbwdan/5930739

Many, many thanks in advance!

Dan.
Attachments
omero_connect.png
omero_connect.png (22.14 KiB) Viewed 2796 times
ebbwdan
 
Posts: 61
Joined: Wed Aug 29, 2012 4:46 am

Re: java 7 watch service to auto upload

Postby cblackburn » Fri Jul 05, 2013 1:07 pm

Hi Dan,

Thanks for pointing us to your code. I was able to get your program up and running and use it to successfully import a zvi file and a tif. The only problem I had was that your client lost connection after an upload and so I had to stop and connect again, but that isn't the problem you are seeing here. I assume you have tried it with good images that would otherwise import okay via Insight or the CLI importer?

To try to help you further could you provide me with the full log of a run of your code from starting up to an import failing? If you can paste it is as text rather than as a png of the output window that would be very useful. Thanks!

Cheers,

Colin
cblackburn
 
Posts: 85
Joined: Mon May 25, 2009 9:03 pm

Re: java 7 watch service to auto upload

Postby ebbwdan » Mon Jul 08, 2013 2:42 am

Hi Colin,

Thank you very much for taking a look at this for me! And so quickly too! As you've probably guessed I'm a bit of a Java novice so I'm having difficultly trouble-shooting this by myself.

Here is the output I get when I attempt the upload:

Code: Select all
Connect pressed
2013-07-08 12:38:12,803 0          [entQueue-0] INFO          ome.formats.importer.ImportConfig  - OMERO Version: 4.4.5-ice34-b20

2013-07-08 12:38:12,813 10         [entQueue-0] INFO          ome.formats.importer.ImportConfig  - Bioformats version: 4.4.5 revision: 03770c0 date: 19 November 2012

2013-07-08 12:38:12,829 26         [1-thread-1] DEBUG         ome.formats.importer.ImportConfig  - Loaded savedDirectory from ome.formats.importer.util.IniFileLoader@6b8e2779

2013-07-08 12:38:12,830 27         [1-thread-1] DEBUG         ome.formats.importer.ImportConfig  - Loaded savedDirectory from default

2013-07-08 12:38:12,858 55         [1-thread-1] ERROR                   ome.system.UpgradeCheck  - Error reading from url: http://upgrade.openmicroscopy.org.uk?version=4.4.5-ice34-b20;os.name=Mac+OS+X;os.arch=x86_64;os.version=10.7.3;java.runtime.version=1.7.0_07-b10;java.vm.vendor=Oracle+Corporation "Server returned HTTP response code: 400 for URL: http://upgrade.openmicroscopy.org.uk?version=4.4.5-ice34-b20;os.name=Mac+OS+X;os.arch=x86_64;os.version=10.7.3;java.runtime.version=1.7.0_07-b10;java.vm.vendor=Oracle+Corporation"

2013-07-08 12:38:12,945 142        [1-thread-1] INFO       ome.formats.OMEROMetadataStoreClient  - Attempting initial SSL connection to localhost:4064

2013-07-08 12:38:14,338 1535       [1-thread-1] INFO       ome.formats.OMEROMetadataStoreClient  - Server: 4.4.8

2013-07-08 12:38:14,338 1535       [1-thread-1] INFO       ome.formats.OMEROMetadataStoreClient  - Client: 4.4.5-ice34-b20

2013-07-08 12:38:14,338 1535       [1-thread-1] INFO       ome.formats.OMEROMetadataStoreClient  - Java Version: 1.7.0_07

2013-07-08 12:38:14,339 1536       [1-thread-1] INFO       ome.formats.OMEROMetadataStoreClient  - OS Name: Mac OS X

2013-07-08 12:38:14,339 1536       [1-thread-1] INFO       ome.formats.OMEROMetadataStoreClient  - OS Arch: x86_64

2013-07-08 12:38:14,339 1536       [1-thread-1] INFO       ome.formats.OMEROMetadataStoreClient  - OS Version: 10.7.3

Scanning /Users/uqdmatt2/Documents/Programming/Java/Omero/another_test ...
Done.
tif
New file 'omero_test.tif' detected.
2013-07-08 12:38:24,426 11623      [1-thread-1] INFO       ome.formats.OMEROMetadataStoreClient  - Server: 4.4.8

2013-07-08 12:38:24,426 11623      [1-thread-1] INFO       ome.formats.OMEROMetadataStoreClient  - Client: 4.4.5-ice34-b20

2013-07-08 12:38:24,426 11623      [1-thread-1] INFO       ome.formats.OMEROMetadataStoreClient  - Java Version: 1.7.0_07

2013-07-08 12:38:24,426 11623      [1-thread-1] INFO       ome.formats.OMEROMetadataStoreClient  - OS Name: Mac OS X

2013-07-08 12:38:24,426 11623      [1-thread-1] INFO       ome.formats.OMEROMetadataStoreClient  - OS Arch: x86_64

2013-07-08 12:38:24,426 11623      [1-thread-1] INFO       ome.formats.OMEROMetadataStoreClient  - OS Version: 10.7.3

2013-07-08 12:38:24,700 11897      [1-thread-1] ERROR                    loci.formats.ClassList  - "loci.formats.in.HamamatsuVMSReader" is not valid.

2013-07-08 12:38:24,702 11899      [1-thread-1] ERROR                    loci.formats.ClassList  - "loci.formats.in.CellSensReader" is not valid.

2013-07-08 12:38:24,711 11908      [1-thread-1] ERROR                    loci.formats.ClassList  - "loci.formats.in.ZeissCZIReader" is not valid.

2013-07-08 12:38:24,809 12006      [1-thread-1] ERROR                    loci.formats.ClassList  - "loci.formats.in.NDPIReader" is not valid.

2013-07-08 12:38:24,819 12016      [1-thread-1] ERROR                    loci.formats.ClassList  - "loci.formats.in.MIASReader" is not valid.

2013-07-08 12:38:24,978 12175      [1-thread-1] DEBUG        ome.formats.importer.ImportLibrary  - FS lite enabled readers: [loci.formats.in.TiffDelegateReader, loci.formats.in.APNGReader, loci.formats.in.SVSReader, loci.formats.in.LeicaSCNReader, loci.formats.in.JPEGReader, loci.formats.in.JPEG2000Reader]

2013-07-08 12:38:24,978 12175      [1-thread-1] DEBUG        ome.formats.importer.ImportLibrary  - Maximum plane width: 3192

2013-07-08 12:38:24,978 12175      [1-thread-1] DEBUG        ome.formats.importer.ImportLibrary  - Maximum plane height: 3192

2013-07-08 12:38:25,012 12209      [1-thread-1] INFO      ome.formats.importer.ImportCandidates  - Depth: 4 Metadata Level: MINIMUM

2013-07-08 12:38:25,013 12210      [1-thread-1] DEBUG     ome.formats.importer.cli.ErrorHandler  - SCANNING: Depth:0 Num:    1 Tot:  n/a File: t/omero_test.tif

2013-07-08 12:38:25,127 12324      [1-thread-1] DEBUG      ome.formats.OMEROMetadataStoreClient  - closing client session.

2013-07-08 12:38:25,145 12342      [1-thread-1] DEBUG      ome.formats.OMEROMetadataStoreClient  - client closed.

2013-07-08 12:38:25,145 12342      [1-thread-1] DEBUG      ome.formats.OMEROMetadataStoreClient  - Logout called, shutting keep alive down.

2013-07-08 12:38:25,146 12343      [1-thread-1] DEBUG      ome.formats.OMEROMetadataStoreClient  - keepalive shut down.


There are a few errors in there:

One related to checking for upgrades and a few from loci.formats related to invalid formats but I don't think this is causing my problem. I've tried with tif's and zvi's where I tested opening them in ImageJ first and then importing them to my VM Omero server using the client. All worked fine.

EDIT: Also, our IT manager has just pointed out to me that I should give you all the details! I was writing and testing the code on Mac OS X 10.7 (with HFS+ filesystem). Having read your message I then tested on Windows machine and hey presto! it worked. Would be great to work out why it doesn't on Mac OS.

Many thanks again for taking the time to look at this for me!

Cheers,

Dan.
ebbwdan
 
Posts: 61
Joined: Wed Aug 29, 2012 4:46 am

Re: java 7 watch service to auto upload

Postby cblackburn » Tue Jul 09, 2013 3:21 pm

Hi Dan,

Thanks for the extra information, I'll look into this a little further. I noticed from your logs that the client you have built on Mac OS uses 4.4.5 Did you use the same version of the client libraries on Windows? My Mac OS 10.8 build was using 4.4.8 client libraries so I wondered if it would be possible for you to double check by building against the latest libraries?

Cheers,

Colin
cblackburn
 
Posts: 85
Joined: Mon May 25, 2009 9:03 pm


Return to Developer Discussion

Who is online

Users browsing this forum: Google [Bot] and 1 guest