霍霍12345 2015-03-11 05:00 采纳率: 100%
浏览 35063
已采纳

Spring错误,Could not instantiate bean class

在网页运行的时候出现的错误...为什么不能实例化bean
在控制层中已经用annotation配置了的
Struts has detected an unhandled exception:

Messages: Could not instantiate bean class [cn.insurance.view.action.InsuranceInfoAction]: Constructor threw exception; nested exception is java.lang.StackOverflowError
Error creating bean with name 'insuranceInfoAction' defined in file [D:\Program Files\apache-tomcat-6.0.36\webapps\InsuranceRemind\WEB-INF\classes\cn\insurance\view\action\InsuranceInfoAction.class]: Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [cn.insurance.view.action.InsuranceInfoAction]: Constructor threw exception; nested exception is java.lang.StackOverflowError
Unable to instantiate Action, insuranceInfoAction, defined for 'insuranceInfoAction_uploadExcelUI' in namespace '/'Error creating bean with name 'insuranceInfoAction' defined in file [D:\Program Files\apache-tomcat-6.0.36\webapps\InsuranceRemind\WEB-INF\classes\cn\insurance\view\action\InsuranceInfoAction.class]: Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [cn.insurance.view.action.InsuranceInfoAction]: Constructor threw exception; nested exception is java.lang.StackOverflowError

File: org/springframework/beans/BeanUtils.java
Line number: 115


Stacktraces
Unable to instantiate Action, insuranceInfoAction, defined for 'insuranceInfoAction_uploadExcelUI' in namespace '/'Error creating bean with name 'insuranceInfoAction' defined in file [D:\Program Files\apache-tomcat-6.0.36\webapps\InsuranceRemind\WEB-INF\classes\cn\insurance\view\action\InsuranceInfoAction.class]: Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [cn.insurance.view.action.InsuranceInfoAction]: Constructor threw exception; nested exception is java.lang.StackOverflowError


Struts.xml

/WEB-INF/jsp/dateAction/uploadExcelUI.jsp

insuranceInfoAction.java   --控制层
    @Component("insuranceInfoAction")

@Scope("prototype")
public class InsuranceInfoAction extends ModelDriverBaseAction{

//文件上传--excle后缀.xls

// public String addExcelData() {
//

//

// return "addExcelData";
// }
//上传页面-Excle
public String uploadExcelUI() {
return "uploadExcelUI";
}
}

  • 写回答

2条回答 默认 最新

  • 霍霍12345 2015-03-11 05:16
    关注

    控制层中InsuranceInfoAction.java错误,
    public class InsuranceInfoAction extends ModelDriverBaseAction{}
    写成了,传递的应该是实体类,误写成InsuranceInfoAction,传递自己进去了
    public class InsuranceInfoAction extends ModelDriverBaseAction{}

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥200 求能开发抖音自动回复卡片的软件
  • ¥15 关于freesurfer使用freeview可视化的问题
  • ¥100 谁能在荣耀自带系统MagicOS版本下,隐藏手机桌面图标?
  • ¥15 求SC-LIWC词典!
  • ¥20 有关esp8266连接阿里云
  • ¥15 C# 调用Bartender打印机打印
  • ¥15 我这个代码哪里有问题 acm 平台上显示错误 90%,我自己运行好像没什么问题
  • ¥50 C#编程中使用printDocument类实现文字排版打印问题
  • ¥15 找会编程的帅哥美女 可以用MATLAB里面的simulink编程,用Keil5编也可以。
  • ¥15 已知隐函数其中一个变量τ的具体值,求另一个变量