Hey, I've just realised I've probably got JAI installed on my system as normal, but I've also got it in my POM. Could that cause this problem?
Thanks, Jon Simone Giannecchini wrote: > > Ciao Jon, > this error happens sometimes in eclispe when you mess up the jai > installation and the geotools jai registration file get loaded > multiple times. > Can you give me a bit of more information on what you are doing do > that I can help out (also with the geotiff thing :-)). > > Simone. > ------------------------------------------------------- > Ing. Simone Giannecchini > GeoSolutions S.A.S. > Owner - Software Engineer > Via Carignoni 51 > 55041 Camaiore (LU) > Italy > > phone: +39 0584983027 > fax: +39 0584983027 > mob: +39 333 8128928 > > > http://www.geo-solutions.it > http://simboss.blogspot.com/ > http://www.linkedin.com/in/simonegiannecchini > > ------------------------------------------------------- > > > > On Fri, Jun 26, 2009 at 12:06 PM, Jon Britton<jbrit...@glam.ac.uk> wrote: >> >> Hi, >> >> I was trying this: >> >> reader = new GeoTiffReader(this.getInputStream()); >> GridCoverage2D image = (GridCoverage2D)reader.read(null); >> >> However, I get a number of exceptions: >> >> Error while parsing JAI registry file >> "/D:/geotools/2.5.x/modules/library/coverage/target/classes/META-INF/registryFile.jai" >> : >> Error in registry file at line number #31 >> A descriptor is already registered against the name >> "org.geotools.Combine" >> under registry mode "rendered" >> Error in registry file at line number #32 >> A descriptor is already registered against the name >> "org.geotools.Hysteresis" under registry mode "rendered" >> Error in registry file at line number #33 >> A descriptor is already registered against the name >> "org.geotools.NodataFilter" under registry mode "rendered" >> Error: One factory fails for the operation "ImageRead" >> Occurs in: javax.media.jai.ThreadSafeOperationRegistry >> java.lang.reflect.InvocationTargetException >> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) >> at >> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) >> at >> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) >> at java.lang.reflect.Method.invoke(Method.java:585) >> at javax.media.jai.FactoryCache.invoke(FactoryCache.java:122) >> at >> javax.media.jai.OperationRegistry.invokeFactory(OperationRegistry.java:1674) >> at >> javax.media.jai.ThreadSafeOperationRegistry.invokeFactory(ThreadSafeOperationRegistry.java:473) >> at >> javax.media.jai.registry.RIFRegistry.create(RIFRegistry.java:332) >> at javax.media.jai.RenderedOp.createInstance(RenderedOp.java:819) >> at javax.media.jai.RenderedOp.createRendering(RenderedOp.java:867) >> at javax.media.jai.RenderedOp.getWidth(RenderedOp.java:2179) >> at >> org.geotools.gce.geotiff.GeoTiffReader.read(GeoTiffReader.java:461) >> at >> org.geotools.data.wcs.response.GetCoverageResponse.getCoverage(GetCoverageResponse.java:46) >> at uk.ac.glam.jbritton.test.WCSTest.main(WCSTest.java:90) >> Caused by: java.lang.RuntimeException: javax.imageio.IIOException: I/O >> error >> reading image metadata! >> at >> com.sun.media.jai.imageioimpl.ImageReadCRIF.create(ImageReadCRIF.java:317) >> ... 14 more >> Caused by: javax.imageio.IIOException: I/O error reading image metadata! >> at >> com.sun.media.imageioimpl.plugins.tiff.TIFFImageReader.readMetadata(TIFFImageReader.java:340) >> at >> com.sun.media.imageioimpl.plugins.tiff.TIFFImageReader.seekToImage(TIFFImageReader.java:310) >> at >> com.sun.media.imageioimpl.plugins.tiff.TIFFImageReader.getImageTypes(TIFFImageReader.java:741) >> at javax.imageio.ImageReader.getRawImageType(ImageReader.java:665) >> at >> com.sun.media.jai.imageioimpl.ImageReadOpImage.layoutHelper(ImageReadOpImage.java:228) >> at >> com.sun.media.jai.imageioimpl.ImageReadOpImage.<init>(ImageReadOpImage.java:473) >> at >> com.sun.media.jai.imageioimpl.ImageReadCRIF.create(ImageReadCRIF.java:309) >> ... 14 more >> Caused by: java.io.EOFException >> at >> javax.imageio.stream.ImageInputStreamImpl.readShort(ImageInputStreamImpl.java:211) >> at >> javax.imageio.stream.ImageInputStreamImpl.readUnsignedShort(ImageInputStreamImpl.java:222) >> at >> com.sun.media.imageioimpl.plugins.tiff.TIFFIFD.initialize(TIFFIFD.java:194) >> at >> com.sun.media.imageioimpl.plugins.tiff.TIFFImageMetadata.initializeFromStream(TIFFImageMetadata.java:110) >> at >> com.sun.media.imageioimpl.plugins.tiff.TIFFImageReader.readMetadata(TIFFImageReader.java:336) >> ... 20 more >> Exception in thread "main" javax.media.jai.util.ImagingException: All >> factories fail for the operation "ImageRead" >> at >> javax.media.jai.OperationRegistry.invokeFactory(OperationRegistry.java:1687) >> at >> javax.media.jai.ThreadSafeOperationRegistry.invokeFactory(ThreadSafeOperationRegistry.java:473) >> at >> javax.media.jai.registry.RIFRegistry.create(RIFRegistry.java:332) >> at javax.media.jai.RenderedOp.createInstance(RenderedOp.java:819) >> at javax.media.jai.RenderedOp.createRendering(RenderedOp.java:867) >> at javax.media.jai.RenderedOp.getWidth(RenderedOp.java:2179) >> at >> org.geotools.gce.geotiff.GeoTiffReader.read(GeoTiffReader.java:461) >> at >> org.geotools.data.wcs.response.GetCoverageResponse.getCoverage(GetCoverageResponse.java:46) >> at uk.ac.glam.jbritton.test.WCSTest.main(WCSTest.java:90) >> Caused by: java.lang.reflect.InvocationTargetException >> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) >> at >> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) >> at >> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) >> at java.lang.reflect.Method.invoke(Method.java:585) >> at javax.media.jai.FactoryCache.invoke(FactoryCache.java:122) >> at >> javax.media.jai.OperationRegistry.invokeFactory(OperationRegistry.java:1674) >> ... 8 more >> Caused by: java.lang.RuntimeException: javax.imageio.IIOException: I/O >> error >> reading image metadata! >> at >> com.sun.media.jai.imageioimpl.ImageReadCRIF.create(ImageReadCRIF.java:317) >> ... 14 more >> Caused by: javax.imageio.IIOException: I/O error reading image metadata! >> at >> com.sun.media.imageioimpl.plugins.tiff.TIFFImageReader.readMetadata(TIFFImageReader.java:340) >> at >> com.sun.media.imageioimpl.plugins.tiff.TIFFImageReader.seekToImage(TIFFImageReader.java:310) >> at >> com.sun.media.imageioimpl.plugins.tiff.TIFFImageReader.getImageTypes(TIFFImageReader.java:741) >> at javax.imageio.ImageReader.getRawImageType(ImageReader.java:665) >> at >> com.sun.media.jai.imageioimpl.ImageReadOpImage.layoutHelper(ImageReadOpImage.java:228) >> at >> com.sun.media.jai.imageioimpl.ImageReadOpImage.<init>(ImageReadOpImage.java:473) >> at >> com.sun.media.jai.imageioimpl.ImageReadCRIF.create(ImageReadCRIF.java:309) >> ... 14 more >> Caused by: java.io.EOFException >> at >> javax.imageio.stream.ImageInputStreamImpl.readShort(ImageInputStreamImpl.java:211) >> at >> javax.imageio.stream.ImageInputStreamImpl.readUnsignedShort(ImageInputStreamImpl.java:222) >> at >> com.sun.media.imageioimpl.plugins.tiff.TIFFIFD.initialize(TIFFIFD.java:194) >> at >> com.sun.media.imageioimpl.plugins.tiff.TIFFImageMetadata.initializeFromStream(TIFFImageMetadata.java:110) >> at >> com.sun.media.imageioimpl.plugins.tiff.TIFFImageReader.readMetadata(TIFFImageReader.java:336) >> ... 20 more >> Caused by: >> java.lang.reflect.InvocationTargetException >> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) >> at >> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) >> at >> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) >> at java.lang.reflect.Method.invoke(Method.java:585) >> at javax.media.jai.FactoryCache.invoke(FactoryCache.java:122) >> at >> javax.media.jai.OperationRegistry.invokeFactory(OperationRegistry.java:1674) >> at >> javax.media.jai.ThreadSafeOperationRegistry.invokeFactory(ThreadSafeOperationRegistry.java:473) >> at >> javax.media.jai.registry.RIFRegistry.create(RIFRegistry.java:332) >> at javax.media.jai.RenderedOp.createInstance(RenderedOp.java:819) >> at javax.media.jai.RenderedOp.createRendering(RenderedOp.java:867) >> at javax.media.jai.RenderedOp.getWidth(RenderedOp.java:2179) >> at >> org.geotools.gce.geotiff.GeoTiffReader.read(GeoTiffReader.java:461) >> at >> org.geotools.data.wcs.response.GetCoverageResponse.getCoverage(GetCoverageResponse.java:46) >> at uk.ac.glam.jbritton.test.WCSTest.main(WCSTest.java:90) >> Caused by: java.lang.RuntimeException: javax.imageio.IIOException: I/O >> error >> reading image metadata! >> at >> com.sun.media.jai.imageioimpl.ImageReadCRIF.create(ImageReadCRIF.java:317) >> ... 14 more >> Caused by: javax.imageio.IIOException: I/O error reading image metadata! >> at >> com.sun.media.imageioimpl.plugins.tiff.TIFFImageReader.readMetadata(TIFFImageReader.java:340) >> at >> com.sun.media.imageioimpl.plugins.tiff.TIFFImageReader.seekToImage(TIFFImageReader.java:310) >> at >> com.sun.media.imageioimpl.plugins.tiff.TIFFImageReader.getImageTypes(TIFFImageReader.java:741) >> at javax.imageio.ImageReader.getRawImageType(ImageReader.java:665) >> at >> com.sun.media.jai.imageioimpl.ImageReadOpImage.layoutHelper(ImageReadOpImage.java:228) >> at >> com.sun.media.jai.imageioimpl.ImageReadOpImage.<init>(ImageReadOpImage.java:473) >> at >> com.sun.media.jai.imageioimpl.ImageReadCRIF.create(ImageReadCRIF.java:309) >> ... 14 more >> Caused by: java.io.EOFException >> at >> javax.imageio.stream.ImageInputStreamImpl.readShort(ImageInputStreamImpl.java:211) >> at >> javax.imageio.stream.ImageInputStreamImpl.readUnsignedShort(ImageInputStreamImpl.java:222) >> at >> com.sun.media.imageioimpl.plugins.tiff.TIFFIFD.initialize(TIFFIFD.java:194) >> at >> com.sun.media.imageioimpl.plugins.tiff.TIFFImageMetadata.initializeFromStream(TIFFImageMetadata.java:110) >> at >> com.sun.media.imageioimpl.plugins.tiff.TIFFImageReader.readMetadata(TIFFImageReader.java:336) >> ... 20 more >> >> >> >> Gabriel Roldan wrote: >>> >>> By looking at the code it seems you can just do: >>> InputStream in = ... >>> GeotiffReader reader = new GeotiffReader(in); >>> RenderedImage image = >>> ((GridCoverage2D)reader.read(null)).view(ViewType.GEOPHYSICS); >>> >>> cheers, >>> Gabriel >>> >>>> Hi, >>>> >>>> I've got a working(ish) WCS client, now I'm wondering if it's possible >>>> to >>>> load a GridCoverage2D directly from the InputStream I get as a response >>>> to a >>>> GetCoverage request? Just GeoTIFF would do fine for now, but I can >>>> only >>>> find how to load one from a file, not directly from an InputStream. >>>> >>>> Thanks, >>>> >>>> Jon >>> >>> >>> -- >>> Gabriel Roldan >>> OpenGeo - http://opengeo.org >>> Expert service straight from the developers. >>> >>> ------------------------------------------------------------------------------ >>> Crystal Reports - New Free Runtime and 30 Day Trial >>> Check out the new simplified licensing option that enables unlimited >>> royalty-free distribution of the report engine for externally facing >>> server and web deployment. >>> http://p.sf.net/sfu/businessobjects >>> _______________________________________________ >>> Geotools-gt2-users mailing list >>> Geotools-gt2-users@lists.sourceforge.net >>> https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users >>> >>> >> >> -- >> View this message in context: >> http://n2.nabble.com/Reading-a-GeoTiff-from-an-InputStream--tp3093431p3160693.html >> Sent from the geotools-gt2-users mailing list archive at Nabble.com. >> >> >> ------------------------------------------------------------------------------ >> _______________________________________________ >> Geotools-gt2-users mailing list >> Geotools-gt2-users@lists.sourceforge.net >> https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users >> > > ------------------------------------------------------------------------------ > _______________________________________________ > Geotools-gt2-users mailing list > Geotools-gt2-users@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users > > -- View this message in context: http://n2.nabble.com/Reading-a-GeoTiff-from-an-InputStream--tp3093431p3162136.html Sent from the geotools-gt2-users mailing list archive at Nabble.com. ------------------------------------------------------------------------------ _______________________________________________ Geotools-gt2-users mailing list Geotools-gt2-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users