fix java exception

ⅰ亾dé卋堺 提交于 2019-12-02 17:23:19

1.import com.sun.image.codec.jpeg.JPEGCodec;

在Eclipse中处理图片,需要引入两个包:
import com.sun.image.codec.jpeg.JPEGCodec;
import com.sun.image.codec.jpeg.JPEGImageEncoder;
报错:
Access restriction: The type JPEGImageEncoder is not accessible due to restriction on required library C:\Java\jre1.6.0_07\lib\rt.jar
此时解决办法:
Eclipse默认把这些受访问限制的API设成了ERROR。只要把Windows-Preferences-Java-Complicer-Errors/Warnings里面的Deprecated and restricted API中的Forbidden references(access rules)选为Warning就可以编译通过。


2.Spring版本冲突造成的异常

异常1:java.lang.NoSuchMethodError: org.springframework.util.Assert.noNullElements([Ljava/lang/Object;Ljava/lang/String;)V

解决方法:不能将Spring 2.0和Spring 2.5中的spring.jar与spring-[modules].jar混合使用。也就是说,Spring2.0就是用spring2.0.jar包,不能使用spring.jar,否则将报以上异常。

异常2:java.lang.NoSuchMethodError: sun.rmi.transport.ObjectTable.getStub(Ljava/rmi/Remote;)Ljava/rmi/server/RemoteStub

问题描述:当集成JOTM 2.0.13到Tomcat 5.5.27时出现;

解决方法:修改carol.properties文件中的carol.jvm.rmi.local.call属性为true。



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