java web开发中的奇葩事web.xml中context-param中的注释

同事提交了代码。结果除同事之外,其他人全部编译报错。报错说web.xml中配置的一个bean 没有定义。按照报错提示,各种找,无果。

由于代码全部都是提交到svn主干,之前也没有做过备份,只能一步一步删除同事提交的代码,进行还原。

奇葩事情出现了!

 

<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>
classpath:/context_entry.xml
classpath:/context_web.xml

<!--add by XXX-->

classpath:/GCSPcontext/context_policy_web.xml

<!--add by XXX-->

</param-value>
</context-param>

 

引入文件没有错误,问题就在于这个注释上。突然想起之前也因为在这里写注释,报了一个错误,找了很久,但是为什么把错误指向另一个毫不相关为的文件呢。

 

 <Could not load use
r defined filter in web.xml: org.springframework.web.filter.DelegatingFilterProx
y.
org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named ‘
shiroFilter‘ is defined
at org.springframework.beans.factory.support.DefaultListableBeanFactory.
getBeanDefinition(DefaultListableBeanFactory.java:387)
at org.springframework.beans.factory.support.AbstractBeanFactory.getMerg
edLocalBeanDefinition(AbstractBeanFactory.java:971)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBe
an(AbstractBeanFactory.java:246)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean
(AbstractBeanFactory.java:185)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean
(AbstractBeanFactory.java:168)
Truncated. see log file for complete stacktrace

 

 

 

 

附上web.xml文件配置

 

java web开发中的奇葩事web.xml中context-param中的注释
<?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee   http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">

    <context-param>
        <param-name>javax.servlet.jsp.jstl.fmt.localizationContext</param-name>
        <param-value>ApplicationResources</param-value>
    </context-param>
    <context-param>
        <param-name>contextConfigLocation</param-name>
        <param-value>
            classpath:/context_entry.xml
            classpath:/context_web.xml

        </param-value>
    </context-param>

    
    <filter>
        <filter-name>SQLInjectFilter</filter-name>
        <filter-class>com.sinosoft.gcsp.common.util.SQLInjectFilter</filter-class>
    </filter>
    <filter-mapping>
        <filter-name>SQLInjectFilter</filter-name>
        <url-pattern>/*</url-pattern>
    </filter-mapping>
  
    <filter>
        <filter-name>encodingFilter</filter-name>
        <filter-class>org.springframework.web.filter.CharacterEncodingFilter</filter-class>
        <init-param>
            <param-name>encoding</param-name>
            <param-value>GBK</param-value>
        </init-param>
        <init-param>
            <param-name>forceEncoding</param-name>
            <param-value>true</param-value>
        </init-param>
    </filter>
    <filter>
        <filter-name>struts2</filter-name>
         <!-- <filter-class>org.apache.struts2.dispatcher.FilterDispatcher</filter-class> -->
        <filter-class>org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter</filter-class> 
        <init-param>
            <param-name>actionPackages</param-name>
            <param-value>com.sinosig.schedule.user.web</param-value>
        </init-param>
    </filter>
    
    <filter>
        <filter-name>shiroFilter</filter-name>
        <filter-class>org.springframework.web.filter.DelegatingFilterProxy</filter-class>
    </filter>
    <filter-mapping>
        <filter-name>shiroFilter</filter-name>
        <url-pattern>*.action</url-pattern>
    </filter-mapping>
    <filter-mapping>
        <filter-name>shiroFilter</filter-name>
        <url-pattern>*.jsp</url-pattern>
    </filter-mapping>
    
    <filter-mapping>
        <filter-name>encodingFilter</filter-name>
        <url-pattern>/*</url-pattern>
    </filter-mapping>
    <filter-mapping>
        <filter-name>struts2</filter-name>
        <url-pattern>/*</url-pattern>
    </filter-mapping>

    <listener>
        <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
    </listener>
    <listener>
        <listener-class>org.springframework.web.util.IntrospectorCleanupListener</listener-class>
    </listener>
    <listener>
        <listener-class>org.springframework.web.context.request.RequestContextListener</listener-class>
    </listener>

    <!--    <listener>-->
    <!--        <listener-class>-->
    <!--
        com.sinosig.framework.web.listener.FrameworkHttpSessionListener</listener-class>
    -->
    <!--    </listener>-->
    
    <error-page>
        <error-code>404</error-code>
        <location>/error404.jsp</location>
    </error-page>
    
    
    <welcome-file-list>
        <welcome-file>UIPrBefLogin.jsp</welcome-file>
    </welcome-file-list>

    <session-config>
        <session-timeout>60</session-timeout>
    </session-config>
</web-app>
java web开发中的奇葩事web.xml中context-param中的注释

 

 

java web开发中的奇葩事web.xml中context-param中的注释,布布扣,bubuko.com

java web开发中的奇葩事web.xml中context-param中的注释

上一篇:springboot 报错Content type 'application/x-www-form-urlencoded;charset=UTF-8' not supported


下一篇:编程语言的发展趋势by Anders Hejlsberg