views:

853

answers:

2

I am currently using the Spring 3.0 framework in a websphere 6.1 environment. The IDE I am using is RAD (Rational Application Developer) 7.5. I was working on a problem last night and I found that my code wasn't being 100% refreshed on the server after making a change in my workspace. My question is what is the difference from websphere's perspective between the following:

  1. Restarting the entire server with an EAR installed
  2. Cleaning an EAR within WebSphere
  3. Clicking on the project and selecting publish

Do other Application Server / IDEs have the same type of syning issues when developing J2EE applications?

Thanks, Jeremy

+2  A: 

With RAD here's the default behavior. When you 'clean' it gets rid of the compiled objects and recreates them via a 'build all' then does a 'publish'. When you 'build' it builds anything it thinks is necessary then does a 'publish'. When you 'build all' it builds all objects then does a 'publish'.

When you (or your IDE via the commands above) does a 'publish' it takes all of your compiled objects and deploys them onto the server that you've setup for this project (via a hot swap if the server is running). Hot swaps work well for some things (such as JSPs) but not as well for other things (configuration files, EJBs, etc). If unable to do a hot swap correctly you need to bounce your server.

For example, if you have RAD setup to automatically build, your server is running, and you change an EJB what will happen is:
1. The EJB will be compiled
2. If the project is OK RAD will deploy your changes
3. The server will probably not be able to pickup your hotswapped changes so the server will continue to run the old code

When this happens bounce the server and the code will be picked-up.

SOA Nerd
Thank you very much... that is very very informative.
jwmajors81
+1  A: 

Restarting the server will take some time but surely reload the files if they exist on the file system. I am not sure about calling Clean from the Servers view.

If you call Publish within Servers view, RAD will restart the application on the server. Thereby changes normally get picked up.

You need to understand what kind of change you did and see what WebSphere Application Server requires to load the change. If you scroll to the bottom of the linked help entry, you can see for each JavaEE module type a link to a document which describes what needs to be done to pickup the changes. http://publib.boulder.ibm.com/infocenter/wasinfo/v7r0/index.jsp?topic=/com.ibm.websphere.base.doc/info/aes/ae/trun_app_hotupgrade.html

Otherwise, you should understand the whole lifecycle of what happens from the change to picking it up in the browser, e.g. change on the file, file gets compiled, prepare for deployment runs, classloader sees the change, notices that application needs to be restarted, user calls Republish to restart the application on the server, user refreshes the web page, Firefox shows within Firebug that the Last-Modified timestamp in HTTP header changed.

I am not sure what hot-swap means but when debugging the server, hot code method replacement can replace a class within the debugged server if there is no reference held to the class or the class structure has not changed.

The postings on this site are my own and do not necessarily represent the positions, strategies, or opinions of IBM

Michael Grosse