<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <meta content="text/html; charset=ISO-8859-1"
      http-equiv="Content-Type">
    <title></title>
  </head>
  <body text="#000000" bgcolor="#ffffff">
    Hello<br>
    <br>
    I agree It's a problem.<br>
    ImageIO do not use the usual meta-inf/service configuration for
    discovery of new readers. It uses somekind of predecessor.<br>
    <br>
    Here is what I use in Puzzle-GIS for the geotoolkit module (In the
    installer class):<br>
    //force netbeans platform classloader to load image readers.<br>
    Registry.setDefaultCodecPreferences();<br>
    WorldFileImageReader.Spi.registerDefaults(null);<br>
    WorldFileImageWriter.Spi.registerDefaults(null);<br>
    ImageIO.scanForPlugins();<br>
    <br>
    Hints.putSystemDefault(Hints.LENIENT_DATUM_SHIFT, Boolean.TRUE);<br>
    <br>
    //force netbeans platform classloader to load the derby and postgres
    driver<br>
    //often use for EPSG databases<br>
    try {<br>
    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
    Class.forName("org.apache.derby.jdbc.EmbeddedDriver").newInstance();<br>
    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Class.forName("org.postgresql.Driver").newInstance();<br>
    } catch (Exception ex) {<br>
    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Exceptions.printStackTrace(ex);<br>
    }<br>
    <br>
    <br>
    And when I have additional module with image reader/writer I have :<br>
    ImageIO.scanForPlugins();<br>
    GeoTiffImageReader.Spi.registerDefaults(null);<br>
    DimapImageReader.Spi.registerDefaults(null);<br>
    <br>
    <br>
    Perhaps Martin Desruisseaux will give more details on this behavior.<br>
    <br>
    <br>
    johann<br>
    <br>
    <br>
    <br>
    On 11/07/2011 08:48, Thys Meintjes wrote:
    <blockquote
cite="mid:CAHRf99koOEKSoWheGfbnRP9ZrDVJxUO9QU0TEYgiGizr5jhq9A@mail.gmail.com"
      type="cite">Hi &nbsp;All,
      <div><br>
      </div>
      <div>I'm writing a Netbeans RCP based app and had a bad time
        loading GeoTIFF's. After trolling through the mailing list,
        especially</div>
      <div>this thread:&nbsp;<a moz-do-not-send="true"
href="http://lists.osgeo.org/pipermail/geotoolkit/2011-January/000466.html">http://lists.osgeo.org/pipermail/geotoolkit/2011-January/000466.html</a>,
        I fixed the problem by explicitly registering&nbsp;</div>
      <div>the TIFF readers as follows:</div>
      <meta http-equiv="content-type" content="text/html;
        charset=ISO-8859-1">
      <div><br>
      </div>
      <div>
        <div>
          <div>&nbsp; &nbsp;private void explicitRegisterTIFF() {</div>
          <div>&nbsp; &nbsp; &nbsp; &nbsp; ImageIO.scanForPlugins();</div>
          <div>&nbsp; &nbsp; &nbsp; &nbsp;
            IIORegistry.getDefaultInstance().registerServiceProvider(new
            com.sun.media.imageioimpl.plugins.tiff.TIFFImageReaderSpi(),
            ImageReaderSpi.class);</div>
          <div>&nbsp; &nbsp; &nbsp; &nbsp;
            IIORegistry.getDefaultInstance().registerServiceProvider(new
            GeoTiffImageReader.Spi("TIFF"), ImageReaderSpi.class);</div>
          <div>&nbsp; &nbsp; }</div>
        </div>
        <div><br>
        </div>
        <div><br>
        </div>
        <div>While this works I'm concerned that it point to a deeper
          problem within the app. I would like the service discovery
          mechanism to work</div>
        <div>as intended. Especially if I ever needed any other readers
          to work "out of the box".</div>
        <div><br>
        </div>
        <div>Any thought on this ?</div>
        <div><br>
        </div>
        <div>thanks and regards</div>
        <br>
        -- <br>
        Thys Meintjes<br>
        <br>
        <br>
      </div>
      <pre wrap="">
<fieldset class="mimeAttachmentHeader"></fieldset>
_______________________________________________
Geotoolkit mailing list
<a class="moz-txt-link-abbreviated" href="mailto:Geotoolkit@lists.osgeo.org">Geotoolkit@lists.osgeo.org</a>
<a class="moz-txt-link-freetext" href="http://lists.osgeo.org/mailman/listinfo/geotoolkit">http://lists.osgeo.org/mailman/listinfo/geotoolkit</a>
</pre>
    </blockquote>
    <br>
  </body>
</html>