views:

2159

answers:

5

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?

+3  A: 

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

Boris Pavlović
A: 

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.

Karl
Why was this down voted? It sounds sensible and the link Boris gave above also suggests a manual install of Tomcat.
DeletedAccount
I think some people dislike my informal style. Thanks for the boost.
Karl
Well splitting it up into two paragraphs would make it easier to read. But the content is just fine, to me at least. :-)
DeletedAccount
+1  A: 

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.

Kim
+3  A: 

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.

agnul
Thanks! I've done that now, works great. I accept this answer even though many are similar, the reason is that you wrote the details here in the post so future users searching for an answer doesn't have to rely on a remote link working.
DeletedAccount
so nice of you :p
Click Upvote
A: 

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.

gareth_bowles
I can't, I need something free. Thanks anyway!
DeletedAccount