我有两个与 Jai 合作的类似项目,一个运行顺利,而另一个在从 jai_core.jar 库调用 RenderedOp 类时停止,说它找不到类 OperationRegistrySpi。
这两个类都存在于该 jar 中。
RenderedOp imagen = JAI.create("stream",imgTif ); //This line throws the exception
日志是这样的:
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)
我已经配置了构建路径,并且工作项目和错误项目的 jar 文件位置相同。
我在日食。