com.atlassian.jira.exception.DataAccessException: org.ofbiz.core.entity.GenericDataSourceException: SQL Exception while executing the following:SELECT ID, LOG_ID, OBJECT_TYPE, OBJECT_ID, OBJECT_NAME, OBJECT_PARENT_ID, OBJECT_PARENT_NAME FROM jiraschema.audit_item WHERE (LOG_ID IN [...] (Prepared or callable statement has more than 2000 parameter markers.)

Atlassian JIRA | Chris Solgat | 2 years ago
tip
Click on the to mark the solution that helps you, Samebug will learn from it.
As a community member, you’ll be rewarded for you help.
  1. 0

    When exporting the audit log, the export file is empty. The prompt will give you a number of entries that will be exported (truncated to the 100,000 newest events), yet when you open the export file, it is empty. I have attached the audit log zip file. *Edit with root cause:* In tomcat logs there are following exceptions: {code} SEVERE: Servlet.service() for servlet default threw exception com.atlassian.jira.exception.DataAccessException: org.ofbiz.core.entity.GenericDataSourceException: SQL Exception while executing the following:SELECT ID, LOG_ID, OBJECT_TYPE, OBJECT_ID, OBJECT_NAME, OBJECT_PARENT_ID, OBJECT_PARENT_NAME FROM jiraschema.audit_item WHERE (LOG_ID IN [...] (Prepared or callable statement has more than 2000 parameter markers.) at com.atlassian.jira.ofbiz.DefaultOfBizDelegator.findListIteratorByCondition(DefaultOfBizDelegator.java:534) at com.atlassian.jira.ofbiz.WrappingOfBizDelegator.findListIteratorByCondition(WrappingOfBizDelegator.java:349) at com.atlassian.jira.entity.SelectQueryImpl$ExecutionContextImpl.consumeWith(SelectQueryImpl.java:234) at com.atlassian.jira.entity.SelectQueryImpl$ExecutionContextImpl.visitWith(SelectQueryImpl.java:253) at com.atlassian.jira.auditing.AuditingStoreImpl.getItems(AuditingStoreImpl.java:293) at com.atlassian.jira.auditing.AuditingStoreImpl.getAuditRecords(AuditingStoreImpl.java:249) at com.atlassian.jira.auditing.AuditingStoreImpl.getRecords(AuditingStoreImpl.java:195) at com.atlassian.jira.auditing.AuditingManagerImpl.getRecords(AuditingManagerImpl.java:108) at com.atlassian.jira.auditing.AuditingManagerImpl.getRecords(AuditingManagerImpl.java:82) at sun.reflect.GeneratedMethodAccessor2802.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at com.atlassian.plugin.osgi.hostcomponents.impl.DefaultComponentRegistrar$ContextClassLoaderSettingInvocationHandler.invoke(DefaultComponentRegistrar.java:129) at com.sun.proxy.$Proxy296.getRecords(Unknown Source) at sun.reflect.GeneratedMethodAccessor2802.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) [...] {code} This is reproducible only with MSSQL when exporting more than 2000 records, because MSSQL allows only for 2000 placeholder values in prepared statements. Also it affects Audit Log only in JIRA 6.3.5 and above since from that point there is an optimization introduced that results in prepare statements with long lists of place holders.

    Atlassian JIRA | 2 years ago | Chris Solgat
    com.atlassian.jira.exception.DataAccessException: org.ofbiz.core.entity.GenericDataSourceException: SQL Exception while executing the following:SELECT ID, LOG_ID, OBJECT_TYPE, OBJECT_ID, OBJECT_NAME, OBJECT_PARENT_ID, OBJECT_PARENT_NAME FROM jiraschema.audit_item WHERE (LOG_ID IN [...] (Prepared or callable statement has more than 2000 parameter markers.)
  2. 0

    When exporting the audit log, the export file is empty. The prompt will give you a number of entries that will be exported (truncated to the 100,000 newest events), yet when you open the export file, it is empty. I have attached the audit log zip file. *Edit with root cause:* In tomcat logs there are following exceptions: {code} SEVERE: Servlet.service() for servlet default threw exception com.atlassian.jira.exception.DataAccessException: org.ofbiz.core.entity.GenericDataSourceException: SQL Exception while executing the following:SELECT ID, LOG_ID, OBJECT_TYPE, OBJECT_ID, OBJECT_NAME, OBJECT_PARENT_ID, OBJECT_PARENT_NAME FROM jiraschema.audit_item WHERE (LOG_ID IN [...] (Prepared or callable statement has more than 2000 parameter markers.) at com.atlassian.jira.ofbiz.DefaultOfBizDelegator.findListIteratorByCondition(DefaultOfBizDelegator.java:534) at com.atlassian.jira.ofbiz.WrappingOfBizDelegator.findListIteratorByCondition(WrappingOfBizDelegator.java:349) at com.atlassian.jira.entity.SelectQueryImpl$ExecutionContextImpl.consumeWith(SelectQueryImpl.java:234) at com.atlassian.jira.entity.SelectQueryImpl$ExecutionContextImpl.visitWith(SelectQueryImpl.java:253) at com.atlassian.jira.auditing.AuditingStoreImpl.getItems(AuditingStoreImpl.java:293) at com.atlassian.jira.auditing.AuditingStoreImpl.getAuditRecords(AuditingStoreImpl.java:249) at com.atlassian.jira.auditing.AuditingStoreImpl.getRecords(AuditingStoreImpl.java:195) at com.atlassian.jira.auditing.AuditingManagerImpl.getRecords(AuditingManagerImpl.java:108) at com.atlassian.jira.auditing.AuditingManagerImpl.getRecords(AuditingManagerImpl.java:82) at sun.reflect.GeneratedMethodAccessor2802.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at com.atlassian.plugin.osgi.hostcomponents.impl.DefaultComponentRegistrar$ContextClassLoaderSettingInvocationHandler.invoke(DefaultComponentRegistrar.java:129) at com.sun.proxy.$Proxy296.getRecords(Unknown Source) at sun.reflect.GeneratedMethodAccessor2802.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) [...] {code} This is reproducible only with MSSQL when exporting more than 2000 records, because MSSQL allows only for 2000 placeholder values in prepared statements. Also it affects Audit Log only in JIRA 6.3.5 and above since from that point there is an optimization introduced that results in prepare statements with long lists of place holders.

    Atlassian JIRA | 2 years ago | Chris Solgat
    com.atlassian.jira.exception.DataAccessException: org.ofbiz.core.entity.GenericDataSourceException: SQL Exception while executing the following:SELECT ID, LOG_ID, OBJECT_TYPE, OBJECT_ID, OBJECT_NAME, OBJECT_PARENT_ID, OBJECT_PARENT_NAME FROM jiraschema.audit_item WHERE (LOG_ID IN [...] (Prepared or callable statement has more than 2000 parameter markers.)

    Root Cause Analysis

    1. com.atlassian.jira.exception.DataAccessException

      org.ofbiz.core.entity.GenericDataSourceException: SQL Exception while executing the following:SELECT ID, LOG_ID, OBJECT_TYPE, OBJECT_ID, OBJECT_NAME, OBJECT_PARENT_ID, OBJECT_PARENT_NAME FROM jiraschema.audit_item WHERE (LOG_ID IN [...] (Prepared or callable statement has more than 2000 parameter markers.)

      at com.atlassian.jira.ofbiz.DefaultOfBizDelegator.findListIteratorByCondition()
    2. com.atlassian.jira
      AuditingManagerImpl.getRecords
      1. com.atlassian.jira.ofbiz.DefaultOfBizDelegator.findListIteratorByCondition(DefaultOfBizDelegator.java:534)
      2. com.atlassian.jira.ofbiz.WrappingOfBizDelegator.findListIteratorByCondition(WrappingOfBizDelegator.java:349)
      3. com.atlassian.jira.entity.SelectQueryImpl$ExecutionContextImpl.consumeWith(SelectQueryImpl.java:234)
      4. com.atlassian.jira.entity.SelectQueryImpl$ExecutionContextImpl.visitWith(SelectQueryImpl.java:253)
      5. com.atlassian.jira.auditing.AuditingStoreImpl.getItems(AuditingStoreImpl.java:293)
      6. com.atlassian.jira.auditing.AuditingStoreImpl.getAuditRecords(AuditingStoreImpl.java:249)
      7. com.atlassian.jira.auditing.AuditingStoreImpl.getRecords(AuditingStoreImpl.java:195)
      8. com.atlassian.jira.auditing.AuditingManagerImpl.getRecords(AuditingManagerImpl.java:108)
      9. com.atlassian.jira.auditing.AuditingManagerImpl.getRecords(AuditingManagerImpl.java:82)
      9 frames
    3. Java RT
      Method.invoke
      1. sun.reflect.GeneratedMethodAccessor2802.invoke(Unknown Source)
      2. sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
      3. java.lang.reflect.Method.invoke(Unknown Source)
      3 frames
    4. com.atlassian.plugin
      DefaultComponentRegistrar$ContextClassLoaderSettingInvocationHandler.invoke
      1. com.atlassian.plugin.osgi.hostcomponents.impl.DefaultComponentRegistrar$ContextClassLoaderSettingInvocationHandler.invoke(DefaultComponentRegistrar.java:129)
      1 frame
    5. com.sun.proxy
      $Proxy296.getRecords
      1. com.sun.proxy.$Proxy296.getRecords(Unknown Source)
      1 frame
    6. Java RT
      Method.invoke
      1. sun.reflect.GeneratedMethodAccessor2802.invoke(Unknown Source)
      2. sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
      3. java.lang.reflect.Method.invoke(Unknown Source)
      3 frames