1

I have two similar projects working with Jai and one runs smoothly while the other stops when calling RenderedOp class from the jai_core.jar library, saying that it can't find the class OperationRegistrySpi.

Both classes exist within that jar.

RenderedOp imagen = JAI.create("stream",imgTif ); //This line throws the exception

The log goes like this:

GRAVE: >>java.lang.NoClassDefFoundError: javax/media/jai/OperationRegistrySpi
>>java.lang.ClassNotFoundException: javax.media.jai.OperationRegistrySpi
>>  at java.net.URLClassLoader$1.run(Unknown Source)
>>  at java.security.AccessController.doPrivileged(Native Method)
>>  at java.net.URLClassLoader.findClass(Unknown Source)
>>  at sun.misc.Launcher$ExtClassLoader.findClass(Unknown Source)
>>  at java.lang.ClassLoader.loadClass(Unknown Source)
>>  at java.lang.ClassLoader.loadClass(Unknown Source)
>>  at java.lang.ClassLoader.defineClass1(Native Method)
>>  at java.lang.ClassLoader.defineClassCond(Unknown Source)
>>  at java.lang.ClassLoader.defineClass(Unknown Source)
>>  at java.security.SecureClassLoader.defineClass(Unknown Source)
>>  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 sun.misc.Launcher$ExtClassLoader.findClass(Unknown Source)
>>  at java.lang.ClassLoader.loadClass(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 org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1595)
>>  at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1526)
>>  at java.lang.Class.forName0(Native Method)
>>  at java.lang.Class.forName(Unknown Source)
>>  at com.sun.media.jai.util.Service$LazyIterator.next(Service.java:267)
>>  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)

I have configured the Build Path and the jar file location is the same for the working project and the buggy one.

I'm on Eclipse.

sergiotbh
  • 188
  • 1
  • 5
  • 13
  • http://stackoverflow.com/questions/17408769/how-do-i-resolve-this-java-class-not-found-exception – Aammad Ullah Nov 08 '16 at 00:15
  • @AammadUllah Thanks, but I've already checked the build path configuration many (many) times, I was thinking it could be a Jai related issue. – sergiotbh Nov 08 '16 at 00:21
  • Can you able to find a class `javax.media.jai.OperationRegistrySpi` using Ctrl+Shift+T in eclipse? If yes how many of them do you find? Its possible that you have multiple jars **jai_core.jar** of different version. Can you post a screenshot of it ? – Chirag Parmar Nov 08 '16 at 04:59
  • @ChiragParmar I could solve it by deleting all the jar files related to Jai and reinstalling the jai-1_1_2_01-lib-windows-i586-jre.exe package. I think having multiple jai-core library files in different locations made my project behave oddly. Thanks a lot for your comment. – sergiotbh Nov 08 '16 at 16:14
  • @AammadUllah- Cheers..!! – Chirag Parmar Nov 09 '16 at 04:45

1 Answers1

0

I could solve it by deleting all the jar files related to Jai (jai-core and jai-codec) and reinstalling the jai-1_1_2_01-lib-windows-i586-jre.exe package found here.

The problem was that I was missing the mlibwrapper_jai.jar that comes with the installation of jai.

sergiotbh
  • 188
  • 1
  • 5
  • 13