报这个异常java.lang.ClassCastException: 哪里错了啊
异常如下:
Exception in thread "main" java.lang.ClassCastException: java.io.FileInputStream
at test.SimpleTest.testQuickStart(SimpleTest.java:18)
at test.SimpleTest.main(SimpleTest.java:26)
源码如下
Exception in thread "main" java.lang.ClassCastException: java.io.FileInputStream
at test.SimpleTest.testQuickStart(SimpleTest.java:18)
at test.SimpleTest.main(SimpleTest.java:26)
源码如下
package test;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.InputStream;
import org.springframework.beans.factory.xml.XmlBeanFactory;
import org.springframework.core.io.Resource;
import net.xiaxin.spring.qs.Action;
public class SimpleTest {
public void testQuickStart() throws FileNotFoundException {
InputStream is = new FileInputStream("bean.xml");
XmlBeanFactory factory = new XmlBeanFactory((Resource) is);
Action action = (Action) factory.getBean("TheAction");
System.out.println(action.execute("Rod Johnson"));
}
public static void main(String[] args) throws FileNotFoundException {
SimpleTest simpleTest = new SimpleTest();
simpleTest.testQuickStart();
}
}
...全文
相关推荐
java.lang.ClassCastException
ebean,sbean,dto
Java异常处理运行时异常(RuntimeException)详解及实例
主要介绍了 Java异常处理运行时异常(RuntimeException)详解及实例的相关资料,需要的朋友可以参考下http://time.qq.com/?pgv_ref=aiotime
java常见异常
算术异常类:ArithmeticExecption 空指针异常类:NullPointerException 类型强制转换异常:ClassCastException 数组负下标异常:NegativeArrayException 数组下标越界异常:ArrayIndexOutOfBoundsException 违背安全原则异常:SecturityException 文件已结束异常:EOFException 文件未找到异常:FileNotFoundException 字符串转换为数字异常:NumberFormatException
Java程序常见异常及处理汇总
主要介绍了java程序常见异常及处理汇总,文中通过示例代码介绍的非常详细,对大家的学习或者工作具有一定的参考学习价值,需要的朋友可以参考下
java.lang.ClassCastException(解决方案).md
项目中碰到的,记录一下解决方案


