Hi All-
    After a 5 year hiatus, I am getting re-acquinted with GeoTools. I have 
downloaded a copy of "geotools-2.7-RC2-bin" and I'm writing a simple app to 
process a    GridCoverage2D. Out of the gates, I can't seem to get past a 
"NoClassDefFoundError: javax/media/jai/OperationRegistrySpi". Here's the code:


BufferedImage bi = ImageIO.read(
   new File("C:/My Documents/earth.jpg"));

Envelope2D envelope = new Envelope2D(CRS.decode("EPSG:4326"),
   new java.awt.geom.Rectangle2D.Float(-180f, -90.0f, 180f, 90f)
);

GridCoverage2D gc2d = new GridCoverageFactory().create("BMImage", bi, envelope);


It's bombing out on the create() method saying:

Exception in thread "main" java.lang.NoClassDefFoundError: 
javax/media/jai/OperationRegistrySpi
...
at com.sun.media.jai.util.Service$LazyIterator.next(Unknown Source)
at javax.media.jai.OperationRegistry.registerServices(Unknown Source)
at javax.media.jai.ThreadSafeOperationRegistry.registerServices(Unknown Source)
at javax.media.jai.OperationRegistry.initializeRegistry(Unknown Source)
at javax.media.jai.JAI.<clinit>(Unknown Source)
at 
org.geotools.coverage.GridSampleDimension.<clinit>(GridSampleDimension.java:1432)

at org.geotools.coverage.grid.GridCoverage2D.<init>(GridCoverage2D.java:233)
at 
org.geotools.coverage.grid.GridCoverageFactory.create(GridCoverageFactory.java:590)

at 
org.geotools.coverage.grid.GridCoverageFactory.create(GridCoverageFactory.java:514)

at 
org.geotools.coverage.grid.GridCoverageFactory.create(GridCoverageFactory.java:455)

...

Note that the binaries I downloaded seem to have all the requisite jar files 
*EXCEPT* jai_core.jar. I see "jai_codec-1.1.3.jar" and "jai_imageio-1.1.jar" 
but 
I had to add "jai_core.jar" (JAI 1.1.3 alpha) to my project to even get to this 
point. 


I can import "javax.media.jai.OperationRegistrySpi" without any problems (no 
build or compile errors). If I take out "jai_core.jar", the import fails. 


I know must be missing another jar file or something simple. Any suggestions?

Thanks in Advance!
Peter



      

------------------------------------------------------------------------------
Free Software Download: Index, Search & Analyze Logs and other IT data in 
Real-Time with Splunk. Collect, index and harness all the fast moving IT data 
generated by your applications, servers and devices whether physical, virtual
or in the cloud. Deliver compliance at lower cost and gain new business 
insights. http://p.sf.net/sfu/splunk-dev2dev 
_______________________________________________
Geotools-gt2-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users

Reply via email to