user14070
user14070

Reputation:

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:

  1. 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.
  2. 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. :-)
  3. 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?

Upvotes: 6

Views: 5594

Answers (5)

gareth_bowles
gareth_bowles

Reputation: 21150

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.

Upvotes: -1

agnul
agnul

Reputation: 13058

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.

Upvotes: 4

Kim Stebel
Kim Stebel

Reputation: 42045

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.

Upvotes: 0

Karl
Karl

Reputation: 9155

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.

Upvotes: -1

Boris Pavlović
Boris Pavlović

Reputation: 64640

Add Tomcat to the list of Eclipse servers and run your web-app on the server. If you need more details click here.

Upvotes: 3

Related Questions