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文件依賴狀況