18

I installed Tomcat on Windows 7 OS. I just installed Tomcat and made it available in eclipse. When i run any simple application on server it will say 404: page not found and in console it will print the error message like this.

SEVERE: Failed to open access log file [C:\Program Files\Apache Software           Foundation\Tomcat 7.0\logs\localhost_access_log.2014-08-30.txt]
java.io.FileNotFoundException: C:\Program Files\Apache Software Foundation\Tomcat      7.0\logs\localhost_access_log.2014-08-30.txt (Access is denied)
at java.io.FileOutputStream.open(Native Method)
at java.io.FileOutputStream.<init>(Unknown Source)
at org.apache.catalina.valves.AccessLogValve.open(AccessLogValve.java:1117)
at org.apache.catalina.valves.AccessLogValve.startInternal(AccessLogValve.java:1224)
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:1137)
at org.apache.catalina.core.StandardHost.startInternal(StandardHost.java:800)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1559)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1549)
at java.util.concurrent.FutureTask$Sync.innerRun(Unknown Source)
at java.util.concurrent.FutureTask.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)

I cannot understand what the things is happen is this??? Please help me.

f_puras
  • 2,521
  • 4
  • 33
  • 38
Anand Maheshwari
  • 309
  • 2
  • 3
  • 7
  • It looks like you have launched tomcat from a non-privileged account and it cannot write to the log directory. This is not a programming problem ... and therefore it is off topic. – Stephen C Aug 30 '14 at 06:27
  • But i installed in my Personal PC with Install as Administrative option. Still access is denied. Any way to solve??? – Anand Maheshwari Aug 30 '14 at 07:11
  • 1
    You have probably once launched Tomcat from the privileged account and it created a log file that its default, non privileged account cannot longer modify. Server Fault community may tell more. – Audrius Meškauskas Aug 30 '14 at 07:39

4 Answers4

22

It seems that your current user is not having rights on the tomcat folder.

I also faced the same problem and solved it by giving rights to the logged in user on the tomcat folder.

For your case :

Go to >>"C:\Program Files\Apache Software Foundation\Tomcat 7.0" folder Right Click>>Properties>>security Tab

provide required rights to currently logged in user.

sidcreative
  • 221
  • 2
  • 4
19

1] Open Tomcat C:\Program Files\Apache Software Foundation <br>(Right Click on Tomcat 8.5 ( as per Your Version)<br> →Properties <br> →Select Security Tab <br> →Edit <br> →Select Your System <br> →Check or Allow all the Boxes <br> →Click on Apply <br> →Restart Program

Vikas Kalapur
  • 415
  • 4
  • 12
1

Alternatively, you may decide to instruct embedded Tomcat instance to keep its log files in a different location, and outside Windows's native "Program Files" directory. Especially when it comes to latest Windows versions, it is not a good practice to write or keep any file with variable content (i.e. the file that is created or written to at runtime) in program files directory.

Search for TOMCAT_HOME/conf/server.xml for "AccessLogValve", and specify alternative directory for log files as demonstrated below:

<Valve className="org.apache.catalina.valves.AccessLogValve"
       directory="c:\work\tomcat\logs"
       prefix="localhost_access_log." suffix=".log" pattern="common"/>

The key attribute here is "directory".

leonidos79
  • 158
  • 2
  • 8
0

If you are facing this issue while starting tomcat from with-in IDE like Eclipse then you need to check if security is enabled under server detail -

Refer below screenshot

Eclipse IDE Tomcat Server Enable Security