-1

Caused by: java.lang.StackOverflowError at java.lang.Integer.valueOf(Integer.java:844) at com.ibm.websphere.rsadapter.DB2DataStoreHelper.findMappingClass(DB2DataStoreHelper.java:430) at com.ibm.websphere.rsadapter.DB2DataStoreHelper.findMappingClass(DB2DataStoreHelper.java:445) at com.ibm.websphere.rsadapter.DB2DataStoreHelper.findMappingClass(DB2DataStoreHelper.java:445) at com.ibm.websphere.rsadapter.DB2DataStoreHelper.findMappingClass(DB2DataStoreHelper.java:445) at com.ibm.websphere.rsadapter.DB2DataStoreHelper.findMappingClass(DB2DataStoreHelper.java:445) at com.ibm.websphere.rsadapter.DB2DataStoreHelper.findMappingClass(DB2DataStoreHelper.java:445) at com.ibm.websphere.rsadapter.DB2DataStoreHelper.findMappingClass(DB2DataStoreHelper.java:445) at com.ibm.websphere.rsadapter.DB2DataStoreHelper.findMappingClass(DB2DataStoreHelper.java:445) at com.ibm.websphere.rsadapter.DB2DataStoreHelper.findMappingClass(DB2DataStoreHelper.java:445) at com.ibm.websphere.rsadapter.DB2DataStoreHelper.findMappingClass(DB2DataStoreHelper.java:445) at

........

This com.ibm.websphere.rsadapter.DB2DataStoreHelper.findMappingClass(DB2DataStoreHelper.java:445) keeps happening till there is a stackoverflow error. The error occurs when i call executeBatch() in the Writers writeItems() so i am not sure where or why exactly it happens.

This question was asked 3 years ago by a user facing a similar problem. But there are no responses and re running did not help.

Infinite loop in DB2 JDBC driver

Community
  • 1
  • 1
Fazil Hussain
  • 425
  • 3
  • 16
  • Could you post some sample code? – Scott Kurz Aug 01 '16 at 14:43
  • what does the bottom portion of the stack look like? i.e. the set of calls that gets the code into the findMappingClass() infinite loop – Andy Guibert Aug 01 '16 at 14:53
  • The rest of the calls are essentially this same com.ibm.websphere.rsadapter.DB2DataStoreHelper.findMappingClass(DB2DataStoreHelper.java:445 a hundred times and then writeItems() line java 126 . This line number is where i do Statement.executeBatch() – Fazil Hussain Aug 01 '16 at 16:27

1 Answers1

0

This looks like a bug with how the SQLException is getting created.

What is happening in the DB2DataStoreHelper.findMappingClass() in your scenario is effectively this:

public Class<?> findMappingClass(SQLException e) {
    // Check if 'e' is in the error map anywhere, 
    // if it is, return the class.

    // otherwise, check the next exception in the chain
    SQLException next = e.getNextException();
    return findMappingClass(next);
}

So if you have 2 or more SQLExceptions that create a cycle, such as:

SQLException a = new SQLException();
SQLException b = new SQLException();

a.setNextException(b);
b.setNextException(a);

then your exception is invalid, because it creates a cycle. Therefore, any code which attempts to process the SQLException chain will run into an infinite loop as you are observing.

Review your application code to make sure that there are no cycles created in any of your exceptions.

Andy Guibert
  • 41,446
  • 8
  • 38
  • 61