When I get the DataSourceException exception at ImageMosaicReader.initReaderFromURL(ImageMosaicReader.java:232) it usually means that I have to debug into method Utils#checkSource(Object, Hints) and figure out what the actual problem is. Method Utils#checkSource(Object, Hints) simply returns null if anything goes wrong and doesn’t log any clues about what happened.
>>> Original Message:
I am having problems with creating mosaics and pyramids on a new server setup (Ubuntu 12.4). On my local computer everything works fine, so the cause is probably some sort of server misconfiguration, but after searching for 3 days I still have not been able to find the cause...
When trying to add a new mosaic-store with geoserver there comes the error "Could not list layers for this store, an error occurred retrieving them: Unable to acquire a reader for this coverage with
format: ImageMosaic". The cause is that geotools seems to be unable to create the .properties file for the mosaic. All other files (.dbf, .fix, .prj, .qix, .shp, .shx and sample_image) are being created though. When creating and filling the .properties file by hand I can afterwards add the store to geoserver, but no matter what I tried I cannot make imagemosaic create the file. I tried setting the permissions of the folder to 777 (I don't think it's a matter of permissions as all other files can be written) and I also tried several Tomcat (latest Tomcat 6 and 7), Java (latest Java6 and Java7) and geoserver (2.1.3 and 2.1.4) versions but all in vain. I know that probably nobody will be able to reproduce that error (even I cannot reproduce it on my local computer) but any idea what might cause this error is highly appreciated.
I attached the relevant output of geoserver.log below. It begins at the very line where on my local computer comes the output "[imagemosaic.catalogbuilder] - Creating final properties file".
One thing that sometimes happens to me is that not all image formats are loaded. Method javax.imageio.ImageIO.scanForPlugins() achieves that, I call it for testing while GeoServer is stopped at a breakpoint. In some cases I have been able to fix the issue by installing JAI and ImageIO again into the JDK. Where the ImageReaders are queried depends on the store’s format, for ImagerMosaic it happens in the call to javax.imageio.ImageIO.getImageReaders(Object) within org.geotools.gce.imagemosaic.catalogbuilder.CatalogBuilder.CatalogBuilderDirectoryWalker.handleFile(File, int, Collection).
I'd like to say a big thank you to everyone who replied and
especially to Felix. Debugging the checkSource-Method finally
revealed the source of the problem. The error had nothing to do
with the .properties file itself, it occured one step earlier,
when writing the sample_image. But as there is no proper
Errorhandler in the code, the function for creating the properties
was never executed, because it comes right after the creation of
the sample image. What actually caused the error was a problem
with the hostname, similar to:
After fixing the hostname everything works fine.
Am 9/6/12 7:10 PM, schrieb Felix Mayer:
When I get the DataSourceException exception at ImageMosaicReader.initReaderFromURL(ImageMosaicReader.java:232) it usually means that I have to debug into method Utils#checkSource(Object, Hints) and figure out what the actual problem is. Method Utils#checkSource(Object, Hints) simply returns null if anything goes wrong and doesn't log any clues about what happened.