Tomcat server does not run in localhost - eclipse

The Apache Tomcat server is started but it does not open in the browser (i.e. localhost) giving 404 error.
Tried changing port no in server.xml, then changing server location to Tomcat installation but nothing worked. Eclipse gives these errors while starting the Tomcat server, shown in the screenshot:

This usually only happens if your configuration is screwed up or the mapping from your IDE to your webapp folder. I would set server.xml back to normal. Then verify your web.xml file is in the correct location and configured properly. Look it up in your eclipse config and see if eclipse is actually finding it. Sometimes if your IDE does not find web.xml then when it builds you get a 404.
You can rule out your IDE by building your WAR then running it directly in Tomcat without eclipse.

Related

Liferay homepage is not found after starting the server in Eclipse

I have set up a Liferay Tomcat Server in Eclipse. After the server starts and I go to localhost:8181 (where I configured the server), the page is empty. Also, if I right click the server in Eclipse and select Open Liferay Portal Home, a 404 Page Not Found is displayed.
When I start the server outside Eclipse, with startup.bat, the page loads just fine.
Does anyone have a clue about why this might happen?
This answer assumes you're using Liferay IDE in Eclipse. It might be accurate even if you're not.
Try making your edits in the Eclipse workspace's server.xml file. The workspace should have a Servers folder, with your Tomcat Liferay server underneath it. The path in my workspace is as follows:
eclipse-luna-workspace/Servers/Liferay v6.2 CE Server (Tomcat 7) at localhost-config
Underneath the directory for the server are copies of the Tomcat configuration files, including server.xml. Make your edits to this server.xml file, restart your server in Eclipse, and Eclipse should copy it to the Tomcat instance at startup.
Where you defined Tomcat http port? And in which way Tomcat is configured in Eclipse?
These questions because Eclipse is able (but it's not mandatory) to override Tomcat default configurations.
Just a note: do you try to use Liferay plugin for Eclipse? It can help you to proper configure a Liferay server in Eclipse (and help you for development also).

Eclipse STS connecting to Tomcat

In Spring Tool Suite IDE, have added Tomcat server and started it. Console output says : INFO: Server startup in 19182 ms
But on trying url http://localhost:8080/, gives HTTP error 404
STS version - 3.6.2.
If server is started outside Eclipse, Tomcat homepage is accessible as usual.
Try http://localhost:9087/ and see if that works. You may need to check your configurations for other port numbers, but 9087 should work.
Got it working!
Wile running tomcat in eclipse, not all files are copied in the new deployment location in the eclipse workspace. But after manually copying index.jsp and related images, the home page came.

404 Error Apache Tomcat 7 running JSP file from Eclipse Juno IDE

I am using Tomcat 7 on the Eclipse IDE to run a JSP file.
It was working fine 2 days ago but now when I'm running my file a 404 Error is showing up:
HTTP Status 404 - /
type Status report
message /
description The requested resource is not available.
Apache Tomcat/7.0.34
I figured that the server is working fine as it would not give me the error if it wasn't responding. The port I'm using for Tomcat is 8089. Can the reason be that maybe Eclipse is trying to use another port instead of the one I set for the server?
What can I do to run my file without having this error?
Sometimes, when you're testing a webapp project, eclipse won't adding the full path to the JSP page you want to access and try to connect to http//localhost:8080/YOURPAGE.jsp, this is problematic as the context is missing.
Why are you using port 8089 and not 8080?
It is possible that the context is missing in the tomcat server.xml, do you have a line similar to this?
<Context docBase="WebProject" path="/WebProject" reloadable="true" source="org.eclipse.jst.jee.server:LoginServlet"/></Host>

Starting tomcat in eclipse vs command line

I am using tomcat 6 and when I start it from the command line the application it's running works fine, but when I start tomcat from eclipse (I added it as a server in eclipse) I get a 404 error when I try to run the application in my browser. Any ideas why this is?
By default, when you reference an existing Tomcat instance in Eclipse, only its engine is been used. All already-deployed webapps in Tomcat's /webapps folder are ignored. You seem to expect that they are also accessible when you start Tomcat from inside Eclipse.
You need to configure the Tomcat server reference in Eclipse to set Server Locations to Use Tomcat installation instead of (default) Use workspace metadata. Double click the Tomcat server entry in Servers view to edit it.
This way, everything which is deployed to Tomcat, outside control of Eclipse, will also be available when you start Tomcat from inside Eclipse.

Tomcat and Eclipse server configuration

I installed tomcat on my ubuntu. When i create a new Dynamic Web Project I choose the tomcat 7 server. When I launch my page it works on localhost:8080/app/page but if I go on localhost:8080 it give me a 404 error.
If i start tomcat server with an external script like /etc/init.d/tomcat start, it works but I cannot launch my app because it says that the port 8080 is already occupied (by the other instance of tomcat).
I'm confused on how set everything, I would start tomcat at boot and link that instance for my apps.
Can you explain how I hato to do?
Open the server configuration in the Servers tab on Eclipse. On "Server Locations", mark "Use Tomcat installation".
EDIT: to be more precise, this will make Eclipse "take control" of your Tomcat folder. So it will not just make a replica on eclipse .metadata and deploy only your apps on it; instead it will be like if you ran bin/startup, but using some of the configuration defined on Servers view. So if you go localhost:8080 you will see the Welcome page, because /ROOT is now started by Eclipse.
So, I am not against "Starting/Stopping" the server from eclipse but to keep it simple, I think you can stop the server from eclipse (Click on windows/showview/Servers and then stop the server). Then I think you should not get an error if you start tomcat again from external script. Then you can right click on your dynamic web project in eclipse and export it as a war file inside tomcat-install--dir/webapps. Where your web application is available (on which context) depends on the web.xml file. If you need further info on this plz let me know.