Apache Fineract集成Pentaho报表报错及403问题咨询(Docker+MariaDB-11)
问题描述
环境
基于Docker部署MariaDB-11运行Apache Fineract。
问题详情
1. Pentaho报表运行报错
触发的错误栈如下:
Caused by: java.sql.SQLNonTransientConnectionException: Socket fail to connect to host:address=(host=fineractmysql)(port=3306)(type=primary). Socket factory failed to initialized with option "socketFactory" set to "com.google.cloud.sql.mysql.SocketFactory" fineract-server_1 | at org.mariadb.jdbc.client.impl.ConnectionHelper.connectSocket(ConnectionHelper.java:137) fineract-server_1 | at org.mariadb.jdbc.client.impl.StandardClient.<init>(StandardClient.java:99) fineract-server_1 | at org.mariadb.jdbc.Driver.connect(Driver.java:70) fineract-server_1 | at org.mariadb.jdbc.Driver.connect(Driver.java:101) fineract-server_1 | at org.mariadb.jdbc.Driver.connect(Driver.java:27) fineract-server_1 | at org.pentaho.reporting.engine.classic.core.modules.misc.datafactory.sql.DriverConnectionProvider.createConnection(DriverConnectionProvider.java:121) fineract-server_1 | at org.pentaho.reporting.engine.classic.core.modules.misc.datafactory.sql.SimpleSQLReportDataFactory.getConnection(SimpleSQLReportDataFactory.java:130) fineract-server_1 | at org.pentaho.reporting.engine.classic.core.modules.misc.datafactory.sql.SimpleSQLReportDataFactory.queryData(SimpleSQLReportDataFactory.java:174) fineract-server_1 | ... 197 common frames omitted fineract-server_1 | Caused by: java.io.IOException: Socket factory failed to initialized with option "socketFactory" set to "com.google.cloud.sql.mysql.SocketFactory" fineract-server_1 | at org.mariadb.jdbc.client.impl.ConnectionHelper.standardSocket(ConnectionHelper.java:100) fineract-server_1 | at org.mariadb.jdbc.client.socket.impl.SocketUtility.lambda$getSocketHandler$0(SocketUtility.java:38) fineract-server_1 | at org.mariadb.jdbc.client.impl.ConnectionHelper.createSocket(ConnectionHelper.java:69) fineract-server_1 | at org.mariadb.jdbc.client.impl.ConnectionHelper.connectSocket(ConnectionHelper.java:124) fineract-server_1 | ... 204 common frames omitted fineract-server_1 | Caused by: java.lang.ClassCastException: class com.google.cloud.sql.mysql.SocketFactory cannot be cast to class javax.net.SocketFactory (com.google.cloud.sql.mysql.SocketFactory is in unnamed module of loader org.springframework.boot.loader.LaunchedURLClassLoader @5e9f23b4; javax.net.SocketFactory is in module java.base of loader 'bootstrap') fineract-server_1 | at org.mariadb.jdbc.client.impl.ConnectionHelper.standardSocket(ConnectionHelper.java:92) fineract-server_1 | ... 207 common frames omitted fineract-server_1 | fineract-server_1 | 2023-09-26 08:57:06.621 -ERROR 8 --- [io-8443-exec-10] i.r.s.PentahoReportingProcessServiceImpl : Pentaho failed fineract-server_1 | fineract-server_1 | org.pentaho.reporting.engine.classic.core.ReportDataFactoryException: Failed to execute query.
2. 客户贷款交易报表导出403错误
返回的错误信息:
{ "developerMessage" : "The request caused a data integrity issue to be fired by the database.", "httpStatusCode" : "403", "defaultUserMessage" : "Pentaho failed: Failed to execute query.", "userMessageGlobalisationCode" : "error.msg.reporting.error", "errors" : [ { "developerMessage" : "Pentaho failed: Failed to execute query.", "defaultUserMessage" : "Pentaho failed: Failed to execute query.", "userMessageGlobalisationCode" : "error.msg.reporting.error", "args" : [ ] } ] }
解决方案
针对SocketFactory类转换错误
- 替换适配的SocketFactory实现
报错核心是MySQL版本的SocketFactory无法适配MariaDB驱动,需改用MariaDB专属的Cloud SQL SocketFactory:将JDBC连接URL中的socketFactory参数值改为com.google.cloud.sql.mariadb.SocketFactory。 - 修正依赖包
检查项目或Docker镜像的依赖,确保引入google-cloud-sql-mariadb-socket-factory包,而非MySQL版本的SocketFactory依赖。 - 调整类加载配置
若存在类加载隔离问题,可在Docker启动命令中通过-Xbootclasspath/a:参数将Cloud SQL SocketFactory的jar包加入系统类加载路径,避免Spring Boot类加载器的隔离限制。
针对导出报表403错误
该403是Pentaho查询失败的连锁结果,解决上述数据库连接问题后,报表查询恢复正常,此错误会自动消失。若仍存在:
- 检查报表使用的数据库用户权限,确保其拥有贷款交易相关表的查询权限。
- 验证报表SQL语句是否存在语法错误或数据过滤逻辑问题,调整后重新测试。
内容的提问来源于stack exchange,提问作者Gauri Shankar Jha
相关产品推荐
相关产品推荐

