IDEA中启动tomcat报错如下,导致项目启动失败:
2022-10-30 17:06:31 ERROR [RMI TCP Connection(3)-127.0.0.1] xxx:(251) - 根据文件xxx]扩展点定义[xxx],创建扩展点实例时出错
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'kmReviewQuartzImpl' defined in ServletContext resource xxx/spring.xml]: Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate xxx.KmReviewQuartzImpl]: No default constructor found; nested exception is java.lang.VerifyError: Bad type on operand stack
Exception Details:
Location:
xxx.method(Ljava/lang/String;)Ljava/lang/Integer; @65: areturn
Reason:
Type integer (current frame, stack[0]) is not assignable to reference type
Current Frame:
bci: @65
flags: { }
locals: { 'java/lang/String', '[Ljava/lang/String;', integer }
stack: { integer }
Bytecode:
0x0000000: 1007 bd00 f159 0312 f653 5904 12f8 5359
0x0000010: 0512 fa53 5906 12fc 5359 0712 fe53 5908
0x0000020: 1301 0053 5910 0613 0102 534c 033d a700
0x0000030: 1c2a 2b1c 32b6 0115 9900 0f1c 9a00 0610
0x0000040: 07b0 1cb8 0172 b084 0201 1c2b bea1 ffe4
0x0000050: 03b8 0172 b0
Stackmap Table:
append_frame(@49,Object[#313],Integer)
same_frame(@66)
same_frame(@71)
same_frame(@74)
根据(Ljava/lang/String;)Ljava/lang/Integer; @65: areturn排查报错原因
类型引用有问题
public static Integer getIndex(String week){
String[] weekDays = { "周日", "周一", "周二", "周三", "周四", "周五", "周六" };//格式
Integer index = 0;
for(int i = 0 ;i<weekDays.length;i++){
if(week.equals(weekDays[i])){
if(i == 0){//周日
return index = 7;
}
return index = i;
}
}
return 0;
}
把Integet改为int就可以了
public static int getIndex(String week){
String[] weekDays = { "周日", "周一", "周二", "周三", "周四", "周五", "周六" };//格式
int index = 0;
for(int i = 0 ;i<weekDays.length;i++){
if(week.equals(weekDays[i])){
if(i == 0){//周日
return index = 7;
}
return index = i;
}
}
return 0;
}