44
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?

ROMANIA_engineer
  • 54,432
  • 29
  • 203
  • 199
Claudio Pomo
  • 2,392
  • 7
  • 42
  • 71
  • See my post at http://stackoverflow.com/questions/6703988/unable-to-run-on-server-a-webapp-from-eclipse/12292469#12292469 Hope it helps you... – Alejo Ceballos Sep 06 '12 at 03:22

20 Answers20

48

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.

DiscDev
  • 38,652
  • 20
  • 117
  • 133
  • 2
    No need to remove server, just remove the modules, [save], and re-add them back [save] – hello_harry Nov 07 '16 at 18:48
  • @hello_harry I'm sure that works as well - I've just had so many bad experiences in this area, that I prefer to start over to make sure I'm starting clean. – DiscDev Nov 09 '16 at 20:02
  • If you run into this on a Mac, creating a new server would work but it might be better to create it using a tomcat installation installed from a zip file, not from `brew`. Download a tomcat zip, unzip it and specify the unzipped file as the "tomcat installation directory" when creating a new server – kakoma Sep 12 '17 at 03:02
20

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.

Socas
  • 301
  • 2
  • 5
10

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.

ROMANIA_engineer
  • 54,432
  • 29
  • 203
  • 199
  • 1
    Ok, that worked for me, but WTF was that? Why do we need to do smthng like this to start simple application? – Dante Aug 31 '16 at 11:38
6

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)

Bnrdo
  • 5,325
  • 3
  • 35
  • 63
  • +1 for pointing me to the right direction: After changing the build process to gradle, there was a missing entry under "Deployment Assembly", and therefore the directory under wtpwebapps was not created. – Thomas Schütt Jun 06 '17 at 13:32
  • Been beating my laptop for more than 1 day, thank you, kind sir, for providing this answer. – Parag Jadhav May 03 '19 at 09:05
5

If using Eclipse STS

  1. open the server view

  2. select the server that you're trying to publish to

  3. right click -> clean

I had this problem come up a couple of times and this always seemed to fix it. I suppose the other solutions work too but they seem more complicated to me.

enter image description here

ilinca
  • 1,343
  • 15
  • 17
4

This could happen because "Tomcat\conf\Catalina" folder. Please delete this folder.

General Grievance
  • 4,555
  • 31
  • 31
  • 45
3

Looking at the exception you get, this looks like a problem with publishing your WEB-App (eg. Eclipse WTP could mess something up). First things that come in my mind:

Check your Tomcat server settings: go to Servers - double click on your server. Get your 'Server Locations - Server Path' and check if it exists and check the user/group read/write permissions. eg. ls -lh somepath/.medadata/.plugins/.org.eclipse.wst.server.core/tmp0 You must be owner or at least in same group for the folder.

Clean the eclipse workspace. (Project - clean all)

Clean/Republish your wep-app (right click on server, clean, publish).

Check if the application is published, there should be a folder named Preventini in /home/claudio/workspace/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/ Also check the permissions here again (see above).

proko
  • 1,180
  • 1
  • 7
  • 14
  • not work! the web-app isn't published in the /wtpwebapps folder. This folder has all permission – Claudio Pomo Dec 13 '11 at 17:38
  • If possible remove the "old" tomcat server, delete the workspace\.metadata\.plugins\org.eclipse.wst.server.core\publish folder and then try to add the tomcat again. Check if the web-app is published now. About your Eclipse... Are you using Eclipse Indigo or an older version of Eclipse (plugins uptodate?)? You can also try to start eclipse with --clean. – proko Dec 13 '11 at 20:00
  • I'm using Eclipse 3.7. I've tried so far but problem isn't solved. – Claudio Pomo Apr 05 '12 at 12:03
2

I got this problem when I imported a project and run it with Tomcat. I fixed it when I opened .project file and added some code:

<nature>org.eclipse.wst.common.project.facet.core.nature</nature>
<nature>org.eclipse.wst.common.modulecore.ModuleCoreNature</nature>
<nature>org.eclipse.jem.workbench.JavaEMFNature</nature>
ROMANIA_engineer
  • 54,432
  • 29
  • 203
  • 199
harry
  • 31
  • 2
2

Happened to me a couple of times.

Windows > Show view > Servers>

A List of servers will be displayed at bottom Right click on it and delete.

Now while running your project, Manually re select the server from list of existing servers and run.

yprez
  • 14,854
  • 11
  • 55
  • 70
imsolo
  • 39
  • 4
1

I had to remove an offending project/module from the tomcat config view, under the modules tab.

AmanicA
  • 4,659
  • 1
  • 34
  • 49
1

i have solved this error by adding removing and adding again the jar files from WebContent/WEB-INF/lib folder. and i did the same in properties of project ie(Right click on project->Build Path->configure build Path) by selecting Add External Jar option.

0

Go to Tomcat Manager Select web app -> undeploy it

Priyan
  • 103
  • 1
  • 2
  • 7
0

Today I was working with some other project and getting some errors in starting server (tomcat7), so first I cleaned the server and tried but no luck, then I deleted the server and made new one.

The project on which I was working was started working fine, but another project started giving me the same exception, I again deleted the server and tried but the same case, even I was unable to hit the tomcat landing page i.e. localhost:8888/. I really don't know how and why all that happened.

I tried several things like clean,add/remove then I started searching SO.

After some research I thought to give one more chance then I started server again this time both of my projects started working fine but still getting 404 on tomcat page

SSH
  • 1,609
  • 2
  • 22
  • 42
0

As a trivial problem, the project that you're trying to start can be closed (this could be missable, if you have many projects into the workspace!). Just do right click -> Open Project, in this case.

enter image description here

Andrea
  • 6,032
  • 2
  • 28
  • 55
0

I came across this problem today, then solve it by editing the server.xml in directory of %tomcat_home%\conf, just as below:

<Context docBase="E:\apache-tomcat-7.0.52\webapps\ROOT" path="/ROOT" reloadable="true" source="org.eclipse.jst.j2ee.server:pc-ui"/>

I don't know whether it is MyEclipse that have genarated the "Context" element in element of "Host", but I change it according to the error info diaplayed in IDE console.

Tunaki
  • 132,869
  • 46
  • 340
  • 423
tiger
  • 1
  • 2
0

I got this error a few times. I got it because my project wasn't building correctly after running the "mvn eclipse:eclipse" line. Make sure your project is being built correctly, then add and remove the project from the server.

dev4life
  • 880
  • 2
  • 8
  • 18
0

This could happen if you execute maven to build a java project

mvn eclipse:eclipse 

Instead of executing maven to build a web java project as:

mvn eclipse eclipse -Dwtpversion=2.0
JavaSheriff
  • 7,074
  • 20
  • 89
  • 159
0

You can look into tomcat\conf\Catalina\localhost,if you can see the xml file which its name matches your error message.You can just delete the xml file and restart your tomcat.

dingjsh
  • 367
  • 1
  • 2
  • 15
-1

Try , right click tomcat --> Add / Remove , then in opened window , remove All projects in Configured side..

Then restart tomcat .

canmurat
  • 159
  • 11
-1

Before adopting any other solution, make sure that the project is open.

otaviodecampos
  • 1,586
  • 16
  • 10