[udig-devel] jai is driving me cray

Andrea Aime aaime at openplans.org
Wed Apr 4 05:40:37 PDT 2007


Andrea Antonello ha scritto:
> Hi folks, I have (once again) a problem with jai:
> 
> java.lang.ClassCastException:
> com.sun.media.jai.imageioimpl.ImageReadWriteSpi
> 	at
> javax.media.jai.OperationRegistry.registerServices(OperationRegistry.java:2047)
> 	at
> javax.media.jai.ThreadSafeOperationRegistry.registerServices(ThreadSafeOperationRegistry.java:612)
> 	at
> javax.media.jai.OperationRegistry.initializeRegistry(OperationRegistry.java:365)
> 	at javax.media.jai.JAI.<clinit>(JAI.java:560)
> 
> 
> So what is the best practice?

The best practice is the harder to attain. You should have the JAI jars 
installed directly into your JDK, and don't have them anywhere in the 
classpath. Otherwise you're bound to issues as soon as a damned 
classloader does not play exactly by the Sun rules. Sigh...

The issue is that JAI is packaged as an extension, and it's sealed.
We still haven't tried hacking the official jars and remove the sealing
markers, but that would be an interesting test too (that is, to check if
this way JAI can be handled both in the JDK/JRE and in the classpath).

Cheers
Andrea


More information about the udig-devel mailing list