异常总结

本文汇总了多种常见的开发过程中遇到的技术异常及其解决方案,包括Hibernate、Spring、Struts2等框架的问题,如Associationreferencesunmappedclass异常、Multipart解析器配置、struts2-core依赖等问题。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

Association references unmapped class异常:
    1.某一个类没有映射文件(*.hbm.xml)

    2.该映射文件没有注册到hibernate.cfg.xml中。

    3.映射文件的文件名不对

    4.映射的类路径有错误


 QueryRunner requires a DataSource to be invoked in this way, or a Connection should be passed in:
    没有获取导数据源


java.sql.SQLException: Callable statments not supported.:驱动包有问题


Expected MultipartHttpServletRequest: is a MultipartResolver configured?] with root cause:spring上传文件没有配置muiltpart解析器:解决之道

        <bean id="multipartResolver" class="org.springframework.web.multipart.commons.CommonsMultipartResolver"/>





Error occured processing XML 'org/springframework/transaction/interceptor/TransactionInterceptor'. See Error Log for more details:

    加入jar包:com.springsource.org.aopalliance-1.0.0.jar



java.lang.NoClassDefFoundError: javax/persistence/EntityListeners:

    加入jar包:ejb3-persistence.jar



org/aopalliance/intercept/MethodInterceptor:
    加入jar包:com.springsource.org.aopalliance-1.0.0.jar



struts2如果浏览器访问不到action:
    加入jar包:struts2-core-2.3.24.jar



Unable to load configuration. - Class: java.net.AbstractPlainSocketImpl:

    解决:
        第一种: 将struts.xml声明部分替换成 struts2-core-2.xxx.jar包中struts-default.xml声明部分即可.

        第二种: 连上网就不会出现这个错误.


java.lang.NoClassDefFoundError: ognl/PropertyAccessor:

    解决:加入ognl表达式的jar包





struts2.3和Hibernate 4.3同时使用的时候会出现一个错误“$$_javassist_0 cannot be cast to javassist.util.proxy.Proxy”

        解决方案:只保留Hibernate的javassist的jar包就行




ognl.MethodFailedException: Method "list" failed for object com.tanghaibin.view.DepartmentAction@76daf0b [java.lang.NoSuchMethodError: antlr.collections.AST.getLine()I]

        解决之道:antlr_2.72jar冲突,检查是否存在多个此版本不同的jar包





attempt to create delete event with null entity:

    原因:删除为空的对象会抛出此异常
    
    解决之道:在删除前判断该对象是否为空





An association from the table t_role_privilege refers to an unmapped class
    解决之道:
        1,检查你的hibernate.cfg.xml文件中是否添加了  <mapping resource="xxxx.hbm.xml"/>
        2,检查你的hibernate.cfg.xml文件中的相关联的两个<mapping resource=""/>的顺序,可能有其中一个需要引用另一个,但是另一个却还没有编译,就是说被用作外            键的表要放在前面
        3,检查你的*.hbm.xml文件名是否正确
4, 检查你的*.hbm.xml里面类全名





struts2:
当提交表单提交给action的时候,如果有input标签,则必须有value标签,否则会报:

    No result defined for action com.tanghaibin.view.RoleAction and result input - action
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值