Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Eclipse tomcat error: Document base does not exist or is not a readable directory

13-dic-2011 17.00.36 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: /usr/lib/jvm/java-6-openjdk/jre/lib/amd64/server:/usr/lib/jvm/java-6-openjdk/jre/lib/amd64:/usr/lib/jvm/java-6-openjdk/jre/../lib/amd64:/usr/java/packages/lib/amd64:/usr/lib/jni:/lib:/usr/lib
13-dic-2011 17.00.36 org.apache.tomcat.util.digester.SetPropertiesRule begin
AVVERTENZA: [SetPropertiesRule]{Server/Service/Engine/Host/Context} Setting property 'source' to 'org.eclipse.jst.jee.server:Preventivi' did not find a matching property.
13-dic-2011 17.00.36 org.apache.coyote.AbstractProtocol init
INFO: Initializing ProtocolHandler ["http-bio-8080"]
13-dic-2011 17.00.36 org.apache.coyote.AbstractProtocol init
INFO: Initializing ProtocolHandler ["http-bio-8443"]
13-dic-2011 17.00.37 org.apache.coyote.AbstractProtocol init
INFO: Initializing ProtocolHandler ["ajp-bio-8009"]
13-dic-2011 17.00.37 org.apache.catalina.startup.Catalina load
INFO: Initialization processed in 983 ms
13-dic-2011 17.00.37 org.apache.catalina.core.StandardService startInternal
INFO: Starting service Catalina
13-dic-2011 17.00.37 org.apache.catalina.core.StandardEngine startInternal
INFO: Starting Servlet Engine: Apache Tomcat/7.0.23
13-dic-2011 17.00.37 org.apache.catalina.core.StandardContext resourcesStart
GRAVE: Error starting static Resources
java.lang.IllegalArgumentException: Document base /home/claudio/workspace/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/Preventivi does not exist or is not a readable directory
    at org.apache.naming.resources.FileDirContext.setDocBase(FileDirContext.java:140)
    at org.apache.catalina.core.StandardContext.resourcesStart(StandardContext.java:4880)
    at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5060)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
    at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1525)
    at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1515)
    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:636)
13-dic-2011 17.00.37 org.apache.catalina.core.StandardContext startInternal
GRAVE: Error in resourceStart()
13-dic-2011 17.00.37 org.apache.catalina.core.StandardContext startInternal
GRAVE: Error getConfigured
13-dic-2011 17.00.37 org.apache.catalina.core.StandardContext startInternal
GRAVE: Context [/Preventivi] startup failed due to previous errors
13-dic-2011 17.00.37 org.apache.coyote.AbstractProtocol start
INFO: Starting ProtocolHandler ["http-bio-8080"]
13-dic-2011 17.00.37 org.apache.coyote.AbstractProtocol start
INFO: Starting ProtocolHandler ["http-bio-8443"]
13-dic-2011 17.00.37 org.apache.coyote.AbstractProtocol start
INFO: Starting ProtocolHandler ["ajp-bio-8009"]
13-dic-2011 17.00.37 org.apache.catalina.startup.Catalina start
INFO: Server startup in 319 ms

I've run my webapp project in Eclipse, but today I received the message in console. Tomcat return me a 404 page error. Maybe the problem is that the folder where I would write doesn't exist. Where is the trick?

like image 355
Claudio Pomo Avatar asked Dec 13 '11 16:12

Claudio Pomo


4 Answers

The easiest solution (and what worked for me) was to delete my tomcat server from the "Servers" view in Eclipse, then create a new server and add all the appropriate modules to it.

Sometimes tomcat gets confused and the easiest/least time consuming way to resolve things is to start over.

like image 196
DiscDev Avatar answered Nov 04 '22 21:11

DiscDev


i have the same error, just run this maven command repeatedly and solve the problem.

mvn eclipse:clean eclipse:eclipse -Dwtpversion=2.0

eclipse was not recognizing that this was a web project, so never deploy the application.

like image 23
Socas Avatar answered Nov 04 '22 22:11

Socas


I had the same problem using Tomcat 7 & Eclipse Mars.
I solved it as follows:

  • stop Tomcat
  • open server.xml

    Ctrl + Shift + R > type "server.xml" > Open

  • search for "<Context docBase"

    Ctrl + F > type "<Context" > Find

  • remove all <Context .../> tags from here:

    <?xml version="1.0" encoding="UTF-8"?>
    ...
    <Server port="8005" shutdown="SHUTDOWN">
        ...
        <Service name="Catalina">
            ...
            <Engine defaultHost="localhost" name="Catalina">
                ...
                <Host appBase="webapps" autoDeploy="true" name="localhost" unpackWARs="true">
                    ...
                    <!-- Remove the following lines! -->
                    <Context docBase="App1" path="/App1" reloadable="true" source="org.eclipse.jst.j2ee.server:App1" />
                    <Context docBase="App2" path="/App2" reloadable="true" source="org.eclipse.jst.j2ee.server:App2" />
                </Host>
            </Engine>
        </Service>
    </Server>
    
    • probably at the end of the last line that has to be removed is </Host> (don't remove </Host>!)
  • Go to Servers tab > right click on the project(s) > Remove > OK

    remove

  • Right click on the project > Run As > Run on Server > Finish

    Now it should work!
    If you check the server.xml file, you'll see that a new correct "<Context ... />" line was generated.

like image 10
ROMANIA_engineer Avatar answered Nov 04 '22 21:11

ROMANIA_engineer


This might be late but for the benefit of the those who might encounter the same problem in the future, I'll share what I experienced.

I got this problem after I deleted the WebContent folder of the Dynamic Web Project I just created in place of webapp folder which is the standard folder of my company. I found out that, in Project Properties > Deployment Assembly, WebContent folder is still used as the root of the web application (Deploy Path : "/"). Thus, Eclipse doesn't copy the project to .metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps because the root specified in Deployment Assembly does not exist anymore.

I fixed it by editing that entry then correcting it with the folder I am using in place of the default WebContent (the webapp folder)

like image 6
Bnrdo Avatar answered Nov 04 '22 20:11

Bnrdo