美文网首页
SpringMVC项目异常汇总

SpringMVC项目异常汇总

作者: Allenrui | 来源:发表于2017-02-27 22:07 被阅读0次

汇总下编写SpringMVC项目时遇到的问题,省的以后再次碰到忘记再去百度

1、异常如下:

ERROR: org.springframework.web.context.ContextLoader - Context initialization failed

java.lang.NoClassDefFoundError: Lcom/dhcc/dao/BookShopDao;

可能原因:

1):缺少 org.springframework.asm-3.0.5.RELEASE.jar

2):。。


2、异常如下:

“通配符的匹配很全面, 但无法找到元素 'tx:advice' 的声明”

解决:

xsi:schemaLocation 加上:

http://www.springframework.org/schema/txhttp://www.springframework.org/schema/tx/spring-tx.xsd


3、异常如下

Build path is incomplete. Cannot find class file for org/hibernate/TransactionException

可能原因:Spring framework版本和Hibernate版本太低

可参考我的:


4、  Could not autowire method

Caused by: org.springframework.beans.factory.BeanCreationException: Could not autowire method: 。。。

        Caused by: org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type [project.dao.ServiceUserDao] found for dependency: 

可能原因:

1)、<context component-scan base-package=""/>  中包的路径不对 ,导致扫描不到相应注解

添加如下jpa注解


5、异常:book is not mapped【selet * from book】

原因:hql查询语句的表明是类名,首字母大写


6、如下:

java.lang.IncompatibleClassChangeError:classorg.springframework.core.type.classreading.ClassMetadataReadingVisitorhasinterfaceorg.springframework.asm.ClassVisitorassuperclass

解决:删除Spring-asm-x.x.jar

具体原因参考:这里


7、如下:

idea中web.xml配置   某些元素出现element xxx is not allowed here

解决:右键项目名,open module settings,  选择web,指定web resources directories和Deployment Descriptions即可。


持续更新中。。。

相关文章

网友评论

      本文标题:SpringMVC项目异常汇总

      本文链接:https://www.haomeiwen.com/subject/hcwrwttx.html