Error creating bean with name 'sqlSessionFactory' defined in ServletContext resource [/WEB-INF/applicationContext.xml]: Invocation of init method failed; nested exception is org.springframework.core.NestedIOException: Failed to parse config resource: class path resource [mybatis-config.xml]; nested exception is org.apache.ibatis.builder.BuilderException: Error parsing SQL Mapper Configuration. Cause: org.apache.ibatis.builder.BuilderException: Error creating document instance. Cause: org.xml.sax.SAXParseException; lineNumber: 21; columnNumber: 10; 元素类型为 "mapper" 的内容必须匹配 "(cache-ref|cache|resultMap*|parameterMap*|sql*|insert*|update*|delete*|select*)+"。
时间: 2024-04-03 20:35:46 浏览: 561
这个错误是由于 Mybatis 的 SQL 映射文件中出现了不符合规则的内容导致的。具体来说,它要求在 `<mapper>` 标签中只能包含一些特定的子标签,例如 `<cache-ref>`、`<cache>`、`<resultMap>`、`<parameterMap>`、`<sql>`、`<insert>`、`<update>`、`<delete>`、`<select>` 等。你需要检查你的 SQL 映射文件,看看是否存在不符合规则的内容,或者是否有遗漏的标签。同时也需要检查你的 Mybatis 配置文件是否正确。
相关问题
Error creating bean with name 'sqlSessionFactory' defined in ServletContext resource [/WEB-INF/applicationContext.xml]: Invocation of init method failed; nested exception is org.springframework.core.NestedIOException: Failed to parse config resource: class path resource [mybatis-config.xml]; nested exception is org.apache.ibatis.builder.BuilderException: Error parsing SQL Mapper Configuration. Cause: java.lang.IllegalArgumentException: Mapped Statements collection already contains value for com.Dao.ConnectMapper.queryConnectById
很抱歉,我是一个语言模型AI,并不是一个具备实际技术能力的人,无法解决你的问题。不过根据你提供的信息,这个错误似乎是因为 SQL Mapper Configuration 中存在重复的 Mapped Statements,你可以检查一下你的配置文件,看看是否有重复的映射语句。如果还无法解决问题,建议你向相关技术社区或者开发者论坛提问,获得更专业的帮助。
.DefaultListableBeanFactory] - Bean creation exception on FactoryBean type check: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'ptUserPrincipalADT' defined in file [/data1/app/version/sms/WEB-INF/classes/gov/cnao/bigdata/dos/osra/modules/auditingofc/dao/PtUserPrincipalADT.class]: Cannot resolve reference to bean 'sqlSessionFactory' while setting bean property 'sqlSessionFactory'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sqlSessionFactory' defined in file [/data1/app/version/sms/WEB-INF/classes/spring-context.xml]: Cannot resolve reference to bean 'dataSourceSwitcher' while setting bean property 'dataSource'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dataSourceSwitcher' defined in file [/data1/app/version/sms/WEB-INF/classes/spring-context.xml]: Cannot resolve reference to bean 'dataSourceDpm' while setting bean property 'defaultTargetDataSource'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dataSourceDpm' defined in file [/data1/app/version/sms/WEB-INF/classes/spring-context.xml]: Invocation of init method failed; nested exception is java.lang.IllegalArgumentException: Failed to decrypt
这是一个关于 Spring Framework 和数据库连接的错误信息,其中涉及了数据源、SessionFactory 等概念。具体来说,这段错误信息是因为在创建名为 'ptUserPrincipalADT' 的 Bean 时,无法解析对名为 'sqlSessionFactory' 的 Bean 的引用,在设置 'sqlSessionFactory' 属性时发生了错误。而 'sqlSessionFactory' 又依赖于名为 'dataSourceSwitcher' 的 Bean,它的 'dataSource' 属性又依赖于名为 'dataSourceDpm' 的 Bean。而在创建 'dataSourceDpm' Bean 时,调用了一个 init 方法失败,导致了这个错误。最后的错误信息表明了解密失败。
阅读全文