I am trying to test my servlet by running it on Tomcat. However, I get the above error (sometimes this error occurs, but before the servlet worked fine). A few facts:
I examined in detail the explanations for this similar problem , as well as here and here
When I try to restart Tomcat (from the Eclipse Servers tab), I get an error from the console:
"SEVERE: Could not open the access log file [~ \ Tomcat 7.0 \ logs \ localhost_access_log.2012-07-12.txt]" and at the very end of the log output, there is "INFO: SessionListener: sessionDestroyed ('E9A6117FDF54752D80A1B9B72F2B83D3') - for more details, see At the bottom of this text.
I looked at my log files in the folder "C: \ Program Files \ Apache Software Foundation \ Tomcat 7.0 \ logs" and there is no file with contents similar to that contained in paragraph (2) above
"Deploying" my application through Eclipse (that is, during development, I rely on Eclipse to run Tomcat), only doing a real deployment when I have a stable version of my project, copying the corresponding java class files to the Tomcat / webapps / WEB- folder INF / classes and restarting Tomcat
and, most importantly, 5. Entering into " http: // localhost: 8080 " takes me to the Tomcat homepage (so I'm sure the server is working), whereas " http: // localhost: 8080 / MyProjectName / MyServlet " in the browser results in the error indicated in this question header.
Any ideas / help? Thank you very much!
See more error logs here.
>!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.<init>(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 <init> 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')