title: java.io.FileNotFoundException: C:\Program Files\Apache Software Foundation\Tomcat 7.0\logs\localhost_access_log.2012-07-12.txt (Access is denied)
body: <p>I'm trying to test my servlet by running it on Tomcat. However, I get the above error (sometimes this error occurs, but earlier the servlet was running fine). A few facts:</p>
  
  <ol>
  <li><p>I've looked thoroughly at the explanations given by <a href="https://stackoverflow.com/questions/10207033/http-status-404-description-the-requested-resource-is-not-available-apache-t">this similar problem</a>, as well as in <a href="https://stackoverflow.com/questions/4728110/the-requested-resource-is-not-available-when-running-tomcat-7-0-after-downl">here</a>, and <a href="https://stackoverflow.com/questions/2280064/tomcat-started-in-eclipse-but-unable-to-connect-to-link-to-http-localhost8085">here</a></p></li>
  <li><p>When I attempt to restart Tomcat (from within Eclipse's "Servers" tab), I get some error log from the console:</p></li>
  </ol>
  
  <p>"SEVERE: Failed to open access log file [~\Tomcat 7.0\logs\localhost_access_log.2012-07-12.txt]" and at the very end of the log output, there's "INFO: SessionListener: sessionDestroyed('E9A6117FDF54752D80A1B9B72F2B83D3') -- see more info at the bottom of this text</p>
  
  <ol start="3">
  <li><p>I've looked at my log files at " C:\Program Files\Apache Software Foundation\Tomcat 7.0\logs" and there is not file with contents similar to the ones in item (2) above</p></li>
  <li><p>I 'deploy' my application through Eclipse (that is, during development, I depend on Eclipse to start Tomcat), only doing a real deployment when I have a stable version of my project by copying the appropriate java class files into Tomcat's /webapps/WEB-INF/classes folder and restarting Tomcat</p></li>
  </ol>
  
  <p>and most importantly,
  5. Typing in "<a href="http://localhost:8080" rel="nofollow noreferrer">http://localhost:8080</a>" leads me to the Tomcat homepage (so I'm pretty sure the server is running), whereas "<a href="http://localhost:8080/MyProjectName/MyServlet" rel="nofollow noreferrer">http://localhost:8080/MyProjectName/MyServlet</a>" in the browser leads to the error shown this question's title. </p>
  
  <p>Any ideas/help?
  Thank you very much!</p>
  
  <p>See more of the error logs here</p>
  
  <pre><code>&gt;!Jul 12, 2012 6:18:18 PM org.apache.catalina.core.AprLifecycleListener init
  INFO: The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: C:\Program Files\Java\jdk1.7.0\jre\bin;C:\Windows\Sun\Java\bin;C:\Windows\system32;C:\Windows;C:/Program Files/Java/jre7/bin/client;C:/Program Files/Java/jre7/bin;C:/Program Files/Java/jre7/lib/i386;C:\Users\Kiptoo\introcs\java\bin;C:\Windows\system32;C:\Windows;C:\Windows\system32\wbem;C:\Program Files\MiKTeX 2.8\miktex\bin;C:\Windows\System32\WindowsPowerShell\v1.0;C:\Program Files\Matlab\R2010a\runtime\win32;C:\Program Files\Matlab\R2010a\bin;C:\Program Files\TortoiseSVN\bin;C:\Program Files\QuickTime\QTSystem;C:\Users\Kiptoo\introcs\bin;C:\Users\Kiptoo\introcs\java\bin;C:\Python27;C:\Program Files\Eclipse;;.
  Jul 12, 2012 6:18:20 PM org.apache.coyote.AbstractProtocol init
  INFO: Initializing ProtocolHandler ["http-bio-8080"]
  Jul 12, 2012 6:18:20 PM org.apache.coyote.AbstractProtocol init
  INFO: Initializing ProtocolHandler ["ajp-bio-8009"]
  Jul 12, 2012 6:18:20 PM org.apache.catalina.startup.Catalina load
  INFO: Initialization processed in 2050 ms
  Jul 12, 2012 6:18:20 PM org.apache.catalina.core.StandardService startInternal
  INFO: Starting service Catalina
  Jul 12, 2012 6:18:20 PM org.apache.catalina.core.StandardEngine startInternal
  INFO: Starting Servlet Engine: Apache Tomcat/7.0.25
  Jul 12, 2012 6:18:20 PM org.apache.catalina.valves.AccessLogValve open
  SEVERE: Failed to open access log file [C:\Program Files\Apache Software Foundation\Tomcat 7.0\logs\localhost_access_log.2012-07-12.txt]
  java.io.FileNotFoundException: C:\Program Files\Apache Software Foundation\Tomcat 7.0\logs\localhost_access_log.2012-07-12.txt (Access is denied)
      at java.io.FileOutputStream.open(Native Method)
      at java.io.FileOutputStream.&lt;init&gt;(FileOutputStream.java:212)
      at org.apache.catalina.valves.AccessLogValve.open(AccessLogValve.java:1115)
      at org.apache.catalina.valves.AccessLogValve.startInternal(AccessLogValve.java:1222)
      at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
      at org.apache.catalina.core.StandardPipeline.startInternal(StandardPipeline.java:185)
      at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
      at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:1144)
      at org.apache.catalina.core.StandardHost.startInternal(StandardHost.java:782)
      at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
      at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1568)
      at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1558)
      at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
      at java.util.concurrent.FutureTask.run(FutureTask.java:166)
      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)
  
  Jul 12, 2012 6:18:20 PM org.apache.catalina.startup.HostConfig deployDirectory
  INFO: Deploying web application directory C:\Program Files\Apache Software Foundation\Tomcat 7.0\webapps\AndroidTest
  Jul 12, 2012 6:18:20 PM org.apache.catalina.core.StandardContext postWorkDirectory
  WARNING: Failed to create work directory [C:\Program Files\Apache Software Foundation\Tomcat 7.0\work\Catalina\localhost\AndroidTest] for context [/AndroidTest]
  Jul 12, 2012 6:18:21 PM org.apache.catalina.util.SessionIdGenerator createSecureRandom
  INFO: Creation of SecureRandom instance for session ID generation using [SHA1PRNG] took [175] milliseconds.
  Jul 12, 2012 6:18:21 PM org.apache.jasper.EmbeddedServletOptions &lt;init&gt;
  SEVERE: The scratchDir you specified: C:\Program Files\Apache Software Foundation\Tomcat 7.0\work\Catalina\localhost\AndroidTest is unusable.
  Jul 12, 2012 6:18:21 PM org.apache.catalina.startup.HostConfig deployDirectory
  INFO: Deploying web application directory C:\Program Files\Apache Software Foundation\Tomcat 7.0\webapps\docs
  Jul 12, 2012 6:18:21 PM org.apache.catalina.startup.HostConfig deployDirectory
  INFO: Deploying web application directory C:\Program Files\Apache Software Foundation\Tomcat 7.0\webapps\examples
  Jul 12, 2012 6:18:21 PM org.apache.catalina.core.ApplicationContext log
  INFO: ContextListener: contextInitialized()
  Jul 12, 2012 6:18:21 PM org.apache.catalina.core.ApplicationContext log
  INFO: SessionListener: contextInitialized()
  Jul 12, 2012 6:18:21 PM org.apache.catalina.core.ApplicationContext log
  INFO: ContextListener: attributeAdded('org.apache.jasper.compiler.TldLocationsCache', 'org.apache.jasper.compiler.TldLocationsCache@ff8399')
  Jul 12, 2012 6:18:21 PM org.apache.catalina.startup.HostConfig deployDirectory
  INFO: Deploying web application directory C:\Program Files\Apache Software Foundation\Tomcat 7.0\webapps\host-manager
  Jul 12, 2012 6:18:22 PM org.apache.catalina.startup.HostConfig deployDirectory
  INFO: Deploying web application directory C:\Program Files\Apache Software Foundation\Tomcat 7.0\webapps\manager
  Jul 12, 2012 6:18:22 PM org.apache.catalina.startup.HostConfig deployDirectory
  INFO: Deploying web application directory C:\Program Files\Apache Software Foundation\Tomcat 7.0\webapps\ROOT
  Jul 12, 2012 6:18:22 PM org.apache.coyote.AbstractProtocol start
  INFO: Starting ProtocolHandler ["http-bio-8080"]
  Jul 12, 2012 6:18:22 PM org.apache.coyote.AbstractProtocol start
  INFO: Starting ProtocolHandler ["ajp-bio-8009"]
  Jul 12, 2012 6:18:22 PM org.apache.catalina.startup.Catalina start
  INFO: Server startup in 2225 ms
  Jul 12, 2012 6:19:22 PM org.apache.catalina.core.ApplicationContext log
  INFO: SessionListener: sessionDestroyed('E9A6117FDF54752D80A1B9B72F2B83D3')
  </code></pre>