v_ZSW 2016-11-06 12:22 采纳率: 75%
浏览 741
已采纳

tomca项目共享jar后,strust出错

原本在tomcat里面的很多ssh开发的项目,在WEB-INF/lib中都有一份ssh的jar包。
这样方法区加载的类占了很多内存。
现在改成,在tomcat中设置一个共享jar包的地方,所用项目的ssh框架的jar包都从这里读出来。
现在有一个项目是用了struts,hibernate,但是没有用spring。
在tomcat启动的时候,struts加载失败,提示这个项目struts和spring整合了,我要为这个项目加入spring的监听器。可是这个项目我都没配置过spring,也没用到spring。

错误日志:

06-Nov-2016 20:11:45.127 INFO [localhost-startStop-1] com.opensymphony.xwork2.util.logging.commons.CommonsLogger.info Initializing Struts-Spring integration...
06-Nov-2016 20:11:45.128 SEVERE [localhost-startStop-1] com.opensymphony.xwork2.util.logging.commons.CommonsLogger.fatal ********** FATAL ERROR STARTING UP STRUTS-SPRING INTEGRATION **********
Looks like the Spring listener was not configured for your web app! 
Nothing will work until WebApplicationContextUtils returns a valid ApplicationContext.
You might need to add the following to web.xml: 
    <listener>
        <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
    </listener>
06-Nov-2016 20:11:45.154 SEVERE [localhost-startStop-1] com.opensymphony.xwork2.util.logging.commons.CommonsLogger.error Dispatcher initialization failed
 java.lang.NullPointerException
    at com.opensymphony.xwork2.spring.SpringObjectFactory.getClassInstance(SpringObjectFactory.java:245)
    at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.verifyResultType(XmlConfigurationProvider.java:608)
    at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.addResultTypes(XmlConfigurationProvider.java:578)

项目的web.xml

 <?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://xmlns.jcp.org/xml/ns/javaee" xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd" id="WebApp_ID" version="3.1">
  <display-name>WeMall4.0</display-name>
  <welcome-file-list>
    <welcome-file>index.jsp</welcome-file>
  </welcome-file-list>
  <filter>
    <filter-name>struts2</filter-name>
    <filter-class>org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter</filter-class>
  </filter>
  <filter-mapping>
    <filter-name>struts2</filter-name>
    <url-pattern>/*</url-pattern>
  </filter-mapping>
</web-app>
  • 写回答

1条回答 默认 最新

  • devmiao 2016-11-06 16:52
    关注
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥30 这是哪个作者做的宝宝起名网站
  • ¥60 版本过低apk如何修改可以兼容新的安卓系统
  • ¥25 由IPR导致的DRIVER_POWER_STATE_FAILURE蓝屏
  • ¥50 有数据,怎么建立模型求影响全要素生产率的因素
  • ¥50 有数据,怎么用matlab求全要素生产率
  • ¥15 TI的insta-spin例程
  • ¥15 完成下列问题完成下列问题
  • ¥15 C#算法问题, 不知道怎么处理这个数据的转换
  • ¥15 YoloV5 第三方库的版本对照问题
  • ¥15 请完成下列相关问题!