When the test server requires restarting
The following subtopics describe different situations where you might need to restart the server.
In the development environment, you might want to change 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 might lose the state of the program, depending on the type of resource that is modified and the type of server.
When an application is running on a server and you change the code, the Java™ virtual machine keeps 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 that are running on Tomcat, you must restart the server to ensure that the changes are recognized by the server.
Changes to server configuration
If you change 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 files that are not Java
Any changes that you make to your JSP, HTML, GIF, JPG, or a similar resource file; when you save the file while the server is running, you must publish the application on the server. Issuing a publish is especially important if changes to the resource file are a linked resource, which might be files or folders that are stored in locations in the file system outside of the workspace. Changes to linked resources cannot be detected by the workbench or the server as the changes happened outside of the workspace.
For more information on automatic or manual publishing to the server, see the Publishing your application topic.
Changes to servlets and related classes
If you change a servlet and save the file while the server is running, the servlet is reloaded, if you enable reloading for that application. When the server runs hot method replace1, the changes take place automatically without needing to refresh the browser. The server recognizes the change when publishing the application on the server. If you refresh the web browser, the state of the application is not lost.
To publish the application on the server, you can wait for the automatic publishing interval to pass or manually publish your application (right-click the server in the Servers view and select Publish). For more information on automatically or manual publishing to the server, see the Publishing your application topic. The session data for that project is lost, but the state of other projects within the application is unchanged. You can restart the project from the menu in the Navigator view. If you are running Tomcat and have not enabled the reloading feature, you need to restart the server.
For WebSphere Application Server, the 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 that is running on WebSphere Application Server, you need to restart the server. For Tomcat, a restart of the server is required for any of these changes.
Adding servlets, classes, or JSP files
If you add a servlet, dependent class, or JSP file to a web project while the server is running, the changes are recognized if you enabled reloading. If you did not enable reloading, you need to publish the application and restart the EAR project if you are running WebSphere Application Server, or publish the application and restart the server if you are running Tomcat. To publish the application on the server, you can wait for the automatic publishing interval to pass or manually publish your application (right-click the server in the Servers view and select Publish). For more information on automatically or manually publishing to the server, see the Publishing your application topic. When the server runs the hot method replace function in debug mode, changes to Java classes are automatically recognized.
Changes to EJB resources
For WebSphere Application Server, the server dynamically restarts the EJB project in the EAR. When the server runs the hot method replace function in debug mode, changes to Java classes are automatically recognized.
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 dynamically restarts the EAR. Tomcat does not support Enterprise Application project testing and publishing.
Resource modified | Required Action | |||
---|---|---|---|---|
WebSphere Application Server | Apache Tomcat | WebSphere Application Server Express® | ||
Server configuration | Same behavior as the stand-alone WebSphere Application Server, for details refer to the Information Center for WebSphere Application Server | Restart the server | Restart the server | |
JSP | Refresh the web browser | Refresh the web browser | Refresh the web browser | |
Servlet | 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 | 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 | |
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 | |
EJB or dependent class added | Automatically reloaded | Not supported | Not supported | |
EAR file | Automatically reloaded | Not supported | Refresh the web browser |