views:

868

answers:

5

I have migrated a Web Application from MyEclipse to Eclipse WTP, and I am now in the middle of the first major upgrade to the code base and web pages after the migration, and it is frankly driving me mad that saving a JSP page causes a redeployment of the WHOLE application, as it takes time and that my backend connection does not survive the serialization-deserialization of the session object (which is non-trivial to fix). In addition to that the JSP-editor is insanely slow so I frequently have to pause to let the editor catch up to be certain where my edits go in a small JSP using JavaServer Faces. Disabling validation did not help.

The Eclipse Dynamic Web Project depends on several library eclipse projects so I cannot just tell e.g. Jetty to use the WebRoot folder, as several dependencies are then missing from the classpath.

The question is:

  • Is there a way of working - ANY way of working - with the Eclipse WTP system that does NOT imply redeploying everything every time any file is saved?

I can use Tomcat 5.5 or Jetty 6 as servers.


EDIT: Having the JSP-editor being able to keep up would be really nice too...


EDIT: The JSP-pages in question contain JSF-tags (myfaces 1.1.4, tomahawk 1.1.9), if that makes a difference?

+2  A: 

You can disable automatic publishing in Eclipse if you need to:

  1. Open the Servers View.
  2. Double-click on your server in the view. this will bring up the Server Overview configuration page.
  3. Find the "Publishing" section on the page (upper-right corner).
  4. Select the "Never publish automatically" option.

This will avoid the "publish after every save" problem. However, with this turned off you will have to manually deploy any time you want your changes to show up in your server.

BCunningham
I suspect he's looking for faster deployment. MyEclipse would only 're-deploy' changed files, so you could change a file, save, and then it's in your webserver folder.WTP appears to be doing a full deploy everytime, and this wouldn't change if you do it manually, or automatically.
Mikezx6r
Yes, or rather that just the JSP file I edited is updated in the web server work area, instead of the whole application being redeployed. This is how MyEclipse works allowing for save JSP file, and instantly reload in browser, and the WTP edit cycle is just unbearably slower.
Thorbjørn Ravn Andersen
+1  A: 

My advice:

Verify that you are using the latest released version of Eclipse/WTP and Tomcat. You may want to download new bits in a separate location and workspace. Do not go to the latest and greatest milestone/release candidate... I am talking about bits that you can get from http://eclipse.org/downloads/...

See if you can reproduce the issue with a simplest Dynamic Web Project. If you can, file a bug with Eclipse.org. If you cannot reproduce the problem with the simplest app, load your app into this new dev environment and see if that solves the problem. If it does not, then the problem is likely to be something related to your project.

vkraemer
Thank you for your verbose comment. I have been working with Eclipse 3.5.1 with the latest updates, and apparently this is how things generally work. It also appears that the Glassfish v3 server adapter works like I expect it too regarding jsp-pages (after ironing out the bugs specific to it), so I'll give that a try.
Thorbjørn Ravn Andersen
@Thorbjørn: if you are making the switch to GF v3, you may also find a benefit from session preservation. Last I knew, both NB and Eclipse plugins used this v3 feature that allow you to modify servlets almost as freely as jsp pages.
vkraemer
The GF3 move has been planned for quite a while, due to the dependency injection things in JEE6 which solves some logistic issues we have here with maintainability.
Thorbjørn Ravn Andersen
I can live with the Glassfish adapter behaviour. It still redeploys the whole app, but is not unbearable.
Thorbjørn Ravn Andersen
+2  A: 

in your Tomcat server settings in eclipse you should enable the option 'Serve modules without publishing' (see below how to do this)

this is the solution i use and it enables me to view changes in JSP's immediately without republishing or anything else (on Tomcat 5.5 + regular dynamic web project + JSP's are in WebContent directory) so i don't go nuts when developing Java apps:

how to do this:

  • open the Server view
  • double click on your server to open the server settings
  • in the 'Publishing' section (top-right) select the option 'Never publish automatically' (as said in some other answers to your question) to avoid a publish action when you change something
  • this is the most IMPORTANT: in the 'Server Options' section (bottom left) select the option 'Serve modules without publishing'. now your changes are picked up without redeploy

UPDATE: you should also make sure that the libraries you depend on (those on your build path) are 'copied' to WEB-INF/lib while developing in Eclipse (do this by selecting the appropriate JARs/projects in the Java EE Module Dependencies section in the Preferences dialog of your web project). with all these settings in place tomcat will run the web application from your workspace project with the WebContent dir as root of the web app.

enjoy

Stefan De Boey
I did not need to enable the 'serve modules without publishing' option or disable automatic publication to see JSP changes with just a page reload in my browser.
vkraemer
+1  A: 

This is weird, this is not what I'm experiencing. I rechecked this with Eclipse IDE for Java EE Developers (Build id: 20090920-1017) and Tomcat 5.5.28 (and also Tomcat 6.0.28) and I can't reproduce the issue:

  • modifying a Java file DOES reload the context ~but~
  • modifying a JSP does NOT reload the context

(and this without modifying any particular settings of my Tomcat Servers under Eclipse).

The problem looks somehow related to your project or your machine. Does it occur with any project on your machine? Can you reproduce it on another machine?

Pascal Thivent
This particular JSP file contains JSF tags (myfaces 1.1.4, tomahawk 1.1.9 - as discussed before). That may make a difference?
Thorbjørn Ravn Andersen
Some experimentation did not get rid of the "deploy whole web app". Sigh.
Thorbjørn Ravn Andersen
+1  A: 

I'll throw-in another suggestion, which is more of a workaround.

You can use the FileSync plugin to synchronize your bin and webroot directories with your servlet-container. You will have to use the original installation, and not workspace metadata this way. Then, after starting the server in debug mode, everything is hot-deployed.

I have successfully used this approach with glassfish 2.


Another thing is to check the configuration options of the server in your Servers project (it should have a folder there). It might be the case that some debug or hot-deploy option is switched off.


As for the speed of the JSP editor - well, disabling validation is the first thing to do, and you've done it. Honestly, my jsp pages (containing jsf tags, and actually using facelets) don't have any major problems with speed. Perhaps use a fresh installation?

Bozho
Chosen, not for solving the problem directly, but for the best alternative to using the WTP system.
Thorbjørn Ravn Andersen