大家好,又见面了,我是你们的朋友全栈君。
报错为:Invocation of init method failed; nested exception is java.lang.IllegalArgumentException: Property ‘sqlSessionFactory’ or ‘sqlSessionTemplate’ are required
日志很长,报错在末尾
2018-07-12 13:56:41.760 INFO 9476 — [ main] org.apache.catalina.core.StandardEngine : Starting Servlet Engine: Apache Tomcat/8.5.16
2018-07-12 13:56:42.040 INFO 9476 — [ost-startStop-1] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring embedded WebApplicationContext
2018-07-12 13:56:42.041 INFO 9476 — [ost-startStop-1] o.s.web.context.ContextLoader : Root WebApplicationContext: initialization completed in 4259 ms
2018-07-12 13:56:42.057 WARN 9476 — [ost-startStop-1] o.s.b.f.s.DefaultListableBeanFactory : Bean creation exception on non-lazy FactoryBean type check: org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘*****OrderMapper’ defined in file [E:\GIT_workspace\inas-***-server\target\classes\com\****\***\***\dao\*****OrderMapper.class]: Invocation of init method failed; nested exception is java.lang.IllegalArgumentException: Property ‘sqlSessionFactory’ or ‘sqlSessionTemplate’ are required
2018-07-12 13:56:42.061 WARN 9476 — [ost-startStop-1] o.s.b.f.s.DefaultListableBeanFactory : Bean creation exception on non-lazy FactoryBean type check: org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘*****OrderMapper’ defined in file [E:\GIT_workspace\inas-***-server\target\classes\com\****\***\***\dao\*****OrderMapper.class]: Invocation of init method failed; nested exception is java.lang.IllegalArgumentException: Property ‘sqlSessionFactory’ or ‘sqlSessionTemplate’ are required
2018-07-12 13:56:42.096 WARN 9476 — [ost-startStop-1] o.s.b.f.s.DefaultListableBeanFactory : Bean creation exception on non-lazy FactoryBean type check: org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘*****OrderMapper’ defined in file [E:\GIT_workspace\inas-***-server\target\classes\com\****\***\***\dao\*****OrderMapper.class]: Invocation of init method failed; nested exception is java.lang.IllegalArgumentException: Property ‘sqlSessionFactory’ or ‘sqlSessionTemplate’ are required
2018-07-12 13:56:42.101 WARN 9476 — [ost-startStop-1] o.s.b.f.s.DefaultListableBeanFactory : Bean creation exception on non-lazy FactoryBean type check: org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘*****OrderMapper’ defined in file [E:\GIT_workspace\inas-***-server\target\classes\com\****\***\***\dao\*****OrderMapper.class]: Invocation of init method failed; nested exception is java.lang.IllegalArgumentException: Property ‘sqlSessionFactory’ or ‘sqlSessionTemplate’ are required
2018-07-12 13:56:42.163 WARN 9476 — [ost-startStop-1] o.s.b.f.s.DefaultListableBeanFactory : Bean creation exception on non-lazy FactoryBean type check: org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘*****OrderMapper’ defined in file [E:\GIT_workspace\inas-***-server\target\classes\com\****\***\***\dao\*****OrderMapper.class]: Invocation of init method failed; nested exception is java.lang.IllegalArgumentException: Property ‘sqlSessionFactory’ or ‘sqlSessionTemplate’ are required
2018-07-12 13:56:42.168 WARN 9476 — [ost-startStop-1] o.s.b.f.s.DefaultListableBeanFactory : Bean creation exception on non-lazy FactoryBean type check: org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘*****OrderMapper’ defined in file [E:\GIT_workspace\inas-***-server\target\classes\com\****\***\***\dao\*****OrderMapper.class]: Invocation of init method failed; nested exception is java.lang.IllegalArgumentException: Property ‘sqlSessionFactory’ or ‘sqlSessionTemplate’ are required
2018-07-12 13:56:42.394 INFO 9476 — [ost-startStop-1] o.s.b.w.servlet.ServletRegistrationBean : Mapping servlet: ‘dispatcherServlet’ to [/]
2018-07-12 13:56:42.402 INFO 9476 — [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean : Mapping filter: ‘characterEncodingFilter’ to: [/*]
2018-07-12 13:56:42.402 INFO 9476 — [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean : Mapping filter: ‘hiddenHttpMethodFilter’ to: [/*]
2018-07-12 13:56:42.403 INFO 9476 — [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean : Mapping filter: ‘httpPutFormContentFilter’ to: [/*]
2018-07-12 13:56:42.403 INFO 9476 — [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean : Mapping filter: ‘requestContextFilter’ to: [/*]
2018-07-12 13:56:42.459 WARN 9476 — [ main] o.s.b.f.s.DefaultListableBeanFactory : Bean creation exception on non-lazy FactoryBean type check: org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘*****OrderMapper’ defined in file [E:\GIT_workspace\inas-***-server\target\classes\com\****\***\***\dao\*****OrderMapper.class]: Invocation of init method failed; nested exception is java.lang.IllegalArgumentException: Property ‘sqlSessionFactory’ or ‘sqlSessionTemplate’ are required
2018-07-12 13:56:42.471 WARN 9476 — [ main] o.s.b.f.s.DefaultListableBeanFactory : Bean creation exception on non-lazy FactoryBean type check: org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘*****OrderMapper’ defined in file [E:\GIT_workspace\inas-***-server\target\classes\com\****\***\***\dao\*****OrderMapper.class]: Invocation of init method failed; nested exception is java.lang.IllegalArgumentException: Property ‘sqlSessionFactory’ or ‘sqlSessionTemplate’ are required
2018-07-12 13:56:42.476 WARN 9476 — [ main] o.s.b.f.s.DefaultListableBeanFactory : Bean creation exception on non-lazy FactoryBean type check: org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘*****OrderMapper’ defined in file [E:\GIT_workspace\inas-***-server\target\classes\com\****\***\***\dao\*****OrderMapper.class]: Invocation of init method failed; nested exception is java.lang.IllegalArgumentException: Property ‘sqlSessionFactory’ or ‘sqlSessionTemplate’ are required
2018-07-12 13:56:42.481 WARN 9476 — [ main] o.s.b.f.s.DefaultListableBeanFactory : Bean creation exception on non-lazy FactoryBean type check: org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘*****OrderMapper’ defined in file [E:\GIT_workspace\inas-***-server\target\classes\com\****\***\***\dao\*****OrderMapper.class]: Invocation of init method failed; nested exception is java.lang.IllegalArgumentException: Property ‘sqlSessionFactory’ or ‘sqlSessionTemplate’ are required
2018-07-12 13:56:42.485 WARN 9476 — [ main] o.s.b.f.s.DefaultListableBeanFactory : Bean creation exception on non-lazy FactoryBean type check: org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘*****OrderMapper’ defined in file [E:\GIT_workspace\inas-***-server\target\classes\com\****\***\***\dao\*****OrderMapper.class]: Invocation of init method failed; nested exception is java.lang.IllegalArgumentException: Property ‘sqlSessionFactory’ or ‘sqlSessionTemplate’ are required
2018-07-12 13:56:42.548 WARN 9476 — [ main] o.s.b.f.s.DefaultListableBeanFactory : Bean creation exception on non-lazy FactoryBean type check: org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘*****OrderMapper’ defined in file [E:\GIT_workspace\inas-***-server\target\classes\com\****\***\***\dao\*****OrderMapper.class]: Invocation of init method failed; nested exception is java.lang.IllegalArgumentException: Property ‘sqlSessionFactory’ or ‘sqlSessionTemplate’ are required
2018-07-12 13:56:42.557 WARN 9476 — [ main] o.s.b.f.s.DefaultListableBeanFactory : Bean creation exception on non-lazy FactoryBean type check: org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘*****OrderMapper’ defined in file [E:\GIT_workspace\inas-***-server\target\classes\com\****\***\***\dao\*****OrderMapper.class]: Invocation of init method failed; nested exception is java.lang.IllegalArgumentException: Property ‘sqlSessionFactory’ or ‘sqlSessionTemplate’ are required
2018-07-12 13:56:42.564 WARN 9476 — [ main] o.s.b.f.s.DefaultListableBeanFactory : Bean creation exception on non-lazy FactoryBean type check: org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘*****OrderMapper’ defined in file [E:\GIT_workspace\inas-***-server\target\classes\com\****\***\***\dao\*****OrderMapper.class]: Invocation of init method failed; nested exception is java.lang.IllegalArgumentException: Property ‘sqlSessionFactory’ or ‘sqlSessionTemplate’ are required
2018-07-12 13:56:42.570 WARN 9476 — [ main] o.s.b.f.s.DefaultListableBeanFactory : Bean creation exception on non-lazy FactoryBean type check: org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘*****OrderMapper’ defined in file [E:\GIT_workspace\inas-***-server\target\classes\com\****\***\***\dao\*****OrderMapper.class]: Invocation of init method failed; nested exception is java.lang.IllegalArgumentException: Property ‘sqlSessionFactory’ or ‘sqlSessionTemplate’ are required
2018-07-12 13:56:42.577 WARN 9476 — [ main] o.s.b.f.s.DefaultListableBeanFactory : Bean creation exception on non-lazy FactoryBean type check: org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘*****OrderMapper’ defined in file [E:\GIT_workspace\inas-***-server\target\classes\com\****\***\***\dao\*****OrderMapper.class]: Invocation of init method failed; nested exception is java.lang.IllegalArgumentException: Property ‘sqlSessionFactory’ or ‘sqlSessionTemplate’ are required
2018-07-12 13:56:42.581 WARN 9476 — [ main] o.s.b.f.s.DefaultListableBeanFactory : Bean creation exception on non-lazy FactoryBean type check: org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘*****OrderMapper’ defined in file [E:\GIT_workspace\inas-***-server\target\classes\com\****\***\***\dao\*****OrderMapper.class]: Invocation of init method failed; nested exception is java.lang.IllegalArgumentException: Property ‘sqlSessionFactory’ or ‘sqlSessionTemplate’ are required
2018-07-12 13:56:43.603 WARN 9476 — [ main] o.s.b.f.s.DefaultListableBeanFactory : Bean creation exception on non-lazy FactoryBean type check: org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘*****OrderMapper’ defined in file [E:\GIT_workspace\inas-***-server\target\classes\com\****\***\***\dao\*****OrderMapper.class]: Invocation of init method failed; nested exception is java.lang.IllegalArgumentException: Property ‘sqlSessionFactory’ or ‘sqlSessionTemplate’ are required
2018-07-12 13:56:43.606 WARN 9476 — [ main] o.s.b.f.s.DefaultListableBeanFactory : Bean creation exception on non-lazy FactoryBean type check: org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘*****OrderMapper’ defined in file [E:\GIT_workspace\inas-***-server\target\classes\com\****\***\***\dao\*****OrderMapper.class]: Invocation of init method failed; nested exception is java.lang.IllegalArgumentException: Property ‘sqlSessionFactory’ or ‘sqlSessionTemplate’ are required
2018-07-12 13:56:43.612 WARN 9476 — [ main] o.s.b.f.s.DefaultListableBeanFactory : Bean creation exception on non-lazy FactoryBean type check: org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘*****OrderMapper’ defined in file [E:\GIT_workspace\inas-***-server\target\classes\com\****\***\***\dao\*****OrderMapper.class]: Invocation of init method failed; nested exception is java.lang.IllegalArgumentException: Property ‘sqlSessionFactory’ or ‘sqlSessionTemplate’ are required
2018-07-12 13:56:43.622 WARN 9476 — [ main] o.s.b.f.s.DefaultListableBeanFactory : Bean creation exception on non-lazy FactoryBean type check: org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘*****OrderMapper’ defined in file [E:\GIT_workspace\inas-***-server\target\classes\com\****\***\***\dao\*****OrderMapper.class]: Invocation of init method failed; nested exception is java.lang.IllegalArgumentException: Property ‘sqlSessionFactory’ or ‘sqlSessionTemplate’ are required
2018-07-12 13:56:43.623 WARN 9476 — [ main] o.s.b.f.s.DefaultListableBeanFactory : Bean creation exception on non-lazy FactoryBean type check: org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘*****OrderMapper’ defined in file [E:\GIT_workspace\inas-***-server\target\classes\com\****\***\***\dao\*****OrderMapper.class]: Invocation of init method failed; nested exception is java.lang.IllegalArgumentException: Property ‘sqlSessionFactory’ or ‘sqlSessionTemplate’ are required
2018-07-12 13:56:43.625 WARN 9476 — [ main] o.s.b.f.s.DefaultListableBeanFactory : Bean creation exception on non-lazy FactoryBean type check: org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘*****OrderMapper’ defined in file [E:\GIT_workspace\inas-***-server\target\classes\com\****\***\***\dao\*****OrderMapper.class]: Invocation of init method failed; nested exception is java.lang.IllegalArgumentException: Property ‘sqlSessionFactory’ or ‘sqlSessionTemplate’ are required
2018-07-12 13:56:43.637 WARN 9476 — [ main] o.s.b.f.s.DefaultListableBeanFactory : Bean creation exception on non-lazy FactoryBean type check: org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘*****OrderMapper’ defined in file [E:\GIT_workspace\inas-***-server\target\classes\com\****\***\***\dao\*****OrderMapper.class]: Invocation of init method failed; nested exception is java.lang.IllegalArgumentException: Property ‘sqlSessionFactory’ or ‘sqlSessionTemplate’ are required
2018-07-12 13:56:43.647 WARN 9476 — [ main] o.s.b.f.s.DefaultListableBeanFactory : Bean creation exception on non-lazy FactoryBean type check: org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘*****OrderMapper’ defined in file [E:\GIT_workspace\inas-***-server\target\classes\com\****\***\***\dao\*****OrderMapper.class]: Invocation of init method failed; nested exception is java.lang.IllegalArgumentException: Property ‘sqlSessionFactory’ or ‘sqlSessionTemplate’ are required
2018-07-12 13:56:43.653 WARN 9476 — [ main] o.s.b.f.s.DefaultListableBeanFactory : Bean creation exception on non-lazy FactoryBean type check: org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘*****OrderMapper’ defined in file [E:\GIT_workspace\inas-***-server\target\classes\com\****\***\***\dao\*****OrderMapper.class]: Invocation of init method failed; nested exception is java.lang.IllegalArgumentException: Property ‘sqlSessionFactory’ or ‘sqlSessionTemplate’ are required
2018-07-12 13:56:43.655 WARN 9476 — [ main] ationConfigEmbeddedWebApplicationContext : Exception encountered during context initialization – cancelling refresh attempt: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name ‘brokenOrderMsgListener’: Unsatisfied dependency expressed through field ‘orderManager’; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘orderManager’: Injection of resource dependencies failed; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type ‘org.apache.ibatis.session.SqlSessionFactory’ available: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations: {@org.springframework.beans.factory.annotation.Qualifier(value=sqlSessionFactory)}
Related cause: org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘*****OrderMapper’ defined in file [E:\GIT_workspace\inas-***-server\target\classes\com\****\***\***\dao\*****OrderMapper.class]: Invocation of init method failed; nested exception is java.lang.IllegalArgumentException: Property ‘sqlSessionFactory’ or ‘sqlSessionTemplate’ are required
Related cause: org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘*****OrderMapper’ defined in file [E:\GIT_workspace\inas-***-server\target\classes\com\****\***\***\dao\*****OrderMapper.class]: Invocation of init method failed; nested exception is java.lang.IllegalArgumentException: Property ‘sqlSessionFactory’ or ‘sqlSessionTemplate’ are required
2018-07-12 13:56:43.658 INFO 9476 — [ main] o.apache.catalina.core.StandardService : Stopping service [Tomcat]
2018-07-12 13:56:43.693 INFO 9476 — [ main] utoConfigurationReportLoggingInitializer :
Error starting ApplicationContext. To display the auto-configuration report re-run your application with ‘debug’ enabled.
2018-07-12 13:56:43.804 ERROR 9476 — [ main] o.s.b.d.LoggingFailureAnalysisReporter :***************************
APPLICATION FAILED TO START
***************************
Description:
Field orderManager in com.****.***.***.listener.MsgListener required a bean of type ‘org.apache.ibatis.session.SqlSessionFactory’ that could not be found.
Action:Consider defining a bean of type ‘org.apache.ibatis.session.SqlSessionFactory’ in your configuration.
Consider defining a bean of type ‘org.apache.ibatis.session.SqlSessionFactory’ in your configuration.
1.缺少jar包引起
<dependency>
<groupId>org.mybatis.spring.boot</groupId>
<artifactId>mybatis-spring-boot-starter</artifactId>
<version>1.3.2</version>
</dependency>
引入jar包后问题解决
2.未解决再添加(DaoImpl
extends SqlSessionDaoSupport )
import org.mybatis.spring.support.SqlSessionDaoSupport;
@Override
@Resource
public void setSqlSessionFactory(@Qualifier("sqlSessionFactory")SqlSessionFactory sqlSessionFactory){
super.setSqlSessionFactory(sqlSessionFactory);
}
发布者:全栈程序员-用户IM,转载请注明出处:https://javaforall.cn/138698.html原文链接:https://javaforall.cn
【正版授权,激活自己账号】: Jetbrains全家桶Ide使用,1年售后保障,每天仅需1毛
【官方授权 正版激活】: 官方授权 正版激活 支持Jetbrains家族下所有IDE 使用个人JB账号...