原本在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>