Tomcat and Eclipse server configuration - eclipse

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.

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).

running java web projects using Eclipse and tomcat issue

I have installed tomcat 7.0.37 and Eclipse juno on ubuntu 12.10 and build my first jsp based web app. but when I hit run as -> run on server eclipse shuts down. one issue is that on restart tomcat does not start and pops the error:
Several ports (8005, 8081, 8009) required by Tomcat v7.0 Server at localhost (2) are already > in use. The server may already be running in another process, or a system process may be >using the port. To start this server you will need to stop the other process or change the >port number(s).
In Tomcat installation folder, you can find a folder called conf and in that you can find a XML file server.xml.
This file contains the ports Tomcat has to use. Update that file with different port numbers and try again.
Okay, at last I solved it. first I changed the default browser from internal to system default and it solved the eclipse shut down. second I moved the files into the Web Content folder under project structure. and now I have a running JSP application. thanks to all geeks on web.
:)
If You use eclipse then double click on servers and double click on tomcat server then one file will open. in that change HTTP port to some other port number and save(ctrl+s) then again start the server . it may be work fine

Tomcat home page is not showing when running in Eclipse

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 .

How to configure gwt application on tomcat for debugging?

I am trying to debug a GWT application on Tomcat, but I don't know how to run/debug my application on Tomcat in Eclipse. I have so many links but I can't get a proper result.
I'm using -noserver -port 8080 and war file configuration but every time I get an error 404 while I run the application.
Here are some links that I follow but I can't configure:
http://groups.google.com/group/google-web-toolkit/browse_thread/thread/7511aca28b5f683c
https://developers.google.com/eclipse/docs/faq#gwt_in_eclipse_for_java_ee
http://jxpang.blogspot.in/2010/11/configure-external-tomcat-7-server-in.html
update
I am having same url but i think i am doing wrong configuration. is any body has proper solution for configure gwt web application with apche tomcat with debugging.
I want step by step configuration and running tutorial
please help me.
So you connect to the local server, but it can't resolve your URL?
If you stick with all the defaults, then in dev-mode you would use the following URL:
http://127.0.0.1:8888/index.html?gwt.codesvr=127.0.0.1:9997
But when configured on an external server you would need:
http://localhost:8080/MyApplication/index.html?gwt.codesvr=127.0.0.1:9997
Also make sure that in the 'Server' tab of your Debug configuration the option Run built in server is unchecked.
Hope this helps!
In Eclipse: right-click on your GWT project, and choose "Run As web Application (running on an external server)"
Then you can fill the field External root server (dns/ip and webapps folder for tomcat)

Tomcat issues inside eclipse

I am very new to Tomcat and web development in general and apologize for what may be a very silly question.
Consider 2 situations:
1.
I start Tomcat outside of Eclipse.
I use eclipse to create a war file.
I deploy it via admin console.
All is ok
2.
I start Tomcat via Eclipse
I can't access admin console
http://localhost:8080/manager/html greets me with 404 error
Same page is behaving properly when Tomcat is started outside of Eclipse
Please advise
Why might the issue be?
Why might the issue be?
You need to configure Eclipse to take control of your Tomcat installation. To do so:
double click on the Tomcat Server in the Servers view
under Server Locations, select Use Tomcat installation
This is illustrated on the screenshot below:
Eclipse creates a new Tomcat configuration separate to your Tomcat installation, in the 'Servers' project. This allows Eclipse to deploy webapps without interfering with anything you've done in your installation (via the manager app or by editing config files manually).
You can reconfigure Eclipse so that it uses the config from your Tomcat installation (see Pascal's answer), or to re-enable the manager app - but read the WTP Tomcat FAQ first as there are good reasons for it working the way it does. I don't recall ever needing to do this - the 'Servers' tab in Eclipse lets you deploy/start/stop/debug/configure apps as required.