ClassNotFoundException javax.media.jai.OperationRegistrySpi but the class is there

自闭症网瘾萝莉.ら 提交于 2019-12-24 08:50:00

问题


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.


回答1:


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.



来源:https://stackoverflow.com/questions/40476793/classnotfoundexception-javax-media-jai-operationregistryspi-but-the-class-is-the

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!