Reputation: 105
When I run apache tomcat 7.0 alone, it works without any flaw in my browser I can execute the examples also, but when I apache tomcat 7.0 in eclipse I'm getting a 404 error message saying that "requested resource is not available". I just type the session example program and run it again, it shows this 404 error message only.
How do I resolve it?
I don't know whether it's the problem with tomcat or with eclipse..
Please help!!
Upvotes: 3
Views: 5598
Reputation: 71
At the left column, under Server Locations, select Use Tomcat installation radio button ,browse Server Path of the Tomcat Root directory(Ex: D:\RaviTeja\installed\apache-tomcat-7.0.57) and browse Deploy path aslo webapps folderof tomcat
(Ex: D:\RaviTeja\installed\apache-tomcat-7.0.57\webapps)
.
This way Eclipse will take full control over Tomcat, this way you'll also be able to access the default Tomcat homepage with the Tomcat Manager when running from inside Eclipse. 3. Please find below Tomcat configuration screen shot.
Upvotes: 0
Reputation: 11
try doing the following steps:
Eclipse forgets to copy the default apps (ROOT, examples, etc.) when it creates a Tomcat folder inside the Eclipse workspace.
Go to C:\apache-tomcat-7.0.34\webapps,
R-click on the ROOT folder and copy it.
Then go to your Eclipse workspace,
go to the .metadata folder, and
search for "wtpwebapps".
You should find something like
your-eclipse-workspace\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\wtpwebapps
(or .../tmp1/wtpwebapps
if you already had another server registered in Eclipse).
Go to the wtpwebapps folder, R-click, and paste ROOT (say "yes" if asked if you want to merge/replace folders/files).
Then reload tomcat test pagea to see the Tomcat welcome page.
Upvotes: 1
Reputation: 1
I had a similar issue with my project. Maybe Eclipse forgets to copy the default apps (ROOT, examples, etc.) when it creates a Tomcat folder inside the Eclipse workspace. Go to webapps directory inside apache directory (for example C:\apache-tomcat-7.0.34\webapps), right click on the ROOT folder and copy it. Then go to your Eclipse workspace, go to the .metadata folder, and search for "wtpwebapps". Start the Tomcat server by eclipse. You should find something like your-eclipse-workspace.metadata.plugins\org.eclipse.wst.server.core\tmp0\wtpwebapps (or .../tmp1/wtpwebapps if you already had another server registered in Eclipse). Pay attention that the folder tmp0 is present only if the server is started. Go to the wtpwebapps folder, right click, and paste ROOT (say "yes" if asked to override folders/files). Then try to see the Tomcat welcome page. Bye Monica
Upvotes: 0
Reputation: 48589
I feel your pain. I am also using Tomcat 7.0, and I've gotten servlets to work in Tomcat doing everything by hand. Then a couple of days ago I downloaded eclipse, and after a struggle I successfully got some servlets to work in eclipse.
I downloaded the Java EE
version of eclipse here:
http://www.eclipse.org/downloads/
And then I followed this tutorial:
http://www.vogella.com/articles/EclipseWTP/article.html
The tutorial is a little out of date, but I managed to get eclipse setup correctly using that tutorial. In a couple of places, the tutorial says to click on Window->Preferences->..., which for me was equivalent to Eclipse->Preferences->.... The biggest problem I had was when the tutorial said:
Create a new package called ....
There were no instructions on how to create a new package. The way you create a new package is by looking in your project folder for:
--JavaResources
--src
Then right click on the src folder and select:
New-->Package
Send me a comment if you have any questions about any of the steps in the tutorial.
I got that 404 Error constantly until I figured out what was the correct path with which to call the servlet. If you are calling the servlet, say with a <form>
's action attribute, the url should look like this:
<form action="/<project name>/WelcomeServlet" method="get">
And that would correspond to a web.xml something like this:
<servlet>
<servlet-name>WelcomeServlet</servlet-name>
<servlet-class>com.exmaple.WelcomeServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>WelcomeServlet</servlet-name>
<url-pattern>/WelcomeServlet</url-pattern>
</servlet-mapping>
Are you using servlets 3.0 or 2.5? With 3.0 you use the syntax:
@WebServlet("/WelcomeServlet")
public class WelcomeServlet extends HttpServlet {
for the url mapping instead of a web.xml file.
Upvotes: 0
Reputation: 4568
I think your eclipse is configured to load a webapp folder that is not the one installed with tomcat, please follow the steps below:
-Dwtp.deploy=...
Upvotes: 1