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.
Related
As I understood the situation, there is a conflict between the Tomcat server from outside the Eclipse with the Tomcat server from inside the Eclipse. I attached some picture that will explain the situation and I hope I can get your helpWhen I start the server from outside the Eclipse, but I have access the home page for the Tomcat server
When I want to start the Eclipse server while the Tomcat still working
[I stopped the Tomcat server from the Task manager, thus the Eclipse server start without conflict][3]
[With the Eclipse sserver, I lost the access to the Tomcat home page even it says the server tomcat working][4]
The problem is that the tomcat server must not start from inside the Eclipse, it should start from the cmd screen by using the files startup.dat and shutdown by using the shutdown.dat file using their path in the cmd like this:
D:\Apache-Software-Foundation\Tomcat-8.0\bin\startup.bat
D:\Apache-Software-Foundation\Tomcat-8.0\bin\shutdown.bat
As well as there is another problem, which is the server should change the folder name from (Apache Software Foundation) to (Apache-Software-Foundation). Otherwise, it will cause a problem when creating the Path for the server as well as it's better to install it on the Logical partition not in the System partition to avoid any configuration problem.
I have created a dynamic web application using eclipse. it consist of java servlet and jsp and it run on tomcat 7.2.it runs fine under any browser if run it through a eclipse, copy the address and paste it in browser while eclipse is running. I wish to run this application without running eclipse. for this i run the tomcat manually using startup command. however than when i use the website address of my web site in the browser it says resource not found. I want to run this without actually running eclipse. any suggestion please.
You'll need to deploy the war file that was built by Eclipse to your new Tomcat server. You can just copy it to <tompcat-instrallation-path>/webapps location. It will be exploded by Tomcat automatically and you'll be able to see your pages at:
http://localhost:<port>/<name-of-your-war>/...
Where <port> is usually 8080 if you didn't change it in Tomcat's config and <name-of-your-war> is the name of your war without .war extension.
You will need to take the built war file, name it ROOT.war, and place it in the /webapps directory in your tomcat directory. Tomcat gives instructions for this, you will replace the ROOT.war that is there by default. You should also check to make sure you are using the same port on which Tomcat is running.
I'm running Tomcat in Eclipse. I would like to see the Tomcat home page, however it doesn't show up. When I browse http://localhost:8080, then I get a HTTP 404 Page Not Found error.
How is this caused and how can I solve it?
Eclipse does by default not use Tomcat standalone. Instead, it overtakes its sole server engine and uses the workspace as deployment space instead of Tomcat's own /webapps folder. It also creates copies of configuration files like server.xml in the Servers project. It untouches the Tomcat installation. It untouches the Tomcat default homepage (and manager). It untouches existing deployments.
As the Tomcat homepage is not one of Eclipse projects (nor would become one), you won't see it when starting Tomcat from inside Eclipse like that. You would only see Eclipse projects which are deployed to the server by Add/Remove projects. I'm not sure why you need to see the Tomcat homepage as it has no utter value while developing Java EE web projects. But if you are really dead set on seeing it for some unclear reason, then you'd need to tell Eclipse to not only overtake its engine, but instead use the standalone installation at its entirety.
To configure that, double click Tomcat's entry in Servers view to open its configuration and in the Server Locations section, choose the option Use Tomcat installation.
You'll now be able to see Tomcat's homepage.
Again, the benefit is highly questionable. Do note that this way Eclipse will modify the Tomcat installation. So the Tomcat installation may not be reuseable across other IDEs/workspaces. You'd need to create a whole new Tomcat installation.
In eclipse,right click over tomcat server in servier view.
tomcate->properties.click switch location.
Try the following steps once:
1.Remove schoolManagementsystem folder and war file from webapps folder
2.Task Manager--> end the all java process
3.Now execute the command catalina.bat run in command prompt.
Hope this will help you .
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.
I have installed Tomcat 7 server on Windows on port 8088.
Now I have added the server in Eclipse.
But I am not sure whether I need to keep the Tomcat running by going in the Tomcat directory or I have to close that and run from Eclipse?
And how will Eclipse know that I have setup the Tomcat on port 8088?
In the server view, you can double-click on your tomcat server and change the ports. This means that the folder where you have tomcat running (CATALINA_HOME) can still be used run Tomcat "production" and eclipse will use the same binaries to run within WTP. However, all other folders will be confiurable for your "dev" instance.
Actually you'd better change the settings to make sure there is no collision between eclipse ports and the ports declared at windows level.
Another simple solution is to stop tomcat at the windows level. Eclipse will take care of its own instance.
Other useful settings you can modify are the timeouts (in debug it's sometimes necessary), the deploy folder and even add some more web apps (modules tab).
do i need to keep the tomcat running
by going in the tomcat directory or i
have to close that and run from
eclispe.
No you don't need to keep tomcat running outside. You can run/stop it whenever you want from eclipse.
how will eclipse know that i have
setup the 8088 port
You will find project named Server or Servers; depends on eclipse version; in your workspace; in which you have added tomcat. It has tomcat configuration file which tells eclipse how to manage tomcat. It has a file called server.xml which contain port information that is on which port tomcat will run.