开发者社区> 问答> 正文

升级struts2 2.3.16 报错 BeanCreationException的问题

错误

rg.springframework.beans.factory.BeanCreationException: Error creating bean with name 'treeMenuDao' defined in ServletContext resource [/WEB-INF/dataAccessContext-local.xml]: Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [com.sunyard.zj.dao.ibatis.TreeMenuDaoImpl]: Constructor threw exception; nested exception is java.lang.NullPointerException
Caused by: org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [com.sunyard.zj.dao.ibatis.TreeMenuDaoImpl]: Constructor threw exception; nested exception is java.lang.NullPointerException
Caused by: java.lang.NullPointerException

原来用的struts2 2.0.11 版本 最近说有漏洞要升级,结果升级了就报错,用的strunts+spring+ibatis. 网上找了好多解决办法都是对于hibernate的。求大神帮忙。

展开
收起
小旋风柴进 2016-03-05 10:52:51 3438 0
1 条回答
写回答
取消 提交回答
  • 在struts2 jar包下有一个default.properties文件(路径为:orgapachestruts2),里面是struts2一些默认配置,其中有一项配置是struts.enable.DynamicMethodInvocation,作用是动态方法调用,为true时,就可以在struts.xml配置“*”的通配符,来调用action里的方法,在2.3.15版本之前都是默认为true
    screenshot
    而到了2.3.16之后就默认设置为false了
    screenshot
    这样就不能使用通配的方式调用action里的方法,如果想使用通配符来调用action里的方法的话需要在struts.xml里把struts.enable.DynamicMethodInvocation设置为true.
    在struts.xml里添加如下配置:
    <constant name="struts.enable.DynamicMethodInvocation"value="true"></constant>
    这样就可以了。

    2019-07-17 18:53:02
    赞同 展开评论 打赏
问答分类:
问答地址:
问答排行榜
最热
最新

相关电子书

更多
低代码开发师(初级)实战教程 立即下载
冬季实战营第三期:MySQL数据库进阶实战 立即下载
阿里巴巴DevOps 最佳实践手册 立即下载