An unexpected error occurred: java.lang.Exception: sailpoint.tools.GeneralException: The application script threw an exception: org.hibernate.exception.GenericJDBCException: could not get next iterator result BSF info:

Hello Team,

This is a rule that finds the identity that qualifies the filter and creates email for them. Email are being created but for only one user. And getting the error saying

“An unexpected error occurred: java.lang.Exception: sailpoint.tools.GeneralException: The application script threw an exception: org.hibernate.exception.GenericJDBCException: could not get next iterator result BSF info:”

Here is the query filter I have created:

qo.addFilter(Filter.and(Filter.eq("type", "Employee"), Filter.isnull("email"),Filter.eq("iiqStatus", "Active"),Filter.eq("orgStatus", "Hired")));
  
  List  userList = new ArrayList();
  Iterator  it = context.search(Identity.class, qo);
  
  boolean flag = false;
  
  while (it.hasNext()) {
    Identity identity = it.next();
    flag = true;
    
    String output = "";
    boolean useTLS = true;
	  String emailAddress = "";

    if(null!=identity){
      String givenName = identity.getStringAttribute("firstname");
      String companyCode = identity.getStringAttribute("compCode");
      String accountName = identity.getStringAttribute("staffId"); 
      String surName = identity.getStringAttribute("lastname");
      String initials = identity.getStringAttribute("middleInitial");  
          
        Map psAttributes = new HashMap();
                             
        psAttributes.put("accountName",accountName);      
        psAttributes.put("companyCode",companyCode);
        psAttributes.put("Initials",initials);
        psAttributes.put("GivenName",givenName);      
        psAttributes.put("SN",surName);

Can anyone help me why I am geeting this error and how to fix this.
Thank you

Hi @j1241,

When committing a transaction within an iterator loop, it unintentionally closes the current result set.
Clone the query results into memory to ensure that no commit operation can close the ResultSet.

QueryOptions qo = new QueryOptions();
qo.addFilter(Filter.and(Filter.eq("type", "Employee"), Filter.isnull("email"),Filter.eq("iiqStatus", "Active"),Filter.eq("orgStatus", "Hired")));
qo.setCloneResults(true);

@j1241

Starting from 8.x, behavior of commitTransaction during Iteration has changed, please file below link

Here best option would be using IncrementalObjectIterator instead of Iterator or second option would setting the clonned results during Iteration

IdentityIQ 8.0 and commitTransaction while using an iterator - Compass (sailpoint.com)

Please find above link for your better understanding and below is your updated code to be used

Just change your line Iterator it = context.search(Identity.class, qo); to below

IncrementalObjectIterator it = new IncrementalObjectIterator(context, Identity.class, qo);

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.