SpringMVC项目异常汇总

汇总下编写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即可。


持续更新中。。。

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
【社区内容提示】社区部分内容疑似由AI辅助生成,浏览时请结合常识与多方信息审慎甄别。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

相关阅读更多精彩内容

友情链接更多精彩内容