Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Got apache tomcat error that access denied on this file localhost_access_log.2014-08-30.txt?

I installed Apache tomcate on Windows 7 OS. I just installed apache and make 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.

like image 607
Anand Maheshwari Avatar asked Aug 30 '14 05:08

Anand Maheshwari


3 Answers

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.

like image 170
sidcreative Avatar answered Oct 18 '22 10:10

sidcreative


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

like image 23
Vikas Kalapur Avatar answered Oct 18 '22 09:10

Vikas Kalapur


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".

like image 36
leonidos79 Avatar answered Oct 18 '22 10:10

leonidos79