Auto Build and Refreshing in Eclipse

I’m new to building J2EE applications and using Vaadin to build a UI in Eclipse. (I have extensive experience building J2SE applications and UIs).

I have gotten the basic Vaadin application to run, but have a subsequent development question.

When I make changes to that sample code, e.g. adding a button, changing the label text, or modifying the web.xml file, and then refresh the Eclipse web viewer, the changes are not reflected.

It seems I have to shutdown the Tomcat server and re-tell Eclipse to Run on Server, then wait for the server to re-load before the changes are able to be shown/tested. I believe I’m missing something. Is there a way to setup Eclipse, Vaadin, or Tomcat so that changes in the code/project are auto-deployed to the running server and therefore available to be tested/debugged in the web viewer right away?

Thanks for any help/advice you can provide.

Restarting is the standard way to do it.

To avoid it, the Vaadin dev team uses JRebel (If I remember well) which is not entirely free, the main free alternative seems to be Javaleon with mentions to the Dynamic Code Evolution VM being done from time to time.

I have not tested any of those so I can not tell how to set up, they are on my to do list so if you try please let me know :slight_smile:

First you should add “?restartApplication” to your URLs when testing so that the application is restarted and its state reconstructed when reloading the page.

Then disable session serialization on exit in your test Tomcat (“Manager” parameter in context.xml - in Eclipse: Project View → Servers → … and edit context.xml, uncommenting the relevant line).

If these are not enough to get the testing cycle short enough (when the JVM cannot deploy some changes on the fly), you can try JRebel. It does not eliminate completely the need for restarts, but does reduce it considerably in many cases (depending on what kind of code changes you are doing).

Thank you. These two modification do the trick.

For the record, even if it doesn’t answer your problem (already solved):
I copied my code base from one computer to another (and from Eclipse 3.6 Java+Web tools added after the fact to Eclipse 3.7 JEE).
I installed the Vaadin plug-in to this fresh install and set up Tomcat 7.
It ran the application without problem, but indeed no change was made. When removing the class files, they were not regenerated, even with Build automatically checked.
Inspecting the project properties, I saw in the Java Build Path that some of the libraries were marked as missing.
It was the JRE (different path on different machines) and the VAADIN_DOWNLOAD/gwt-xxx libraries.
For the JRE, I just had to click on the Add library button.
For the Vaadin GWT libraries, the solution I found was to create a new Vaadin project: the plug-in downloaded and installed the libraries, and all the opened projects could see them.
Would be nice if this could be detected and done on installation.

Reporting as it can be useful for somebody else.

This has been working, but now I’m getting a Sail error after every context reload, requiring the server to be restarted:

java.lang.IllegalStateException: Sail is not initialized or has been shut down

Does anyone have advice on how to resolve this issue? Thanks.