Java ibatis配置問題導致Myeclipse啟動web專案失敗
最近,除錯一web專案,由於人員流動或時間問題出現web專案開發中Java ibatis配置問題導致Myeclipse啟動web專案失敗。
Myeclipse中使用其自帶的tomcat進行run指定的web工程報錯,報錯資訊如下(出於保密及問題說明,報錯資訊我做了調整):
2016-12-17 12:09:06,915 [main] DEBUG [org.mybatis.spring.SqlSessionFactoryBean]-Parsed mapper file:
'file [C:\Users\Administrator\Workspaces\MyEclipse 8.5\.metadata\.me_tcat\webapps\******\WEB-INF\classes\mapper\AdminLogMapper.xml]'
2016-12-17 12:09:06,941 [main] DEBUG [org.mybatis.spring.SqlSessionFactoryBean]-Parsed mapper file:
'file [C:\Users\Administrator\Workspaces\MyEclipse 8.5\.metadata\.me_tcat\webapps\******\WEB-INF\classes\mapper\AdminMenuMapper.xml]'
2016-12-17 12:09:06,994 [main] INFO [org.springframework.beans.factory.support.DefaultListableBeanFactory]-Destroying singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@5ff916: defining beans [accountServiceImpl,
......
t_SettleDao]; root of factory hierarchy
2016-12-17 12:09:06,996 [main] ERROR [org.springframework.web.context.ContextLoader]-Context initialization failed
org.springframework.beans.factory.BeanCreationException:
Error creating bean with name 'accountServiceImpl': Injection of resource dependencies failed;
nested exception is org.springframework.beans.factory.BeanCreationException:
Error creating bean with name 'accountDao' defined in file
[C:\Users\Administrator\Workspaces\MyEclipse 8.5\.metadata\.me_tcat\webapps\******\WEB-INF\classes\com\******\dao\AccountDao.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 class path resource [spring-mybatis.xml]:
Invocation of init method failed; nested exception is org.springframework.core.NestedIOException:
Failed to parse mapping resource:
'file[C:\Users\Administrator\Workspaces\MyEclipse 8.5\.metadata\.me_tcat\webapps\******\WEB-INF\classes\mapper\AdminParaMapper.xml]';
nested exception is org.apache.ibatis.builder.BuilderException:
Error parsing Mapper XML. Cause: org.apache.ibatis.builder.BuilderException:
Parsing error was found in mapping #{}. Check syntax #{property|(expression), var1=value1, var2=value2, ...}
at org.springframework.context.annotation.CommonAnnotationBeanPostProcessor.postProcessPropertyValues(CommonAnnotationBeanPostProcessor.java:306)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1122)
......
at org.apache.ibatis.builder.SqlSourceBuilder$ParameterMappingTokenHandler.parseParameterMapping(SqlSourceBuilder.java:127)
... 76 more
2016-12-17 12:09:07 org.apache.catalina.core.StandardContext start
嚴重: Error listenerStart
2016-12-17 12:09:07 org.apache.catalina.core.StandardContext start
嚴重: Context [/******] startup failed due to previous errors
2016-12-17 12:09:07 org.apache.catalina.core.ApplicationContext log
資訊: Closing Spring root WebApplicationContext
2016-12-17 12:09:07 org.apache.coyote.http11.Http11Protocol start
資訊: Starting Coyote HTTP/1.1 on http-8080
2016-12-17 12:09:07 org.apache.jk.common.ChannelSocket init
資訊: JK: ajp13 listening on /0.0.0.0:8009
2016-12-17 12:09:07 org.apache.jk.server.JkMain start
資訊: Jk running ID=0 time=0/49 config=null
2016-12-17 12:09:07 org.apache.catalina.startup.Catalina start
資訊: Server startup in 11672 ms
透過以上報錯資訊,分析得出專案配置檔案spring-mybatis.xml中定義的bean名字為accountServiceImpl所依賴的bean名字為accountDao的xml配置檔案AdminParaMapper.xml
中有語法錯誤:Parsing error was found in mapping #{}. Check syntax #{property|(expression), var1=value1, var2=value2, ...} ,導致accountDao的bean無法建立,
引起accountServiceImpl在 Injection資源accountDao的過程中失敗,從而導致sqlSessionFactory建立失敗,web專案載入失敗。
排查AdminParaMapper.xml檔案,發下以下配置有問題(紅色部分是原始碼,我已經註釋,綠色程式碼是改正後的程式碼):
<update id="updateReleaseByM_flag" parameterType="string">
<!-- update adminpara set paravalue=#{} -->
update adminpara set paravalue=#{paraValue}
按照如上分析結果改正配置後,專案啟動過程中不再報錯得以成功載入。
Myeclipse中使用其自帶的tomcat進行run指定的web工程報錯,報錯資訊如下(出於保密及問題說明,報錯資訊我做了調整):
2016-12-17 12:09:06,915 [main] DEBUG [org.mybatis.spring.SqlSessionFactoryBean]-Parsed mapper file:
'file [C:\Users\Administrator\Workspaces\MyEclipse 8.5\.metadata\.me_tcat\webapps\******\WEB-INF\classes\mapper\AdminLogMapper.xml]'
2016-12-17 12:09:06,941 [main] DEBUG [org.mybatis.spring.SqlSessionFactoryBean]-Parsed mapper file:
'file [C:\Users\Administrator\Workspaces\MyEclipse 8.5\.metadata\.me_tcat\webapps\******\WEB-INF\classes\mapper\AdminMenuMapper.xml]'
2016-12-17 12:09:06,994 [main] INFO [org.springframework.beans.factory.support.DefaultListableBeanFactory]-Destroying singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@5ff916: defining beans [accountServiceImpl,
......
t_SettleDao]; root of factory hierarchy
2016-12-17 12:09:06,996 [main] ERROR [org.springframework.web.context.ContextLoader]-Context initialization failed
org.springframework.beans.factory.BeanCreationException:
Error creating bean with name 'accountServiceImpl': Injection of resource dependencies failed;
nested exception is org.springframework.beans.factory.BeanCreationException:
Error creating bean with name 'accountDao' defined in file
[C:\Users\Administrator\Workspaces\MyEclipse 8.5\.metadata\.me_tcat\webapps\******\WEB-INF\classes\com\******\dao\AccountDao.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 class path resource [spring-mybatis.xml]:
Invocation of init method failed; nested exception is org.springframework.core.NestedIOException:
Failed to parse mapping resource:
'file[C:\Users\Administrator\Workspaces\MyEclipse 8.5\.metadata\.me_tcat\webapps\******\WEB-INF\classes\mapper\AdminParaMapper.xml]';
nested exception is org.apache.ibatis.builder.BuilderException:
Error parsing Mapper XML. Cause: org.apache.ibatis.builder.BuilderException:
Parsing error was found in mapping #{}. Check syntax #{property|(expression), var1=value1, var2=value2, ...}
at org.springframework.context.annotation.CommonAnnotationBeanPostProcessor.postProcessPropertyValues(CommonAnnotationBeanPostProcessor.java:306)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1122)
......
at org.apache.ibatis.builder.SqlSourceBuilder$ParameterMappingTokenHandler.parseParameterMapping(SqlSourceBuilder.java:127)
... 76 more
2016-12-17 12:09:07 org.apache.catalina.core.StandardContext start
嚴重: Error listenerStart
2016-12-17 12:09:07 org.apache.catalina.core.StandardContext start
嚴重: Context [/******] startup failed due to previous errors
2016-12-17 12:09:07 org.apache.catalina.core.ApplicationContext log
資訊: Closing Spring root WebApplicationContext
2016-12-17 12:09:07 org.apache.coyote.http11.Http11Protocol start
資訊: Starting Coyote HTTP/1.1 on http-8080
2016-12-17 12:09:07 org.apache.jk.common.ChannelSocket init
資訊: JK: ajp13 listening on /0.0.0.0:8009
2016-12-17 12:09:07 org.apache.jk.server.JkMain start
資訊: Jk running ID=0 time=0/49 config=null
2016-12-17 12:09:07 org.apache.catalina.startup.Catalina start
資訊: Server startup in 11672 ms
透過以上報錯資訊,分析得出專案配置檔案spring-mybatis.xml中定義的bean名字為accountServiceImpl所依賴的bean名字為accountDao的xml配置檔案AdminParaMapper.xml
中有語法錯誤:Parsing error was found in mapping #{}. Check syntax #{property|(expression), var1=value1, var2=value2, ...} ,導致accountDao的bean無法建立,
引起accountServiceImpl在 Injection資源accountDao的過程中失敗,從而導致sqlSessionFactory建立失敗,web專案載入失敗。
排查AdminParaMapper.xml檔案,發下以下配置有問題(紅色部分是原始碼,我已經註釋,綠色程式碼是改正後的程式碼):
<update id="updateReleaseByM_flag" parameterType="string">
<!-- update adminpara set paravalue=#{} -->
update adminpara set paravalue=#{paraValue}
按照如上分析結果改正配置後,專案啟動過程中不再報錯得以成功載入。
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/29357786/viewspace-2130858/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- LightDB/Postgresql 記錄客戶端啟動版本問題導致啟動失敗問題SQL客戶端
- sock鎖檔案導致的MySQL啟動失敗MySql
- 糟糕的範圍管理導致專案失敗(轉)
- hbase啟動失敗問題解決
- mongodb啟動失敗問題解決MongoDB
- RAC oracle 許可權更改導致 實力啟動失敗Oracle
- /tmp檔案系統無許可權導致監聽listener啟動失敗
- /etc/fstab的錯誤設定導致系統啟動失敗
- MyEclipse轉換Eclipse專案無法啟動問題(轉)Eclipse
- oraInst.loc檔案錯誤導致opatch失敗問題的解決AI
- /dev/bpf裝置缺失導致RAC安裝時HAIP啟動失敗devAI
- SpringBoot專案引入Elasticsearch時啟動失敗Spring BootElasticsearch
- ElasticSearch啟動失敗問題彙總和解決方法Elasticsearch
- 一次心跳網路問題導致的節點新增失敗
- MongoDB例項重啟失敗探究(大事務Redo導致)MongoDB
- 由adoacorectl.sh啟動失敗導致網頁無法顯示網頁
- Oracle歸檔檔案丟失導致OGG不用啟動Oracle
- Myeclipse 更改web專案的訪問名EclipseWeb
- 解決一次gitlab因異常關機導致啟動失敗Gitlab
- 【MySQL】AppArmor導致datadir遷移無法啟動&初始化失敗MySqlAPP
- Linux主機名修改後導致mysql重啟失敗LinuxMySql
- 敏捷專案管理:問題、挑戰以及如何避免失敗敏捷專案管理
- log4j 動態配置,重啟專案配置失效問題
- 錯誤思維導向致IT專案問題多
- MySQL啟動失敗MySql
- docker啟動失敗Docker
- 因AIX系統目錄許可權問題導致TSM備份失敗AI
- Windows系統解決PhPStudy MySQL啟動失敗問題WindowsPHPMySql
- 記一次簡單的資料庫恢復,控制檔案不一致導致的啟動失敗。資料庫
- 由於網路卡故障導致DATAGUARD傳輸檔案失敗
- 解決hyper v導致docker無法啟動問題Docker
- Tomcat增加Context配置導致啟動的時候專案載入兩次TomcatContext
- Filestream/Windows Share導致Alwayson Failover失敗WindowsAI
- oracle rac 打PSU補丁30805461兩個問題(Java版本及空間不足導致失敗)OracleJava
- selenium-java被檢測導致滑塊驗證失敗Java
- 關於MYSQL 5.6 super_read_only和Event Scheduler衝突導致啟動失敗MySql
- Qt5打包後缺少dll,啟動失敗問題QT
- ElasticSearch 安裝root使用者啟動失敗問題解決Elasticsearch