When the test server requires restarting

The following subtopics describe different situations where you might need to restart the test server. The table at the end of this topic summarizes these situations.

In the development environment, you may want to make changes to an application while it is running on a server, for example, if you are debugging an application on a server. In some cases you can dynamically reload modified code without restarting the server. You may or may not lose the state of the program, depending on the type of resource modified and the type of server.

When an application is running on a server and you make changes to the code, the Java virtual machine will keep running the initial code until the code is reloaded automatically or manually. For example, you can modify JSP source and the changes will reload automatically on the server. For other resources, such as Java classes running on Tomcat1, restart the server to ensure that the changes are recognized by the server.

 

Changes to server configuration

If you make any changes to the server or the server configuration while the server is running, for example, if you change the port number, you need to restart the server.

 

Changes to JSP, HTML, graphic and non-Java files

If you make any changes to a JSP file, HTML file, GIF file, JPG file, or similar resource, and save the file while the server is running, you will only need to refresh the Web Browser for the server to recognize the change. The state of the program is not lost.

 

Changes to servlets and related classes

If you make any changes to a servlet and save the file while the server is running, the servlet will be reloaded if you have enabled reloading for that application. If you have enabled hot method replace for the server, the changes will take place automatically without needing to refresh the browser. If you have disabled hot method replace, the server recognizes the change when you refresh the Web Browser and the state of the application is not lost. Session data for that project will be lost but the state of other projects within the application will be unchanged. You can restart the project from the project's pop-up menu in the Navigator view. For WebSphere Application Server v5.x2, if you do not have reloading enabled, restart the EAR. If you are running Tomcat and do not have reloading enabled, you will need to restart the server.

For WebSphere Application Server, the above rules also apply to any dependent classes or deployment descriptors of the Web project. If you modify the security or login configuration properties of the web.xml deployment descriptor running on WebSphere Application Server, you will need to restart the server. For Tomcat, a restart of the server is required for any of these changes.

Tip: To disable reloading, open your Web project with the deployment descriptor editor. On the Extensions page, clear the Reloading enabled check box.

 

Adding servlets, classes, or JSP files

If you add a new servlet, dependent class, or JSP file to a Web project while the server is running, the changes will be recognized if you have enabled reloading. If you have not enabled reloading, you will have to restart the EAR project if you are running WebSphere Application Server, or restart the server if you are running Tomcat. If you have enabled hot code replace in debug mode, changes to Java classes will be automatically recognized.

 

Changes to EJB resources

For WebSphere Application Server, the server will dynamically restart the EJB project in the EAR. If you have enabled hot code replace in debug mode, changes to Java classes will be automatically recognized.

Important: Tomcat does not support EJB testing and publishing.

 

Changes to resources within an Enterprise Application project

For WebSphere Application Server, if you change any resource within an Enterprise Application project while it is running on the server, the server will dynamically restart the EAR. Tomcat does not support Enterprise Application project testing and publishing.

For WebSphere Application Server v6.0, if you change any resources within the WebSphere Enhanced EAR editor, you need to restart the server and re-publish the application. The WebSphere Enhanced EAR editor is the Deployment page in the Application Deployment Descriptor editor.

Table 1. Summary of actions to take when resources are modified while the server is running.
Resource modified Required Action
  WebSphere Application Server Apache Tomcat WebSphere Application Server - Express
Server configuration

  • For WAS v5.x: Restart the server

  • For WAS v6.0: same behavior as the stand-alone WebSphere server, for details refer to WebSphere InfoCenter

Restart the server Restart the server
JSP Refresh the Web Browser Refresh the Web Browser Refresh the Web Browser
Servlet Hot method replace enabled Automatic Automatic Automatic
Reloading enabled Refresh the Web Browser Refresh the Web Browser Refresh the Web Browser
Reloading disabled Restart the EAR project or the server Restart the server Restart the EAR project or the server
Dependent classes* or deployment descriptors *Hot method replace enabled Automatic Automatic Automatic
Reloading enabled Refresh the Web Browser Refresh the Web Browser Refresh the Web Browser
Reloading disabled Restart the EAR project or the server Restart the server Restart the EAR project or the server
EJB implementation Automatically reloaded Not supported Not supported
 
When hot method replace is enabled: Automatic with no reloading
EJB interface or interface's dependent classes Automatically reloaded. Restart the application client if the application client holds a reference to the EJB. Not supported Not supported
 
EJB dependent classes* or deployment descriptors Automatically reloaded Not supported Not supported
 
*When hot method replace is enabled: Automatically replaced  
EJB or dependent class added Automatically reloaded Not supported Not supported
 
When hot method replace is enabled: Automatically replaced
EAR file Automatically reloaded Not supported Not supported
Refresh the Web browser
WebSphere Enhanced EAR V6.0: Restart the server and re-publish the application. Not supported Not supported

 

Related tasks

Testing artifacts on a server
Managing servers
Starting a server in profiling mode

Related reference
Servers view

Related information
Starting a server
Starting a server in debug mode
Stopping a server

1 Tomcat servers are not available in WebSphere Application Server Toolkit

2 WebSphere Application Server v5.x test environments and servers are not available in WebSphere Application