//这是spring-mybatis配置文件
<?xml version="1.0" encoding="UTF-8"?>
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:context="http://www.springframework.org/schema/context"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context.xsd">
<!-- 开启注解配置 -->
<context:annotation-config />
<!-- 把SqlSessionFactory交给spring管理 -->
<bean id="sqlSessionFactory" class="org.mybatis.spring.SqlSessionFactoryBean">
<!-- 注入数据源 -->
<property name="dataSource" ref="dataSource"/>
<!-- 注入mybatis配置文件路径 -->
<property name="configLocation" value="classpath:mybatis-config.xml" />
<!-- 注入映射文件 mapper/*.xml -->
<property name="mapperLocations" value="classpath:com/zznode/qoe/task/mapper/*.xml"></property>
</bean>
<context:property-placeholder location="classpath:db.properties" ignore-unresolvable="true"/>
<bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close">
<property name="driverClassName" value="${jdbc.driver}" />
<property name="url" value="${jdbc.url}" />
<property name="username" value="${jdbc.username}" />
<property name="password" value="${jdbc.password}" />
<!--initialSize: 初始化连接-->
<property name="initialSize" value="5"/>
<!--maxIdle: 最大空闲连接-->
<property name="maxIdle" value="10"/>
<!--minIdle: 最小空闲连接-->
<property name="minIdle" value="5"/>
<!--maxActive: 最大连接数量-->
<property name="maxActive" value="50"/>
<!--removeAbandoned: 是否自动回收超时连接-->
<property name="removeAbandoned" value="true"/>
<!--removeAbandonedTimeout: 超时时间(以秒数为单位)-->
<property name="removeAbandonedTimeout" value="300"/>
<!--maxWait: 超时等待时间以毫秒为单位 6000毫秒/1000等于60秒-->
<property name="maxWait" value="3000"/>
<property name="validationQuery" value="SELECT 1" />
<property name="testOnBorrow" value="true"/>
</bean>
<!-- 事务管理 transaction manager, use JtaTransactionManager for global tx -->
<bean id="transactionManager" class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
<property name="dataSource" ref="dataSource" />
</bean>
<!-- 配置事务拦截器和传播属性 -->
<bean id="transactionInterceptor"
class="org.springframework.transaction.interceptor.TransactionInterceptor">
<property name="transactionManager" ref="transactionManager" />
<property name="transactionAttributes">
<props>
<prop key="get*">PROPAGATION_REQUIRED,readOnly</prop>
<prop key="list*">PROPAGATION_REQUIRED,readOnly</prop>
<prop key="find*">PROPAGATION_REQUIRED,readOnly</prop>
<prop key="load*">PROPAGATION_REQUIRED,readOnly</prop>
<prop key="query*">PROPAGATION_REQUIRED,readOnly</prop>
<prop key="save*">PROPAGATION_REQUIRED</prop>
<prop key="submit*">PROPAGATION_REQUIRED</prop>
<prop key="create*">PROPAGATION_REQUIRED,-Exception</prop>
<prop key="insert*">PROPAGATION_REQUIRED,-Exception</prop>
<prop key="update*">PROPAGATION_REQUIRED,-Exception</prop>
<prop key="modify*">PROPAGATION_REQUIRED,-Exception</prop>
<prop key="delete*">PROPAGATION_REQUIRED,-Exception</prop>
<prop key="remove*">PROPAGATION_REQUIRED,-Exception</prop>
<prop key="do*">PROPAGATION_REQUIRED</prop>
<prop key="execute*">PROPAGATION_REQUIRED</prop>
<prop key="exe*">PROPAGATION_REQUIRED</prop>
<prop key="backup">PROPAGATION_REQUIRED,-Exception</prop>
<prop key="rollback">PROPAGATION_REQUIRED,-Exception</prop>
<prop key="calculate">PROPAGATION_REQUIRED,-Exception</prop>
<prop key="batchInsert">PROPAGATION_REQUIRED,-Exception</prop>
<prop key="batchUpdate">PROPAGATION_REQUIRED,-Exception</prop>
</props>
</property>
</bean>
<!-- Mapper接口所在包名,Spring会自动查找其下的Mapper 不用再配置mapper扫描-->
<bean class="org.mybatis.spring.mapper.MapperScannerConfigurer">
<property name="basePackage" value="com.zznode.qoe.task.mapper" />
<property name="sqlSessionFactoryBeanName" value="sqlSessionFactory"/>
</bean>
报错如下:
01-Apr-2019 10:56:58.839 淇℃伅 [RMI TCP Connection(2)-127.0.0.1] org.apache.jasper.servlet.TldScanner.scanJars At least one JAR was scanned for TLDs yet contained no TLDs. Enable debug logging for this logger for a complete list of JARs that were scanned but no TLDs were found in them. Skipping unneeded JARs during scanning can improve startup time and JSP compilation time.
01-Apr-2019 10:56:58.930 淇℃伅 [RMI TCP Connection(2)-127.0.0.1] org.springframework.web.context.ContextLoader.initWebApplicationContext Root WebApplicationContext: initialization started
01-Apr-2019 10:56:59.219 淇℃伅 [RMI TCP Connection(2)-127.0.0.1] org.springframework.web.context.support.XmlWebApplicationContext.prepareRefresh Refreshing Root WebApplicationContext: startup date [Mon Apr 01 10:56:59 CST 2019]; root of context hierarchy
01-Apr-2019 10:56:59.324 淇℃伅 [RMI TCP Connection(2)-127.0.0.1] org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions Loading XML bean definitions from class path resource [spring.xml]
01-Apr-2019 10:56:59.632 淇℃伅 [RMI TCP Connection(2)-127.0.0.1] org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions Loading XML bean definitions from class path resource [spring-mybatis.xml]
01-Apr-2019 10:56:59.682 淇℃伅 [RMI TCP Connection(2)-127.0.0.1] org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions Loading XML bean definitions from class path resource [jobs.xml]
01-Apr-2019 10:57:00.297 淇℃伅 [RMI TCP Connection(2)-127.0.0.1] org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions Loading XML bean definitions from class path resource [spring-mybatis.xml]
01-Apr-2019 10:57:00.694 璀﹀憡 [RMI TCP Connection(2)-127.0.0.1] org.mybatis.spring.mapper.ClassPathMapperScanner.checkCandidate Skipping MapperFactoryBean with name 'mtMonitorServerInfoMapper' and 'com.zznode.qoe.task.mapper.MtMonitorServerInfoMapper' mapperInterface. Bean already defined with the same name!
01-Apr-2019 10:57:00.697 璀﹀憡 [RMI TCP Connection(2)-127.0.0.1] org.mybatis.spring.mapper.ClassPathMapperScanner.checkCandidate Skipping MapperFactoryBean with name 'mtServerAlarmMapper' and 'com.zznode.qoe.task.mapper.MtServerAlarmMapper' mapperInterface. Bean already defined with the same name!
01-Apr-2019 10:57:00.697 璀﹀憡 [RMI TCP Connection(2)-127.0.0.1] org.mybatis.spring.mapper.ClassPathMapperScanner.checkCandidate Skipping MapperFactoryBean with name 'newTbResultMapper' and 'com.zznode.qoe.task.mapper.NewTbResultMapper' mapperInterface. Bean already defined with the same name!
01-Apr-2019 10:57:00.698 璀﹀憡 [RMI TCP Connection(2)-127.0.0.1] org.mybatis.spring.mapper.ClassPathMapperScanner.checkCandidate Skipping MapperFactoryBean with name 'sysAuthInfoMapper' and 'com.zznode.qoe.task.mapper.SysAuthInfoMapper' mapperInterface. Bean already defined with the same name!
01-Apr-2019 10:57:00.703 璀﹀憡 [RMI TCP Connection(2)-127.0.0.1] org.mybatis.spring.mapper.ClassPathMapperScanner.checkCandidate Skipping MapperFactoryBean with name 'sysMailUserInfoMapper' and 'com.zznode.qoe.task.mapper.SysMailUserInfoMapper' mapperInterface. Bean already defined with the same name!
01-Apr-2019 10:57:00.706 璀﹀憡 [RMI TCP Connection(2)-127.0.0.1] org.mybatis.spring.mapper.ClassPathMapperScanner.checkCandidate Skipping MapperFactoryBean with name 'sysMonitorServerAttrMapper' and 'com.zznode.qoe.task.mapper.SysMonitorServerAttrMapper' mapperInterface. Bean already defined with the same name!
01-Apr-2019 10:57:00.707 璀﹀憡 [RMI TCP Connection(2)-127.0.0.1] org.mybatis.spring.mapper.ClassPathMapperScanner.checkCandidate Skipping MapperFactoryBean with name 'sysMonitorServerMapper' and 'com.zznode.qoe.task.mapper.SysMonitorServerMapper' mapperInterface. Bean already defined with the same name!
01-Apr-2019 10:57:00.708 璀﹀憡 [RMI TCP Connection(2)-127.0.0.1] org.mybatis.spring.mapper.ClassPathMapperScanner.checkCandidate Skipping MapperFactoryBean with name 'tbBssUserMapper' and 'com.zznode.qoe.task.mapper.TbBssUserMapper' mapperInterface. Bean already defined with the same name!
01-Apr-2019 10:57:00.708 璀﹀憡 [RMI TCP Connection(2)-127.0.0.1] org.mybatis.spring.mapper.ClassPathMapperScanner.checkCandidate Skipping MapperFactoryBean with name 'tbCbssUserMapper' and 'com.zznode.qoe.task.mapper.TbCbssUserMapper' mapperInterface. Bean already defined with the same name!
01-Apr-2019 10:57:00.708 璀﹀憡 [RMI TCP Connection(2)-127.0.0.1] org.mybatis.spring.mapper.ClassPathMapperScanner.checkCandidate Skipping MapperFactoryBean with name 'tbDistributionMapper' and 'com.zznode.qoe.task.mapper.TbDistributionMapper' mapperInterface. Bean already defined with the same name!
01-Apr-2019 10:57:00.709 璀﹀憡 [RMI TCP Connection(2)-127.0.0.1] org.mybatis.spring.mapper.ClassPathMapperScanner.checkCandidate Skipping MapperFactoryBean with name 'tbresultMapper' and 'com.zznode.qoe.task.mapper.TbresultMapper' mapperInterface. Bean already defined with the same name!
01-Apr-2019 10:57:00.709 璀﹀憡 [RMI TCP Connection(2)-127.0.0.1] org.mybatis.spring.mapper.ClassPathMapperScanner.checkCandidate Skipping MapperFactoryBean with name 'tbSpeedUserCountMapper' and 'com.zznode.qoe.task.mapper.TbSpeedUserCountMapper' mapperInterface. Bean already defined with the same name!
01-Apr-2019 10:57:00.710 璀﹀憡 [RMI TCP Connection(2)-127.0.0.1] org.mybatis.spring.mapper.ClassPathMapperScanner.checkCandidate Skipping MapperFactoryBean with name 'tbUploadFileInfoMapper' and 'com.zznode.qoe.task.mapper.TbUploadFileInfoMapper' mapperInterface. Bean already defined with the same name!
01-Apr-2019 10:57:00.711 璀﹀憡 [RMI TCP Connection(2)-127.0.0.1] org.mybatis.spring.mapper.ClassPathMapperScanner.checkCandidate Skipping MapperFactoryBean with name 'tbWordbookMapper' and 'com.zznode.qoe.task.mapper.TbWordbookMapper' mapperInterface. Bean already defined with the same name!
01-Apr-2019 10:57:00.711 璀﹀憡 [RMI TCP Connection(2)-127.0.0.1] org.mybatis.spring.mapper.ClassPathMapperScanner.doScan No MyBatis mapper was found in '[com.zznode.qoe.task.mapper]' package. Please check your configuration.
01-Apr-2019 10:57:00.745 淇℃伅 [RMI TCP Connection(2)-127.0.0.1] org.springframework.context.support.PropertySourcesPlaceholderConfigurer.loadProperties Loading properties file from class path resource [db.properties]
01-Apr-2019 10:57:00.760 淇℃伅 [RMI TCP Connection(2)-127.0.0.1] org.springframework.context.support.PropertySourcesPlaceholderConfigurer.loadProperties Loading properties file from class path resource [config.properties]
01-Apr-2019 10:57:00.767 淇℃伅 [RMI TCP Connection(2)-127.0.0.1] org.springframework.context.support.PropertySourcesPlaceholderConfigurer.loadProperties Loading properties file from class path resource [db.properties]
01-Apr-2019 10:57:00.929 淇℃伅 [RMI TCP Connection(2)-127.0.0.1] org.springframework.context.support.PostProcessorRegistrationDelegate$BeanPostProcessorChecker.postProcessAfterInitialization Bean 'dataSource' of type [class org.apache.commons.dbcp.BasicDataSource] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
01-Apr-2019 10:57:01.671 淇℃伅 [RMI TCP Connection(2)-127.0.0.1] org.springframework.context.support.PostProcessorRegistrationDelegate$BeanPostProcessorChecker.postProcessAfterInitialization Bean 'sqlSessionFactory' of type [class org.mybatis.spring.SqlSessionFactoryBean] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
01-Apr-2019 10:57:01.672 淇℃伅 [RMI TCP Connection(2)-127.0.0.1] org.springframework.context.support.PostProcessorRegistrationDelegate$BeanPostProcessorChecker.postProcessAfterInitialization Bean 'sqlSessionFactory' of type [class org.apache.ibatis.session.defaults.DefaultSqlSessionFactory] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
01-Apr-2019 10:57:01.684 淇℃伅 [RMI TCP Connection(2)-127.0.0.1] org.springframework.context.support.PostProcessorRegistrationDelegate$BeanPostProcessorChecker.postProcessAfterInitialization Bean 'mtMonitorServerInfoMapper' of type [class org.mybatis.spring.mapper.MapperFactoryBean] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
01-Apr-2019 10:57:01.686 淇℃伅 [RMI TCP Connection(2)-127.0.0.1] org.springframework.context.support.PostProcessorRegistrationDelegate$BeanPostProcessorChecker.postProcessAfterInitialization Bean 'mtServerAlarmMapper' of type [class org.mybatis.spring.mapper.MapperFactoryBean] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
01-Apr-2019 10:57:01.688 淇℃伅 [RMI TCP Connection(2)-127.0.0.1] org.springframework.context.support.PostProcessorRegistrationDelegate$BeanPostProcessorChecker.postProcessAfterInitialization Bean 'newTbResultMapper' of type [class org.mybatis.spring.mapper.MapperFactoryBean] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
01-Apr-2019 10:57:01.691 淇℃伅 [RMI TCP Connection(2)-127.0.0.1] org.springframework.context.support.PostProcessorRegistrationDelegate$BeanPostProcessorChecker.postProcessAfterInitialization Bean 'sysAuthInfoMapper' of type [class org.mybatis.spring.mapper.MapperFactoryBean] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
01-Apr-2019 10:57:01.694 淇℃伅 [RMI TCP Connection(2)-127.0.0.1] org.springframework.context.support.PostProcessorRegistrationDelegate$BeanPostProcessorChecker.postProcessAfterInitialization Bean 'sysMailUserInfoMapper' of type [class org.mybatis.spring.mapper.MapperFactoryBean] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
01-Apr-2019 10:57:01.695 淇℃伅 [RMI TCP Connection(2)-127.0.0.1] org.springframework.context.support.PostProcessorRegistrationDelegate$BeanPostProcessorChecker.postProcessAfterInitialization Bean 'sysMonitorServerAttrMapper' of type [class org.mybatis.spring.mapper.MapperFactoryBean] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
01-Apr-2019 10:57:01.697 淇℃伅 [RMI TCP Connection(2)-127.0.0.1] org.springframework.context.support.PostProcessorRegistrationDelegate$BeanPostProcessorChecker.postProcessAfterInitialization Bean 'sysMonitorServerMapper' of type [class org.mybatis.spring.mapper.MapperFactoryBean] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
01-Apr-2019 10:57:01.699 淇℃伅 [RMI TCP Connection(2)-127.0.0.1] org.springframework.context.support.PostProcessorRegistrationDelegate$BeanPostProcessorChecker.postProcessAfterInitialization Bean 'tbBssUserMapper' of type [class org.mybatis.spring.mapper.MapperFactoryBean] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
01-Apr-2019 10:57:01.703 淇℃伅 [RMI TCP Connection(2)-127.0.0.1] org.springframework.context.support.PostProcessorRegistrationDelegate$BeanPostProcessorChecker.postProcessAfterInitialization Bean 'tbCbssUserMapper' of type [class org.mybatis.spring.mapper.MapperFactoryBean] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
01-Apr-2019 10:57:01.707 淇℃伅 [RMI TCP Connection(2)-127.0.0.1] org.springframework.context.support.PostProcessorRegistrationDelegate$BeanPostProcessorChecker.postProcessAfterInitialization Bean 'tbDistributionMapper' of type [class org.mybatis.spring.mapper.MapperFactoryBean] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
01-Apr-2019 10:57:01.710 淇℃伅 [RMI TCP Connection(2)-127.0.0.1] org.springframework.context.support.PostProcessorRegistrationDelegate$BeanPostProcessorChecker.postProcessAfterInitialization Bean 'tbresultMapper' of type [class org.mybatis.spring.mapper.MapperFactoryBean] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
01-Apr-2019 10:57:01.714 淇℃伅 [RMI TCP Connection(2)-127.0.0.1] org.springframework.context.support.PostProcessorRegistrationDelegate$BeanPostProcessorChecker.postProcessAfterInitialization Bean 'tbSpeedUserCountMapper' of type [class org.mybatis.spring.mapper.MapperFactoryBean] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
01-Apr-2019 10:57:01.715 淇℃伅 [RMI TCP Connection(2)-127.0.0.1] org.springframework.context.support.PostProcessorRegistrationDelegate$BeanPostProcessorChecker.postProcessAfterInitialization Bean 'tbUploadFileInfoMapper' of type [class org.mybatis.spring.mapper.MapperFactoryBean] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
01-Apr-2019 10:57:01.717 淇℃伅 [RMI TCP Connection(2)-127.0.0.1] org.springframework.context.support.PostProcessorRegistrationDelegate$BeanPostProcessorChecker.postProcessAfterInitialization Bean 'tbWordbookMapper' of type [class org.mybatis.spring.mapper.MapperFactoryBean] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
01-Apr-2019 10:57:02.421 璀﹀憡 [RMI TCP Connection(2)-127.0.0.1] org.springframework.web.context.support.XmlWebApplicationContext.refresh Exception encountered during context initialization - cancelling refresh attempt
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'hbServerMonitoJob' defined in file [E:\ZHIZHEN\springtask\springtask\target\spring-task\WEB-INF\classes\com\zznode\qoe\task\control\HbServerMonitoJob.class]: Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [com.zznode.qoe.task.control.HbServerMonitoJob]: Constructor threw exception; nested exception is java.lang.NullPointerException
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateBean(AbstractAutowireCapableBeanFactory.java:1105)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1050)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:510)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:482)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:305)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230)