Exception sending context initialized event to listener instance of classcom.demo.web.listener.InitApplicationListener java.lang.IllegalArgumentException at org.springframework.asm.ClassReader.<init>(Unknown Source)
缘由:1.8的jdk对于spring的版本须要在4.0以上。html
解决方法:前端
<properties> <!-- spring版本号--> <jackson.version>2.4.4</jackson.version> <spring.version>4.0.2.RELEASE</spring.version> <!-- mybatis版本号--> <mybatis.version>3.3.0</mybatis.version> <!-- log4j日志文件管理包版本--> <slf4j.version>1.7.7</slf4j.version> <log4j.version>1.2.17</log4j.version> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> </properties>
Not found org.springframework.http.converter.json.MappingJacksonHttpMessageConverter
缘由:这种配置用的是jackson1.X版本的,若是你项目里是2.X的,请用org.springframework.http.converter.json.MappingJacksonHttp2MessageConverter或者下载1.X的。java
解决方法:web
<!--避免IE执行AJAX时,返回JSON出现下载文件--> <bean id="mappingJacksonHttpMessageConverter" class="org.springframework.http.converter.json.MappingJackson2HttpMessageConverter"> <property name="supportedMediaTypes"> <list> <value>text/html;charset=UTF-8</value> </list> </property> </bean>
org.apache.ibatis.binding.BindingException: Invalid bound statement (not found): com.changyu.foryou.mapper.SellerMapper.selectByCampusAdmin
缘由:mybatis未扫描到xml文件, IDEA中在编译的时候,若是配置文件不是放在Resources文件夹下就不会被执行编译spring
解决方法:sql
<!-- sessionFactory将spring和mybatis整合--> <bean id="sqlSessionFactory"class="org.mybatis.spring.SqlSessionFactoryBean"> <property name="dataSource"ref="dataSource"/> <!--不能扫描java包--> <!--<property name="mapperLocations" value="classpath:com/changyu/foryou/mapping/*.xml" />--> <!--<property name="mapperLocations" value="classpath:/**/mapping/*Mapper.xml" /> <!–加载mapper文件–>--> <!--扫描resources目录下的xml文件(貌似idea中在编译的时候,若是配置文件不是放在Resources文件夹下就不会被执行编译,致使运行时找不到的问题)--> <!--建议把xml文件放到resources目录下--> <propertyname="mapperLocations"value="classpath*:mapping/*.xml"/> </bean> <!-- 经过扫描的模式,扫描目录在com/hoo/mapper目录下,全部的mapper都继承SqlMapper接口的接口, 这样一个bean就能够了--> <bean class="org.mybatis.spring.mapper.MapperScannerConfigurer"> <property name="basePackage"value="com.changyu.foryou.mapper"/> <property name="sqlSessionFactoryBeanName"value="sqlSessionFactory"/> </bean>
java.lang.ArithmeticException: Non-terminating decimal expansion; no exact representable decimal result
缘由:经过BigDecimal的divide方法进行除法时当不整除,出现无限循环小数时,就会抛异常:java.lang.ArithmeticException: Non-terminating decimal expansion; no exact representable decimal result.apache
解决方法:解决的办法就是给divide方法设置精确的小数点,如:json
divide(xxxxx,2)。 tpodetail.setNotaxunitprice(taxunitprice.divide((newBigDecimal(1).add(taxrate.divide(newBigDecimal(100),4))),4));
Unable to open debugger port (127.0.0.1:63777): Java.NET.BindException "Address already in use: JVM_Bind"
缘由:出来Tomcat Server的配置上。session
解决方法:
问题解决以前端口用的是63777,后来我索性把这个Tomcat Server删掉从新建立一下,它就自动使用50424这个端口了,启动Debug模式,问题解决成功!
(固然,你不删除Tomcat Server配置,手动修改端口号估计也行,可是我试了它只能用上下箭头去改端口,好麻烦。并且手动改了以后也不必定能用,因此不如重建让Intellij IDEA自动找的好)。mybatis
java.sql.SQLException: Column count doesn't match value count at row 1
缘由:是因为写的SQL语句里列的数目和后面的值的数目不一致
好比:insert into表名(field1,field2,field3) values('a','b')这样前面的是三列,后面却只有二个值,这就会出现这个错误的。
解决方法:检查sql
Error:java: Annotation processing is not supported for module cycles. Please ensure that all modules from cycle [common,util] are excluded from annotation processing
缘由:分布式各模块循环依赖
解决方法:检查各模块pom.xml文件依赖状况