Tomcat 错误:警告:无法检索容器的 JNDI 命名上下文

2022-09-03 04:24:00

当我尝试在Tomcat 7上启动最近部署的Web应用程序时,我在文件夹上的文件中遇到以下错误。catalina.2013-12-31.logTomcat70/logs/

Dec 31, 2013 10:11:20 AM org.apache.catalina.deploy.NamingResources cleanUp
WARNING: Failed to retrieve JNDI naming context for container [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/crm]] so no cleanup was performed for that container
javax.naming.NameNotFoundException: Name [comp/env] is not bound in this Context. Unable to find [comp].
    at org.apache.naming.NamingContext.lookup(NamingContext.java:820)
    at org.apache.naming.NamingContext.lookup(NamingContext.java:168)
    at org.apache.catalina.deploy.NamingResources.cleanUp(NamingResources.java:977)
    at org.apache.catalina.deploy.NamingResources.stopInternal(NamingResources.java:959)
    at org.apache.catalina.util.LifecycleBase.stop(LifecycleBase.java:232)
    at org.apache.catalina.core.StandardContext.stopInternal(StandardContext.java:5483)
    at org.apache.catalina.util.LifecycleBase.stop(LifecycleBase.java:232)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:141)
    at org.apache.catalina.manager.ManagerServlet.start(ManagerServlet.java:1247)
    at org.apache.catalina.manager.HTMLManagerServlet.start(HTMLManagerServlet.java:747)
    at org.apache.catalina.manager.HTMLManagerServlet.doPost(HTMLManagerServlet.java:222)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:641)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
    at org.apache.catalina.filters.CsrfPreventionFilter.doFilter(CsrfPreventionFilter.java:186)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
    at org.apache.catalina.filters.SetCharacterEncodingFilter.doFilter(SetCharacterEncodingFilter.java:108)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:225)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:169)
    at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:581)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:168)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:98)
    at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:927)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:407)
    at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:999)
    at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:565)
    at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:307)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
    at java.lang.Thread.run(Thread.java:722)

我的应用程序是 JDK7 Web 应用程序。我试图寻找类似的问题,并尝试了一些建议,例如重新启动服务器(以便清除一些XML文件),但它不起作用。

有什么想法吗?

更新:

这就是我在:web.xml

<?xml version="1.0" encoding="ISO-8859-1"?>

<!DOCTYPE web-app
    PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
    "http://java.sun.com/dtd/web-app_2_3.dtd">

<web-app>

    <!-- Define CRM session timeout -->
    <session-config>
    <session-timeout>60</session-timeout>
    </session-config>

    <!-- Define servlet-mapped and path-mapped example filters -->
    <filter>
        <filter-name>Servlet Mapped Filter</filter-name>
        <filter-class>Filters.ExampleFilter</filter-class>
    <init-param>
        <param-name>attribute</param-name>
        <param-value>Filters.ExampleFilter.SERVLET_MAPPED</param-value>
    </init-param>
    </filter>
    <filter>
        <filter-name>Path Mapped Filter</filter-name>
        <filter-class>Filters.ExampleFilter</filter-class>
    <init-param>
        <param-name>attribute</param-name>
        <param-value>Filters.ExampleFilter.PATH_MAPPED</param-value>
    </init-param>
    </filter>
    <filter>
        <filter-name>Request Dumper Filter</filter-name>
        <filter-class>Filters.RequestDumperFilter</filter-class>
    </filter>

    <filter>
        <filter-name>Set Character Encoding</filter-name>
        <filter-class>Filters.SetCharacterEncodingFilter</filter-class>
        <init-param>
            <param-name>encoding</param-name>
            <param-value>EUC_JP</param-value>
        </init-param>
    </filter>
    <filter>
        <filter-name>Compression Filter</filter-name>
        <filter-class>CompressionFilters.CompressionFilter</filter-class>
        <init-param>
          <param-name>compressionThreshold</param-name>
          <param-value>10</param-value>
        </init-param>
        <init-param>
          <param-name>debug</param-name>
          <param-value>0</param-value>
        </init-param>
    </filter>

    <!-- Define filter mappings for the defined filters -->
    <filter-mapping>
        <filter-name>Servlet Mapped Filter</filter-name>
    <servlet-name>invoker</servlet-name>
    </filter-mapping>
    <filter-mapping>
        <filter-name>Path Mapped Filter</filter-name>
    <url-pattern>/servlet/*</url-pattern>
    </filter-mapping>

    <!-- Define example application events listeners -->
    <listener>
        <listener-class>Listeners.ContextListener</listener-class>
    </listener>
    <listener>
        <listener-class>Listeners.SessionListener</listener-class>
    </listener>

    <!-- Define servlets that are included in the example application -->
    <servlet>
        <servlet-name>SendMailServlet</servlet-name>
        <servlet-class>SendMailServlet</servlet-class>
    </servlet>

    <servlet>
        <servlet-name>
            snoop
        </servlet-name>
        <servlet-class>
            SnoopServlet
        </servlet-class>
        <run-as>
            <description>Security role for anonymous access</description>
            <role-name>tomcat</role-name>
        </run-as>
    </servlet>

    <servlet>
      <servlet-name>
          servletToJsp
      </servlet-name>
      <servlet-class>
          servletToJsp
      </servlet-class>
    </servlet>
    <servlet>
        <servlet-name>
            CompressionFilterTestServlet
        </servlet-name>
        <servlet-class>
            CompressionFilters.CompressionFilterTestServlet
        </servlet-class>
    </servlet>

    <servlet-mapping>
        <servlet-name>
            CompressionFilterTestServlet
        </servlet-name>
        <url-pattern>
            /CompressionTest
        </url-pattern>
    </servlet-mapping>

    <servlet-mapping>
        <servlet-name>SendMailServlet</servlet-name>
        <url-pattern>/SendMailServlet</url-pattern>
    </servlet-mapping>

    <servlet-mapping>
        <servlet-name>
            snoop
        </servlet-name>
        <url-pattern>
            /snoop
        </url-pattern>
    </servlet-mapping>
    <servlet-mapping>
        <servlet-name>
            servletToJsp
        </servlet-name>
        <url-pattern>
            /servletToJsp
        </url-pattern>
    </servlet-mapping>

    <!-- Added 11/02/2013 - Ryan Sammut -->
    <!-- Servlet Mapping -->
    <servlet>
        <servlet-name>AddNewContact</servlet-name> 
        <servlet-class>Crm.Servlets.AddNewContact</servlet-class> 
    </servlet>
    <servlet-mapping>
        <servlet-name>AddNewContact</servlet-name> 
        <url-pattern>/servlet/AddNewContact</url-pattern> 
    </servlet-mapping>

    <servlet>
        <servlet-name>AddTip</servlet-name> 
        <servlet-class>Crm.Servlets.AddTip</servlet-class> 
    </servlet>
    <servlet-mapping>
        <servlet-name>AddTip</servlet-name> 
        <url-pattern>/servlet/AddTip</url-pattern> 
    </servlet-mapping>

    <servlet>
        <servlet-name>CaaPdfOutputter</servlet-name> 
        <servlet-class>Crm.Servlets.CaaPdfOutputter</servlet-class> 
    </servlet>
    <servlet-mapping>
        <servlet-name>CaaPdfOutputter</servlet-name> 
        <url-pattern>/servlet/CaaPdfOutputter</url-pattern> 
    </servlet-mapping>

    <servlet>
        <servlet-name>CaaTestSubmit</servlet-name> 
        <servlet-class>Crm.Servlets.CaaTestSubmit</servlet-class> 
    </servlet>
    <servlet-mapping>
        <servlet-name>CaaTestSubmit</servlet-name> 
        <url-pattern>/servlet/CaaTestSubmit</url-pattern> 
    </servlet-mapping>

    <servlet>
        <servlet-name>DeleteTip</servlet-name> 
        <servlet-class>Crm.Servlets.DeleteTip</servlet-class> 
    </servlet>
    <servlet-mapping>
        <servlet-name>DeleteTip</servlet-name> 
        <url-pattern>/servlet/DeleteTip</url-pattern> 
    </servlet-mapping>

    <servlet>
        <servlet-name>DestinationCustomerFinancialAdvisorRefresh</servlet-name> 
        <servlet-class>Crm.Servlets.DestinationCustomerFinancialAdvisorRefresh</servlet-class> 
    </servlet>
    <servlet-mapping>
        <servlet-name>DestinationCustomerFinancialAdvisorRefresh</servlet-name> 
        <url-pattern>/servlet/DestinationCustomerFinancialAdvisorRefresh</url-pattern> 
    </servlet-mapping>

    <servlet>
        <servlet-name>DestinationCustomerRefresh</servlet-name> 
        <servlet-class>Crm.Servlets.DestinationCustomerRefresh</servlet-class> 
    </servlet>
    <servlet-mapping>
        <servlet-name>DestinationCustomerRefresh</servlet-name> 
        <url-pattern>/servlet/DestinationCustomerRefresh</url-pattern> 
    </servlet-mapping>

    <servlet>
        <servlet-name>DestinationCustomerShadowFinancialAdvisorRefresh</servlet-name> 
        <servlet-class>Crm.Servlets.DestinationCustomerShadowFinancialAdvisorRefresh</servlet-class> 
    </servlet>
    <servlet-mapping>
        <servlet-name>DestinationCustomerShadowFinancialAdvisorRefresh</servlet-name> 
        <url-pattern>/servlet/DestinationCustomerShadowFinancialAdvisorRefresh</url-pattern> 
    </servlet-mapping>

    <servlet>
        <servlet-name>DestinationOfficerControl</servlet-name> 
        <servlet-class>Crm.Servlets.DestinationOfficerControl</servlet-class> 
    </servlet>
    <servlet-mapping>
        <servlet-name>DestinationOfficerControl</servlet-name> 
        <url-pattern>/servlet/DestinationOfficerControl</url-pattern> 
    </servlet-mapping>

    <servlet>
        <servlet-name>DestinationOfficerFinancialAdvisorControl</servlet-name> 
        <servlet-class>Crm.Servlets.DestinationOfficerFinancialAdvisorControl</servlet-class> 
    </servlet>
    <servlet-mapping>
        <servlet-name>DestinationOfficerFinancialAdvisorControl</servlet-name> 
        <url-pattern>/servlet/DestinationOfficerFinancialAdvisorControl</url-pattern> 
    </servlet-mapping>

    <servlet>
        <servlet-name>DestinationOfficerShadowFinancialAdvisorControl</servlet-name> 
        <servlet-class>Crm.Servlets.DestinationOfficerShadowFinancialAdvisorControl</servlet-class> 
    </servlet>
    <servlet-mapping>
        <servlet-name>DestinationOfficerShadowFinancialAdvisorControl</servlet-name> 
        <url-pattern>/servlet/DestinationOfficerShadowFinancialAdvisorControl</url-pattern> 
    </servlet-mapping>

    <servlet>
        <servlet-name>FactFindControl</servlet-name> 
        <servlet-class>Crm.Servlets.FactFindControl</servlet-class> 
    </servlet>
    <servlet-mapping>
        <servlet-name>FactFindControl</servlet-name> 
        <url-pattern>/servlet/FactFindControl</url-pattern> 
    </servlet-mapping>

    <servlet>
        <servlet-name>InsertAddedCustomerFinancialAdvisor</servlet-name> 
        <servlet-class>Crm.Servlets.InsertAddedCustomerFinancialAdvisor</servlet-class> 
    </servlet>
    <servlet-mapping>
        <servlet-name>InsertAddedCustomerFinancialAdvisor</servlet-name> 
        <url-pattern>/servlet/InsertAddedCustomerFinancialAdvisor</url-pattern> 
    </servlet-mapping>

    <servlet>
        <servlet-name>InsertAddedCustomerRelationshipOfficer</servlet-name> 
        <servlet-class>Crm.Servlets.InsertAddedCustomerRelationshipOfficer</servlet-class> 
    </servlet>
    <servlet-mapping>
        <servlet-name>InsertAddedCustomerRelationshipOfficer</servlet-name> 
        <url-pattern>/servlet/InsertAddedCustomerRelationshipOfficer</url-pattern> 
    </servlet-mapping>

    <servlet>
        <servlet-name>InsertAddedCustomerShadowFinancialAdvisor</servlet-name> 
        <servlet-class>Crm.Servlets.InsertAddedCustomerShadowFinancialAdvisor</servlet-class> 
    </servlet>
    <servlet-mapping>
        <servlet-name>InsertAddedCustomerShadowFinancialAdvisor</servlet-name> 
        <url-pattern>/servlet/InsertAddedCustomerShadowFinancialAdvisor</url-pattern> 
    </servlet-mapping>

    <servlet>
        <servlet-name>KYCControl</servlet-name> 
        <servlet-class>Crm.Servlets.KYCControl</servlet-class> 
    </servlet>
    <servlet-mapping>
        <servlet-name>KYCControl</servlet-name> 
        <url-pattern>/servlet/KYCControl</url-pattern> 
    </servlet-mapping>

    <servlet>
        <servlet-name>LeadAssignmentTransfer</servlet-name> 
        <servlet-class>Crm.Servlets.LeadAssignmentTransfer</servlet-class> 
    </servlet>
    <servlet-mapping>
        <servlet-name>LeadAssignmentTransfer</servlet-name> 
        <url-pattern>/servlet/LeadAssignmentTransfer</url-pattern> 
    </servlet-mapping>

    <servlet>
        <servlet-name>LeadAssignmentView</servlet-name> 
        <servlet-class>Crm.Servlets.LeadAssignmentView</servlet-class> 
    </servlet>
    <servlet-mapping>
        <servlet-name>LeadAssignmentView</servlet-name> 
        <url-pattern>/servlet/LeadAssignmentView</url-pattern> 
    </servlet-mapping>

    <servlet>
        <servlet-name>LeadDetailsGenerator</servlet-name> 
        <servlet-class>Crm.Servlets.LeadDetailsGenerator</servlet-class> 
    </servlet>
    <servlet-mapping>
        <servlet-name>LeadDetailsGenerator</servlet-name> 
        <url-pattern>/servlet/LeadDetailsGenerator</url-pattern> 
    </servlet-mapping>

    <servlet>
        <servlet-name>ListAddedCustomerFinancialAdvisor</servlet-name> 
        <servlet-class>Crm.Servlets.ListAddedCustomerFinancialAdvisor</servlet-class> 
    </servlet>
    <servlet-mapping>
        <servlet-name>ListAddedCustomerFinancialAdvisor</servlet-name> 
        <url-pattern>/servlet/ListAddedCustomerFinancialAdvisor</url-pattern> 
    </servlet-mapping>

    <servlet>
        <servlet-name>ListAddedCustomerRelationshipOfficer</servlet-name> 
        <servlet-class>Crm.Servlets.ListAddedCustomerRelationshipOfficer</servlet-class> 
    </servlet>
    <servlet-mapping>
        <servlet-name>ListAddedCustomerRelationshipOfficer</servlet-name> 
        <url-pattern>/servlet/ListAddedCustomerRelationshipOfficer</url-pattern> 
    </servlet-mapping>

    <servlet>
        <servlet-name>ListAddedCustomerShadowFinancialAdvisor</servlet-name> 
        <servlet-class>Crm.Servlets.ListAddedCustomerShadowFinancialAdvisor</servlet-class> 
    </servlet>
    <servlet-mapping>
        <servlet-name>ListAddedCustomerShadowFinancialAdvisor</servlet-name> 
        <url-pattern>/servlet/ListAddedCustomerShadowFinancialAdvisor</url-pattern> 
    </servlet-mapping>

    <servlet>
        <servlet-name>RemoveCustomerFinancialAdvisor</servlet-name> 
        <servlet-class>Crm.Servlets.RemoveCustomerFinancialAdvisor</servlet-class> 
    </servlet>
    <servlet-mapping>
        <servlet-name>RemoveCustomerFinancialAdvisor</servlet-name> 
        <url-pattern>/servlet/RemoveCustomerFinancialAdvisor</url-pattern> 
    </servlet-mapping>

    <servlet>
        <servlet-name>RemoveCustomerRelationshipOfficer</servlet-name> 
        <servlet-class>Crm.Servlets.RemoveCustomerRelationshipOfficer</servlet-class> 
    </servlet>
    <servlet-mapping>
        <servlet-name>RemoveCustomerRelationshipOfficer</servlet-name> 
        <url-pattern>/servlet/RemoveCustomerRelationshipOfficer</url-pattern> 
    </servlet-mapping>

    <servlet>
        <servlet-name>RemoveCustomerShadowFinancialAdvisor</servlet-name> 
        <servlet-class>Crm.Servlets.RemoveCustomerShadowFinancialAdvisor</servlet-class> 
    </servlet>
    <servlet-mapping>
        <servlet-name>RemoveCustomerShadowFinancialAdvisor</servlet-name> 
        <url-pattern>/servlet/RemoveCustomerShadowFinancialAdvisor</url-pattern> 
    </servlet-mapping>

    <servlet>
        <servlet-name>RetrieveTips</servlet-name> 
        <servlet-class>Crm.Servlets.RetrieveTips</servlet-class> 
    </servlet>
    <servlet-mapping>
        <servlet-name>RetrieveTips</servlet-name> 
        <url-pattern>/servlet/RetrieveTips</url-pattern> 
    </servlet-mapping>

    <servlet>
        <servlet-name>SourceCustomerFinancialAdvisorRefresh</servlet-name> 
        <servlet-class>Crm.Servlets.SourceCustomerFinancialAdvisorRefresh</servlet-class> 
    </servlet>
    <servlet-mapping>
        <servlet-name>SourceCustomerFinancialAdvisorRefresh</servlet-name> 
        <url-pattern>/servlet/SourceCustomerFinancialAdvisorRefresh</url-pattern> 
    </servlet-mapping>

    <servlet>
        <servlet-name>SourceCustomerRefresh</servlet-name> 
        <servlet-class>Crm.Servlets.SourceCustomerRefresh</servlet-class> 
    </servlet>
    <servlet-mapping>
        <servlet-name>SourceCustomerRefresh</servlet-name> 
        <url-pattern>/servlet/SourceCustomerRefresh</url-pattern> 
    </servlet-mapping>

    <servlet>
        <servlet-name>SourceCustomerShadowFinancialAdvisorRefresh</servlet-name> 
        <servlet-class>Crm.Servlets.SourceCustomerShadowFinancialAdvisorRefresh</servlet-class> 
    </servlet>
    <servlet-mapping>
        <servlet-name>SourceCustomerShadowFinancialAdvisorRefresh</servlet-name> 
        <url-pattern>/servlet/SourceCustomerShadowFinancialAdvisorRefresh</url-pattern> 
    </servlet-mapping>

    <servlet>
        <servlet-name>SourceOfficerControl</servlet-name> 
        <servlet-class>Crm.Servlets.SourceOfficerControl</servlet-class> 
    </servlet>
    <servlet-mapping>
        <servlet-name>SourceOfficerControl</servlet-name> 
        <url-pattern>/servlet/SourceOfficerControl</url-pattern> 
    </servlet-mapping>

    <servlet>
        <servlet-name>SourceOfficerFinancialAdvisorControl</servlet-name> 
        <servlet-class>Crm.Servlets.SourceOfficerFinancialAdvisorControl</servlet-class> 
    </servlet>
    <servlet-mapping>
        <servlet-name>SourceOfficerFinancialAdvisorControl</servlet-name> 
        <url-pattern>/servlet/SourceOfficerFinancialAdvisorControl</url-pattern> 
    </servlet-mapping>

    <servlet>
        <servlet-name>SourceOfficerShadowFinancialAdvisorControl</servlet-name> 
        <servlet-class>Crm.Servlets.SourceOfficerShadowFinancialAdvisorControl</servlet-class> 
    </servlet>
    <servlet-mapping>
        <servlet-name>SourceOfficerShadowFinancialAdvisorControl</servlet-name> 
        <url-pattern>/servlet/SourceOfficerShadowFinancialAdvisorControl</url-pattern> 
    </servlet-mapping>

    <servlet>
        <servlet-name>TransferCustomerFinancialAdvisor</servlet-name> 
        <servlet-class>Crm.Servlets.TransferCustomerFinancialAdvisor</servlet-class> 
    </servlet>
    <servlet-mapping>
        <servlet-name>TransferCustomerFinancialAdvisor</servlet-name> 
        <url-pattern>/servlet/TransferCustomerFinancialAdvisor</url-pattern> 
    </servlet-mapping>

    <servlet>
        <servlet-name>TransferCustomerRelationshipOfficer</servlet-name> 
        <servlet-class>Crm.Servlets.TransferCustomerRelationshipOfficer</servlet-class> 
    </servlet>
    <servlet-mapping>
        <servlet-name>TransferCustomerRelationshipOfficer</servlet-name> 
        <url-pattern>/servlet/TransferCustomerRelationshipOfficer</url-pattern> 
    </servlet-mapping>

    <servlet>
        <servlet-name>TransferCustomerShadowFinancialAdvisor</servlet-name> 
        <servlet-class>Crm.Servlets.TransferCustomerShadowFinancialAdvisor</servlet-class> 
    </servlet>
    <servlet-mapping>
        <servlet-name>TransferCustomerShadowFinancialAdvisor</servlet-name> 
        <url-pattern>/servlet/TransferCustomerShadowFinancialAdvisor</url-pattern> 
    </servlet-mapping>

    <servlet>
        <servlet-name>UpdateCustomerMonitoringUnit</servlet-name> 
        <servlet-class>Crm.Servlets.UpdateCustomerMonitoringUnit</servlet-class> 
    </servlet>
    <servlet-mapping>
        <servlet-name>UpdateCustomerMonitoringUnit</servlet-name> 
        <url-pattern>/servlet/UpdateCustomerMonitoringUnit</url-pattern> 
    </servlet-mapping>

    <servlet>
        <servlet-name>SohPdfOutputter</servlet-name> 
        <servlet-class>Crm.Servlets.SohPdfOutputter</servlet-class> 
    </servlet>
    <servlet-mapping>
        <servlet-name>SohPdfOutputter</servlet-name> 
        <url-pattern>/servlet/SohPdfOutputter</url-pattern> 
    </servlet-mapping>

    <servlet>
        <servlet-name>variouscontrol</servlet-name> 
        <servlet-class>Crm.Servlets.variouscontrol</servlet-class> 
    </servlet>
    <servlet-mapping>
        <servlet-name>variouscontrol</servlet-name> 
        <url-pattern>/servlet/variouscontrol</url-pattern> 
    </servlet-mapping>

    <taglib>
        <taglib-uri>
       http://jakarta.apache.org/tomcat/debug-taglib
        </taglib-uri>
        <taglib-location>
           /WEB-INF/jsp/debug-taglib.tld
        </taglib-location>
    </taglib>

    <taglib>
        <taglib-uri>
       http://jakarta.apache.org/tomcat/examples-taglib
        </taglib-uri>
        <taglib-location>
           /WEB-INF/jsp/example-taglib.tld
        </taglib-location>
    </taglib>

    <resource-ref>
      <res-ref-name>mail/Session</res-ref-name>
      <res-type>javax.mail.Session</res-type>
      <res-auth>Container</res-auth>
    </resource-ref>

    <security-constraint>
      <display-name>Example Security Constraint</display-name>
      <web-resource-collection>
         <web-resource-name>Protected Area</web-resource-name>
     <!-- Define the context-relative URL(s) to be protected -->
         <url-pattern>/jsp/security/protected/*</url-pattern>
     <!-- If you list http methods, only those methods are protected -->
     <http-method>DELETE</http-method>
         <http-method>GET</http-method>
         <http-method>POST</http-method>
     <http-method>PUT</http-method>
      </web-resource-collection>
      <auth-constraint>
         <!-- Anyone with one of the listed roles may access this area -->
         <role-name>tomcat</role-name>
     <role-name>role1</role-name>
      </auth-constraint>
    </security-constraint>

    <!-- Default login configuration uses form-based authentication -->
    <login-config>
      <auth-method>FORM</auth-method>
      <realm-name>Example Form-Based Authentication Area</realm-name>
      <form-login-config>
        <form-login-page>/jsp/security/protected/login.jsp</form-login-page>
        <form-error-page>/jsp/security/protected/error.jsp</form-error-page>
      </form-login-config>
    </login-config>

    <!-- Environment entry examples -->
    <!--env-entry>
      <env-entry-description>
         The maximum number of tax exemptions allowed to be set.
      </env-entry-description>
      <env-entry-name>maxExemptions</env-entry-name>
      <env-entry-value>15</env-entry-value>
      <env-entry-type>java.lang.Integer</env-entry-type>
    </env-entry-->
    <env-entry>
      <env-entry-name>minExemptions</env-entry-name>
      <env-entry-value>1</env-entry-value>
      <env-entry-type>java.lang.Integer</env-entry-type>
    </env-entry>
    <env-entry>
      <env-entry-name>foo/name1</env-entry-name>
      <env-entry-value>value1</env-entry-value>
      <env-entry-type>java.lang.String</env-entry-type>
    </env-entry>
    <env-entry>
      <env-entry-name>foo/bar/name2</env-entry-name>
      <env-entry-value>true</env-entry-value>
      <env-entry-type>java.lang.Boolean</env-entry-type>
    </env-entry>
    <env-entry>
      <env-entry-name>name3</env-entry-name>
      <env-entry-value>1</env-entry-value>
      <env-entry-type>java.lang.Integer</env-entry-type>
    </env-entry>
    <env-entry>
      <env-entry-name>foo/name4</env-entry-name>
      <env-entry-value>10</env-entry-value>
      <env-entry-type>java.lang.Integer</env-entry-type>
    </env-entry>

    <!-- EJB Reference -->
    <ejb-ref>
      <description>Example EJB Reference</description>
      <ejb-ref-name>ejb/Account</ejb-ref-name>
      <ejb-ref-type>Entity</ejb-ref-type>
      <home>com.mycompany.mypackage.AccountHome</home>
      <remote>com.mycompany.mypackage.Account</remote>
    </ejb-ref>

    <!-- Local EJB Reference -->
    <ejb-local-ref>
      <description>Example Local EJB Reference</description>
      <ejb-ref-name>ejb/ProcessOrder</ejb-ref-name>
      <ejb-ref-type>Session</ejb-ref-type>
      <local-home>com.mycompany.mypackage.ProcessOrderHome</local-home>
      <local>com.mycompany.mypackage.ProcessOrder</local>
    </ejb-local-ref>
</web-app>

服务器在 :context.xml/Tomcat70/conf/

<?xml version='1.0' encoding='utf-8'?>
<Context>
   <WatchedResource>WEB-INF/web.xml</WatchedResource>
</Context>

答案 1

通过双击服务器名称打开服务器配置。之后,选中“将模块上下文发布到单独的XML文件”复选框。enter image description here,然后重新启动服务器

有时,它的工作原理是删除和添加服务器将解决此问题


答案 2

我删除了我的服务器并重新添加它。工作


推荐