Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
582 views
in Technique[技术] by (71.8m points)

java - Tomcat Error: WARNING: Failed to retrieve JNDI naming context for container

I am encountering the following error within the catalina.2013-12-31.log file on the Tomcat70/logs/ folder, when I attempt to start a recently deployed web application on Tomcat 7.

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)

My application is a JDK7 Web Application. I have tried to look for similar questions and tried some suggestions such as restarting the server (in order to get to clear some XML files), but it did not work.

Any ideas please?

Update:

This is what I have in 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>

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

open server configuration by double-clicking on the server name. after that check the checkbox of "Publish module contexts to separate XML files". enter image description here and then restart the server

Sometimes, It's worked by removing and adding the server will resolves this issue


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...