我遇到错误
Unhandled exception at 0x77106214 in java.exe: 0xC0000374: A heap has been corrupted
在服务器tomcat 8,java 8中长时间运行应用程序时,在应用程序中,我正在将SAPB1与JCO库连接。它可以正常工作一段时间,但是在几个小时后,JVM崩溃并出现了如上所述的错误。 我的代码来自this有用的参考资料。在该应用程序中,我正在使用同步应用程序(预定作业)从SAPB1获取数据。来自错误的信息似乎在使用JNI时出现错误,该错误会传播回JVM,从而导致崩溃。
使用的JcoQuery如下所述
SELECT DocEntry,DocNum,CardName,CardCode,docTotal,UpdateTS, UpdateDate,DocDate,注释,DocStatus,DocDueDate,ReceiptNum FROM OPOR WHERE ObjType = 22 AND convert(datetime,(SELECT CONVERT(DATETIME, CONVERT(CHAR(8),UpdateDate,112)+''+ CONVERT(CHAR(8),(选择 CAST(LEFT(RIGHT('000000'+ CAST(UpdateTS AS VARCHAR),6),2)+':'+ RIGHT(LEFT(RIGHT('000000'+ CAST(UpdateTS AS VARCHAR),6),4),2)+ ':'+ RIGHT('000000'+ CAST(UpdateTS AS VARCHAR),2)AS TIME)), 108))))> convert(datetime,(SELECT CONVERT(DATETIME,CONVERT(CHAR(8), CAST('2018-10-19 15:11:00.60'AS DATE),112)+''+ CONVERT(CHAR(8), (SELECT CAST(LEFT(RIGHT('000000'+ CAST('1233'AS VARCHAR),6),2)+ ':'+ RIGHT(LEFT(RIGHT('000000'+ CAST('1233'AS VARCHAR),6),4),2) +':'+ RIGHT('000000'+ CAST('1233'AS VARCHAR),2)AS TIME)),108)))))ORDER BY DocNum
使用的代码在下面给出
private <T> List<T> getData(Class<T> klazz, ICompany company, JcoQuery jcoQuery) throws Exception {
IRecordset recordSet = null;
List<T> result = new ArrayList<T>();
try {
recordSet = SBOCOMUtil.newRecordset(company);
String query = jcoQuery.getQuery();
System.out.println("Query : "+query);
List<String> fieldNameList = jcoQuery.getResultFieldList();
recordSet.doQuery(query);
int index = recordSet.getRecordCount();
// print out column names first - CardCode(item 0) and CardName(item 1)
System.out.println(recordSet.getFields().item(0).getName() + ":" +recordSet.getFields().item(0).getValue()
+ "\t\t"
+ recordSet.getFields().item(1).getName() + ":" + recordSet.getFields().item(1).getValue()
);
recordSet.moveFirst();
// iterate through all rows
for (int i = 0; i < index; i++) {
result.add(setObject(klazz, fieldNameList, recordSet));
recordSet.moveNext();
}
} catch (Exception e) {
e.printStackTrace();
throw e;
} finally {
try {
recordSet.release();
} catch (Exception e) {
e.printStackTrace();
}
}
return result;
}
错误如本 link
中所述Stack: [0x15810000,0x15860000], sp=0x1585d858, free space=310k
Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code)
C [ntdll.dll+0x41f49]
C [ntdll.dll+0x41d6a]
C [sbojni.dll+0xa465]
C [sbojni.dll+0x1b31]
C [sbojni.dll+0x1e99]
J 5321 com.sap.smb.sbo.wrapper.com.Dispatch.invokev(Ljava/lang/Object;Ljava/lang/String;III[Lcom/sap/smb/sbo/wrapper/com/Variant;[I)Lcom/sap/smb/sbo/wrapper/com/Variant; (0 bytes) @ 0x027aa54c [0x027aa460+0xec]
J 5320 C1 com.sap.smb.sbo.wrapper.com.Dispatch.invokev(Ljava/lang/Object;Ljava/lang/String;I[Lcom/sap/smb/sbo/wrapper/com/Variant;[I)Lcom/sap/smb/sbo/wrapper/com/Variant; (31 bytes) @ 0x0263f1c8 [0x0263f160+0x68]
j com.sap.smb.sbo.wrapper.com.Dispatch.get(Ljava/lang/Object;Ljava/lang/String;)Lcom/sap/smb/sbo/wrapper/com/Variant;+10
j com.sap.smb.sbo.api.Company.getCompanyName()Ljava/lang/String;+6
j com.gtl.app.sapb1.adapter.sabpb1.connection.JcoCompanyConnector.connect()Z+246
j com.gtl.app.sapb1.adapter.sabpb1.connection.JcoDataFetcher.getData(Ljava/lang/Class;Lcom/gtl/app/sapb1/adapter/sabpb1/query/JcoQuery;)Ljava/util/List;+6
j com.gtl.app.sapb1.adapter.service.impl.PurchaseOrderServiceImpl.getPurchaseOrderList(Lcom/gtl/app/erp/api/service/request/GetPurchaseOrderListRequest;)Lcom/gtl/app/erp/api/service/response/GetPurchaseOrderListResponse;+63
j com.gtl.app.sapb1.adapter.controller.PurchaseOrderController.getPurchaseOrderList(Lcom/gtl/app/erp/api/service/request/GetPurchaseOrderListRequest;)Lorg/springframework/http/ResponseEntity;+5
j sun.reflect.GeneratedMethodAccessor92.invoke(Ljava/lang/Object;[Ljava/lang/Object;)Ljava/lang/Object;+40
J 204 C1 sun.reflect.DelegatingMethodAccessorImpl.invoke(Ljava/lang/Object;[Ljava/lang/Object;)Ljava/lang/Object; (10 bytes) @ 0x02680bc0 [0x02680b90+0x30]
Internal exceptions (10 events):
Event: 60835.818 Thread 0x11bf7000 Exception <a 'com/sap/smb/sbo/wrapper/com/ComFailException'> (0x0468e300) thrown at [C:\re\workspace\8-2-build-windows-i586-cygwin\jdk8u172\10810\hotspot\src\share\vm\prims\jni.cpp, line 709]
Event: 62479.265 Thread 0x11bf7000 Exception <a 'java/lang/ArrayIndexOutOfBoundsException': -1> (0x04deef38) thrown at [C:\re\workspace\8-2-build-windows-i586-cygwin\jdk8u172\10810\hotspot\src\share\vm\interpreter\interpreterRuntime.cpp, line 366]
Event: 62479.265 Thread 0x11bf7000 Exception <a 'java/lang/ArrayIndexOutOfBoundsException': -1> (0x04def158) thrown at [C:\re\workspace\8-2-build-windows-i586-cygwin\jdk8u172\10810\hotspot\src\share\vm\interpreter\interpreterRuntime.cpp, line 366]
Event: 62479.630 Thread 0x11bf3c00 Exception <a 'java/io/IOException'> (0x046e8660) thrown at [C:\re\workspace\8-2-build-windows-i586-cygwin\jdk8u172\10810\hotspot\src\share\vm\prims\jni.cpp, line 709]
Event: 66178.572 Thread 0x24ddd800 Exception <a 'java/lang/ArrayIndexOutOfBoundsException': 83> (0x05d6cc80) thrown at [C:\re\workspace\8-2-build-windows-i586-cygwin\jdk8u172\10810\hotspot\src\share\vm\interpreter\interpreterRuntime.cpp, line 366]
Event: 66178.583 Thread 0x24ddd800 Exception <a 'java/lang/ArrayIndexOutOfBoundsException': 31> (0x05d97808) thrown at [C:\re\workspace\8-2-build-windows-i586-cygwin\jdk8u172\10810\hotspot\src\share\vm\interpreter\interpreterRuntime.cpp, line 366]
Event: 66178.585 Thread 0x24ddd800 Exception <a 'java/lang/ArrayIndexOutOfBoundsException': 60> (0x05d9f518) thrown at [C:\re\workspace\8-2-build-windows-i586-cygwin\jdk8u172\10810\hotspot\src\share\vm\interpreter\interpreterRuntime.cpp, line 366]
Event: 66178.586 Thread 0x24ddd800 Exception <a 'java/lang/ArrayIndexOutOfBoundsException': 88> (0x05da1608) thrown at [C:\re\workspace\8-2-build-windows-i586-cygwin\jdk8u172\10810\hotspot\src\share\vm\interpreter\interpreterRuntime.cpp, line 366]
Event: 66178.588 Thread 0x24ddd800 Exception <a 'java/lang/ArrayIndexOutOfBoundsException': 31> (0x05db1a70) thrown at [C:\re\workspace\8-2-build-windows-i586-cygwin\jdk8u172\10810\hotspot\src\share\vm\interpreter\interpreterRuntime.cpp, line 366]
Event: 66392.516 Thread 0x132bf400 Exception <a 'com/sap/smb/sbo/wrapper/com/ComFailException'> (0x0497bc30) thrown at [C:\re\workspace\8-2-build-windows-i586-cygwin\jdk8u172\10810\hotspot\src\share\vm\prims\jni.cpp, line 709]