问题
我修改了前一个项目的名称。
重新启动该项目至tomcat,报错:Java.lang.IllegalArgumentException: Can't convert argument: null
因为Eclipse在修改项目名时候,自动更新部署了web.xml文件 并且重新生成了xml文件的头部声明. 大概是这样,增加了javaee:的标签开头:
<web-app xmlns:javaee="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
<javaee:display-name>ExTKT</javaee:display-name>
<listener>
<javaee:listener-class>org.springframework.web.context.ContextLoaderListener</javaee:listener-class>
</listener>
<context-param>
<javaee:param-name>contextConfigLocation</javaee:param-name>
<javaee:param-value>classpath:spring-bean.xml</javaee:param-value>
</context-param>
<context-param>
<javaee:param-name>webAppRootKey</javaee:param-name>
<javaee:param-value>springmvc.root</javaee:param-value>
</context-param>
<filter>
<filter-name>SpringEncodingFilter</filter-name>
<filter-class>org.springframework.web.filter.CharacterEncodingFilter</filter-class>
<init-param>
<javaee:param-name>encoding</javaee:param-name>
<javaee:param-value>UTF-8</javaee:param-value>
</init-param>
<init-param>
<javaee:param-name>forceEncoding</javaee:param-name>
<javaee:param-value>true</javaee:param-value>
</init-param>
</filter>
<filter-mapping>
<filter-name>SpringEncodingFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<listener>
<javaee:listener-class>org.springframework.web.util.Log4jConfigListener</javaee:listener-class>
</listener>
<context-param>
<javaee:param-name>log4jConfigLocation</javaee:param-name>
<javaee:param-value>classpath:log4j.properties</javaee:param-value>
</context-param>
<context-param>
<javaee:param-name>log4jRefreshInterval</javaee:param-name>
<javaee:param-value>6000</javaee:param-value>
</context-param>
<servlet>
<servlet-name>dispatcherServlet</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<init-param>
<javaee:param-name>contextConfigLocation</javaee:param-name>
<javaee:param-value>classpath:springmvc/spring-mvc.xml</javaee:param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
正常的应该是这样:
<web-app xmlns:javaee="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
<display-name>ExTKT</display-name>
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>classpath:spring-bean.xml</param-value>
</context-param>
<context-param>
<param-name>webAppRootKey</param-name>
<param-value>springmvc.root</param-value>
</context-param>
<filter>
<filter-name>SpringEncodingFilter</filter-name>
<filter-class>org.springframework.web.filter.CharacterEncodingFilter</filter-class>
<init-param>
<param-name>encoding</param-name>
<param-value>UTF-8</param-value>
</init-param>
<init-param>
<param-name>forceEncoding</param-name>
<param-value>true</param-value>
</init-param>
</filter>
<filter-mapping>
<filter-name>SpringEncodingFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<listener>
<listener-class>org.springframework.web.util.Log4jConfigListener</listener-class>
</listener>
<context-param>
<param-name>log4jConfigLocation</param-name>
<param-value>classpath:log4j.properties</param-value>
</context-param>
<context-param>
<param-name>log4jRefreshInterval</param-name>
<param-value>6000</param-value>
</context-param>
<servlet>
<servlet-name>dispatcherServlet</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<init-param>
<param-name>contextConfigLocation</param-name>
<param-value>classpath:springmvc/spring-mvc.xml</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
解决方案:
Ctrl+F搜索javaee: 然后全部去掉就可以了