{"record":{"id":"94909a1bbe3d8b4a","repo":"YunaiV/ruoyi-vue-pro","slug":"error-while-building-ibatis-sqlsessionfactory","errorCode":null,"errorMessage":"Error while building ibatis SqlSessionFactory: {}","messagePattern":"Error while building ibatis SqlSessionFactory: (.+?)","errorType":"exception","errorClass":"FlowableException","httpStatus":null,"severity":"critical","filePath":"sql/dm/flowable-patch/src/main/java/org/flowable/common/engine/impl/AbstractEngineConfiguration.java","lineNumber":867,"sourceCode":"\n                // set default properties\n                properties.put(\"limitBefore\", \"\");\n                properties.put(\"limitAfter\", \"\");\n                properties.put(\"limitBetween\", \"\");\n                properties.put(\"limitBeforeNativeQuery\", \"\");\n                properties.put(\"limitAfterNativeQuery\", \"\");\n                properties.put(\"blobType\", \"BLOB\");\n                properties.put(\"boolValue\", \"TRUE\");\n\n                if (databaseType != null) {\n                    properties.load(getResourceAsStream(pathToEngineDbProperties()));\n                }\n\n                Configuration configuration = initMybatisConfiguration(environment, reader, properties);\n                sqlSessionFactory = new DefaultSqlSessionFactory(configuration);\n\n            } catch (Exception e) {\n                throw new FlowableException(\"Error while building ibatis SqlSessionFactory: \" + e.getMessage(), e);\n            } finally {\n                IoUtil.closeSilently(inputStream);\n            }\n        } else {\n            // This is needed when the SQL Session Factory is created by another engine.\n            // When custom XML Mappers are registered with this engine they need to be loaded in the configuration as well\n            applyCustomMybatisCustomizations(sqlSessionFactory.getConfiguration());\n        }\n    }\n\n    public String pathToEngineDbProperties() {\n        return \"org/flowable/common/db/properties/\" + databaseType + \".properties\";\n    }\n\n    public Configuration initMybatisConfiguration(Environment environment, Reader reader, Properties properties) {\n        XMLConfigBuilder parser = new XMLConfigBuilder(reader, \"\", properties);\n        Configuration configuration = parser.getConfiguration();\n","sourceCodeStart":849,"sourceCodeEnd":885,"githubUrl":"https://github.com/YunaiV/ruoyi-vue-pro/blob/0418084e222612af2fc1141f566af454f9236ab1/sql/dm/flowable-patch/src/main/java/org/flowable/common/engine/impl/AbstractEngineConfiguration.java#L849-L885","documentation":"Flowable builds the MyBatis (formerly iBatis) SqlSessionFactory by reading the mapper XML and loading a per-dialect properties file (org/flowable/common/db/properties/<databaseType>.properties). Any failure during reading, property loading, or Configuration building is wrapped as FlowableException with the cause message. Common sub-causes: missing properties file for the databaseType, malformed mapper XML, classpath resource not found.","triggerScenarios":"setDatabaseType() set to a value with no matching properties file (e.g. 'dameng' when only 'dm' exists); a custom mapper XML with a syntax error; resource not on classpath in a shaded/fat jar; MyBatis version incompatibility.","commonSituations":"Adding a new DB dialect without shipping the .properties file; building a fat jar that loses flowable mapper resources; upgrading MyBatis to a version with a breaking Configuration API change.","solutions":["Inspect the caused-by exception/message — 'pathToEngineDbProperties' / IOException points to a missing properties file, SAXException to bad mapper XML.","Ensure databaseType matches an existing org/flowable/common/db/properties/<type>.properties on the classpath.","Verify the flowable SQL mapper resources are included (check the shaded jar contents).","Pin a compatible MyBatis version if the cause is a NoSuchMethodError on Configuration."],"exampleFix":"// before: wrong databaseType -> no properties file\ncfg.setDatabaseType(\"dameng\");\n// after: use the key that has a properties resource\ncfg.setDatabaseType(\"dm\");","handlingStrategy":"try-catch","validationCode":"String propsPath = \"org/flowable/common/db/properties/\" + cfg.getDatabaseType() + \".properties\";\nif (getClass().getClassLoader().getResource(propsPath) == null)\n    throw new IllegalStateException(\"Missing Flowable DB properties: \" + propsPath);","typeGuard":"null","tryCatchPattern":"try { engine = cfg.buildProcessEngine(); }\ncatch (FlowableException e) { log.error(\"MyBatis build failed: {}\", e.getMessage(), e); throw e; }","preventionTips":["Match setDatabaseType() to an existing properties file","Verify flowable mapper resources survive shading","Pin a compatible MyBatis version"],"tags":["flowable","mybatis","sqlsessionfactory","configuration"],"backgroundTag":null,"analyzedSha":"0418084e222612af2fc1141f566af454f9236ab1","analyzedAt":"2026-08-14T00:56:18.412Z","schemaVersion":2},"datasetVersion":"2026-08-14T05:17:29.042Z"}