Interference of JJ2000 and JAI_ImageIO, causing Exceptions

mayuren

New Member
I have encountered a little problem while using the JAI_ImageIO library in combination with the JJ2000 source code.For explaination:I'm working on an application for my master thesis that encodes JPEG2000 images with the JJ2000 CmdLnEncoder, encrypts the encoded bitstream and measures some image quality metrics (e.g. PSNR, SSIM, LSS, ESS).For that purpose I have included the source code of the latest version of JJ2000 (v5.1, http://code.google.com/p/jj2000/) and slightly modified it for my requirements.Furthermore, in order to make some adapted code pieces of a colleague work I included the JAR Files "jai_core-1.1.3.jar", "jai_codec-1.1.3.jar" and "jai_imageio-1.1.jar" as External JARs into the Referenced Libraries of my project.Now to the actual problem:When I run the application, the encoding of the JP2 files works fine, but when it comes up to calculating the PSNR reaching the following line\[code\]BufferedImage im1 = ImageIO.read(file1);\[/code\]I encounter the following exception:\[code\]Exception in thread "main" java.lang.RuntimeException: jj2000.j2k.fileformat.reader.FileFormatReader.<init>(Ljj2000/j2k/io/RandomAccessIO;Lcom/sun/media/imageioimpl/plugins/jpeg2000/J2KMetadata;)V at com.sun.media.imageioimpl.plugins.jpeg2000.J2KReadState.initializeRead(J2KReadState.java:696) at com.sun.media.imageioimpl.plugins.jpeg2000.J2KReadState.<init>(J2KReadState.java:209) at com.sun.media.imageioimpl.plugins.jpeg2000.J2KImageReader.read(J2KImageReader.java:449) at javax.imageio.ImageIO.read(Unknown Source) at javax.imageio.ImageIO.read(Unknown Source) ...\[/code\]Now, when I install the mentioned JAI libraries into the Java Runtime Environment (C:\Programme\Java\jre6\lib\ext), the line where I previously encountered the exception works fine and the calculation of the PSNR works fine, but the call of the JJ2000 CmdLnEncoder\[code\]CmdLnEncoder.main(cmdStr);\[/code\]that has already worked before produces the following exception:\[code\] Exception in thread "main" java.lang.SecurityException: sealing violation: package jj2000.j2k.util is sealed at java.net.URLClassLoader.defineClass(Unknown Source) at java.net.URLClassLoader.access$000(Unknown Source) at java.net.URLClassLoader$1.run(Unknown Source) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) at jpeg2000.roi.encryption.util.CmdLnEncoder.<init>(CmdLnEncoder.java:99) at jpeg2000.roi.encryption.util.CmdLnEncoder.main(CmdLnEncoder.java:83) ...\[/code\]In my previous research I found out, that this problem might be caused by a different version of JJ2000 used in the JAI ImageIO library than I am using in my project, but I have to admit that I can't think of a solution to it yet.So please, if anyone has an idea to help me in my confusion that would be very appreciated. ^^Kind regards,Chris
 
Top