How to launch a Spring webapp from within Eclipse - eclipse

I've got a poor beginner question about Spring/Eclipse usage.
I'm working on tutorials to learn Spring, coding "Hello World" or other little webapps running few controllers and JSP.
Each time I wanna run the app from within Eclipse, nothing happens. I just get a 404 error.
In order to make the web app works, I have to run my Tomcat outside Eclipse (ie launch Tomcat from Windows with the startup.bat command line) and deploy a War through the manager-gui window of Tomcat.
So it works, but it would be more comfortable directly from within Eclipse on the embedded servers because this way running tests are so loooooooooong...
In Eclipse, I tried :
Run on Server -> 404
Run a Maven conf with Clean-Install goals,
obtained a War, but was unable to use it from within Eclipse (it's
the same War I use in the Tomcat GUI) as I saw it here
So can someone tell me how to run a Spring webapp from with Eclipse to make my work easier ?
Thanx by advance.

You need to enable 'Use Tomcat Installation' option in tomcat server when controlling it inside eclipse.
Please check this link
Tomcat not starting from eclipse, this will solve your issue.

Related

Use running instance of Tomcat in Eclipse

On my pc I have a running instance of tomcat, that I use with axis to export web-services. I'd like to use the same instance of tomcat with eclipse to run my servlets. How can I configure this?
create a basic web project in eclipse and try to deploy it, then it should ask for the server. if your eclipse is already configured with tomcat (even on axis), it should display for you to select as the application server.
try this tutorial which shows how to make it work.
it shows from the scratch (download tomcat and configure with Eclipse) but you can get an idea on the latter configuration.

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 .

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.

eclipse + maven + tomcat debugging

I'm developping a web application in Eclipse and I'm using maven, spring and tomcat.
Now the problem I have is that debug as => debug on server doesn't work.
I just get exceptions. (and yes I've created the server)
If I use the mvn command to compile it, put the war in my tomcat webapps dir and start my tomcat the application works fine. But for the functionallity I'm now working on debugging would be usefull.
I found the answer for this in http://jacksonps4.me/wordpress/?p=868
Worked like a charm for me, yet I don't understand anything!
We used to test our application with Tomcat as well, but switched to starting an embeddable Jetty. Here's a sample app. It's JSF, but it doesn't really matter. The pseudo-unit test simply starts a jetty "before" and shuts stops it "after". No need for external server infrastructure, no need for IDE dependencies.
you can run tomcat with maven with this command:
mvn tomcat:run
and if you want to debug, set this maven options:
export MAVEN_OPTS=-Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=8000
if you are in windows, use the set command:
set MAVEN_OPTS=-Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=8000
then you can debug with eclipse Remote Java Application.
Hope this help.

Tomcat & Eclipse integration

I'm developing on a Ubuntu 8.04 machine using Eclipse Ganymede. I installed Tomcat 5.5 using sudo apt-get install tomcat5.5 tomcat5.5-admin and using an Ant script I deploy my WAR file by copying it to $CATALINA_HOME/webapps.
I then created an Eclipse project and I have it output compiled source in a similar but separate directory structure under $PROJECT_ROOT/target/. I still deploy the WAR file by right clicking on the build.xml and choosing my deploy-war task.
As Tomcat is running as a deamon, automatically started up on booting, I'm not instructing it when to start or exit.
My problems with this setup are:
Using this approach I do not get any output to the Eclipse console, as Tomcat is running under the tomcat55 user and I have a different login and no access to Stdout of tomcat55.
The logging which occurs is also directed to Stdout at the moment, which I find pretty nice during development. But it's not nice when I can't see it. :-)
I don't have any servers under the Server tab and no Run configurations. This makes it impossible for me to use the Debug mode of Eclipse, which otherwise is quite convenient.
What do you think I should do to integrate them and in turn make my development environment much better?
I'd say forget the pre-packaged Tomcat. Grab the apache-tomcat-x.y.z.zip from the site, unzip it somewhere in your $HOME and add a Server to your eclipse workspace, pointing to your local installation of tomcat. Of course you need the j2ee/wtp Eclipse bundle. Works fine on Windows, can't see a reason for it not working on Linux.
Edit: You may have to fiddle with server ports if you have two tomcat installs.
Add Tomcat to the list of Eclipse servers and run your web-app on the server. If you need more details click here.
I never cared about 1 and 2, so I can't really help you with them.
regarding 3:
You don't need any servers under the server tab for debugging to work. Just start tomcat with these environment variables
export JPDA_ADDRESS=8000
export JPDA_TRANSPORT=dt_socket
and configure eclipse accordingly: run - open debug dialog - select remote java app and create a new configuration.
You need eclipse to manage a copy of tomcat, then it can debug it. The clue to the problem was that you have to push deploy-war, this means the files are leaving your development environment and entering an external server. On a properly configured development environment, you only need to save your java file, it will auto-compile and already be on the local tomcat install, which might try to auto reload the web-app, and you can refresh your browser without reloading anything on the server. Look up some more tomcat plugins, there are a few different ways to do this.
If you want to do regular debugging and relaunching of Tomcat apps, you might want to take a look at MyEclipse - it can make things a lot easier.