Skip to content

[오류] java.sql.SQLDataException: The second or third argument of the SUBSTR function is out of range #6

@4month

Description

@4month

안녕하세요,

유용한 API제공해주셔서 감사합니다

가이드 대로 구성 후에 수동으로 레포팅 파일을 생성해 보았는데요, 아래와 같은 에러가 발생합니다
에러로그에 맞는 추가 조치를 해줘야 되는건지 궁금합니다

  • scouter-maapper.xml 등 설정 변경은 하지 않았습니다
  • 수집로그는 derbyDB에 잘 쌓이고 있습니다(db접속툴로 테이블 별로 조회해보면 수집 데이터 확인됩니다)
  • scouter.conf 설정

ext_plugin_reporting_drop_table=false
ext_plugin_reporting_logging_enabled=false
ext_plugin_reporting_max_elapsed_time=5000
ext_plugin_reporting_output_dir=/scouter
ext_plugin_reporting_application_name=integration
ext_plugin_reporting_excel_export=true

** 수동으로 레포팅 파일 생성시 에러로그 **

[SCOUTER-X] Start Daily Host Report.
[SCOUTER-X] Start Daily Java Report.
[SCOUTER-X] Start Daily Service Report.
org.apache.ibatis.exceptions.PersistenceException:

Error querying database. Cause: java.sql.SQLDataException: The second or third argument of the SUBSTR function is out of range.

The error may exist in scouter-mapper.xml

The error may involve Scouter.ymd

The error occurred while setting parameters

SQL: SELECT A.DAY , A.APP_ID , A.SERVICE_HASH , A.SERVICE_NAME , A.ELAPSED_AVG , A.ELAPSED_MAX , A.SQL_COUNT_AVG , A.SQL_COUNT_MAX , A.SQL_TIME_AVG , A.SQL_TIME_MAX , A.REQUEST_COUNT , A.ERROR_COUNT , A.ELAPSED_EXCEED_COUNT FROM (SELECT MAX(A.DAY) AS DAY , A.APP_ID , A.SERVICE_HASH , MAX(A.SERVICE_NAME) AS SERVICE_NAME , AVG(A.ELAPSED_AVG) AS ELAPSED_AVG , MAX(A.ELAPSED_MAX) AS ELAPSED_MAX , AVG(A.SQL_COUNT_AVG) AS SQL_COUNT_AVG , MAX(A.SQL_COUNT_MAX) AS SQL_COUNT_MAX , AVG(A.SQL_TIME_AVG) AS SQL_TIME_AVG , MAX(A.SQL_TIME_MAX) AS SQL_TIME_MAX , SUM(A.REQUEST_COUNT) AS REQUEST_COUNT , SUM(A.ERROR_COUNT) AS ERROR_COUNT , SUM(A.ELAPSED_EXCEED_COUNT) AS ELAPSED_EXCEED_COUNT FROM (SELECT CASE WHEN MAX(LOG_DT) IS NULL THEN '2021-09-04' ELSE MAX(LOG_DT) END AS DAY , SERVICE_HASH , SUBSTR(MAX(OBJECT_NAME) , LOCATE('/', MAX(OBJECT_NAME), 2) + 1 , ((LOCATE('-', MAX(OBJECT_NAME), LOCATE('/', MAX(OBJECT_NAME), 2) + 1) + 1) - (LOCATE('/', MAX(OBJECT_NAME), 2) + 1) - 1)) AS APP_ID , MAX(SERVICE_NAME) AS SERVICE_NAME , AVG(ELAPSED_AVG) AS ELAPSED_AVG , MAX(ELAPSED_MAX) AS ELAPSED_MAX , AVG(SQL_COUNT_AVG) AS SQL_COUNT_AVG , MAX(SQL_COUNT_MAX) AS SQL_COUNT_MAX , AVG(SQL_TIME_AVG) AS SQL_TIME_AVG , MAX(SQL_TIME_MAX) AS SQL_TIME_MAX , SUM(REQUEST_COUNT) AS REQUEST_COUNT , SUM(ERROR_COUNT) AS ERROR_COUNT , SUM(ELAPSED_EXCEED_COUNT) AS ELAPSED_EXCEED_COUNT FROM SERVICE_5M_04 A JOIN AGENT_INFO_TBL B ON A.OBJECT_HASH = B.OBJECT_HASH WHERE YEAR(LOG_DT) = ? AND MONTH(LOG_DT) = ? GROUP BY OBJECT_NAME, SERVICE_HASH) A GROUP BY A.APP_ID, A.SERVICE_HASH) A ORDER BY REQUEST_COUNT DESC

Cause: java.sql.SQLDataException: The second or third argument of the SUBSTR function is out of range.

    at org.apache.ibatis.exceptions.ExceptionFactory.wrapException(ExceptionFactory.java:30)
    at org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:150)
    at org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:141)
    at scouter.plugin.server.reporting.service.ScouterService.getServiceDaySummary(ScouterService.java:221)
    at scouter.plugin.server.reporting.report.ServiceReport.createExcel(ServiceReport.java:46)
    at scouter.plugin.server.reporting.ReportingPlugin.main(ReportingPlugin.java:1067)

Caused by: java.sql.SQLDataException: The second or third argument of the SUBSTR function is out of range.
at org.apache.derby.client.am.SQLExceptionFactory.getSQLException(Unknown Source)
at org.apache.derby.client.am.SqlException.getSQLException(Unknown Source)
at org.apache.derby.client.am.ClientPreparedStatement.execute(Unknown Source)
at org.apache.ibatis.executor.statement.PreparedStatementHandler.query(PreparedStatementHandler.java:63)
at org.apache.ibatis.executor.statement.RoutingStatementHandler.query(RoutingStatementHandler.java:79)
at org.apache.ibatis.executor.SimpleExecutor.doQuery(SimpleExecutor.java:63)
at org.apache.ibatis.executor.BaseExecutor.queryFromDatabase(BaseExecutor.java:325)
at org.apache.ibatis.executor.BaseExecutor.query(BaseExecutor.java:156)
at org.apache.ibatis.executor.CachingExecutor.query(CachingExecutor.java:109)
at org.apache.ibatis.executor.CachingExecutor.query(CachingExecutor.java:83)
at org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:148)
... 4 more
Caused by: ERROR 22011: The second or third argument of the SUBSTR function is out of range.
at org.apache.derby.client.am.ClientStatement.completeSqlca(Unknown Source)
at org.apache.derby.client.am.ClientStatement.completeOpenQuery(Unknown Source)
at org.apache.derby.client.net.NetStatementReply.parseOpenQueryFailure(Unknown Source)
at org.apache.derby.client.net.NetStatementReply.parseOPNQRYreply(Unknown Source)
at org.apache.derby.client.net.NetStatementReply.readOpenQuery(Unknown Source)
at org.apache.derby.client.net.StatementReply.readOpenQuery(Unknown Source)
at org.apache.derby.client.net.NetStatement.readOpenQuery_(Unknown Source)
at org.apache.derby.client.am.ClientStatement.readOpenQuery(Unknown Source)
at org.apache.derby.client.am.ClientPreparedStatement.flowExecute(Unknown Source)
at org.apache.derby.client.am.ClientPreparedStatement.executeX(Unknown Source)
... 13 more

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions