Restarting a Java application is a routine maintenance task, but doing it safely matters. A well-timed restart can apply configuration changes, release memory, recover from temporary errors, and reload updated application code. A poorly timed restart, on the other hand, can interrupt active users, corrupt in-memory work, or leave the service in an unstable state.
In a hosted Java environment such as Plesk with My App Server, a safe restart usually means checking the application state, confirming the correct Java/Tomcat service is selected, stopping the runtime cleanly, waiting for it to exit, and then starting it again with the same configuration. This is especially important for private JVM hosting, Tomcat hosting, JSP hosting, and servlet applications running in a shared hosting account.
When you should restart a Java application
Restarting a Java application is usually appropriate when you need to apply changes or recover service health. Common cases include:
- Deployment of a new WAR file or updated application classes.
- Changes to JVM options, environment variables, or startup parameters.
- Updates to Tomcat configuration files such as server.xml, context settings, or connector parameters.
- Certificate or proxy configuration changes when the application is fronted by Apache or a control panel setup.
- Memory leaks, thread lockups, or degraded performance that require a clean JVM restart.
- Switching between installed Java versions supported by your hosting account.
If the application supports hot reload or rolling updates, you may not always need a full restart. However, in most shared hosting Java environments, a restart is the safest and most reliable way to ensure the new state is loaded correctly.
Why safe restart procedures are important
Java applications often keep session data, database connections, file handles, and background tasks in memory. A sudden stop can interrupt those processes without warning. In a managed hosting environment, the goal is to restart in a controlled way so the JVM and application container can shut down cleanly before starting again.
A safe restart helps you:
- Reduce the risk of corrupted temporary state.
- Avoid partial deploys or half-loaded application files.
- Minimise downtime for users and API clients.
- Preserve logs that help with troubleshooting.
- Confirm that the correct runtime and version are active after the restart.
This is particularly useful for Tomcat-based services managed through Plesk and My App Server, where the application runs as its own private runtime instance inside the hosting account.
Before you restart: checklist
Before stopping the service, take a few minutes to confirm that the restart is really needed and that the application is ready to come back up cleanly.
1. Check the current status
Open your hosting control panel and review the service status. In a My App Server setup, this typically means checking whether the Java application or Tomcat instance is running, stopped, or already in an error state.
2. Save your changes
Make sure all configuration edits, uploaded files, and deployment artifacts are complete before the restart. If you are replacing a WAR file or changing application resources, verify that the upload finished successfully.
3. Confirm the active Java version
If your service supports multiple Java versions, confirm which one is currently selected. Restarting with the wrong JVM version can cause startup errors or application incompatibility.
4. Check for active users or scheduled tasks
If the application serves live traffic, choose a low-usage time when possible. Also consider background jobs, imports, or scheduled tasks that may be affected by a shutdown.
5. Review logs
If the application has been unstable, review the recent logs before restarting. This can help you avoid restarting blindly when there is an obvious configuration or code issue that will immediately reappear.
How to restart a Java application safely in Plesk
In a hosting platform with Java support, the exact menu labels may vary, but the process is usually similar. If you use My App Server, the restart is normally performed from the service control interface provided in Plesk.
Step 1: Open the application control section
Log in to Plesk and open the Java application or My App Server area for the relevant subscription or domain. Select the service that corresponds to your application. If you manage multiple apps, double-check that you are acting on the correct one.
Step 2: Stop the service cleanly
Use the normal stop action rather than force-closing the process. A graceful stop gives Tomcat or the JVM time to finish in-flight requests, close connections, and release resources.
If your application has a shutdown hook or graceful shutdown mechanism, this is where it should run.
Step 3: Wait for the service to fully stop
Do not start the service immediately after clicking stop unless the panel confirms that the process has ended. A common mistake is to issue a new start command while the old JVM is still shutting down, which can lead to port conflicts or startup failures.
Wait until the status changes to stopped and the process is no longer running.
Step 4: Review any recent configuration changes
If the restart is part of a deploy or configuration update, quickly re-check the following:
- Application files are in the correct directory.
- WAR deployment completed without errors.
- Any edited XML, properties, or environment files are valid.
- Java version and memory settings match the application requirements.
Step 5: Start the service again
Use the start action in the control panel. The JVM and Tomcat instance should launch with the stored configuration. During startup, avoid repeated start clicks unless the interface instructs you otherwise.
Step 6: Verify the application is reachable
After the service starts, check the site or application URL. Confirm that:
- The page loads without HTTP errors.
- The application login or main route works.
- Static resources, JSP pages, and servlets respond correctly.
- Any APIs or background features behave as expected.
Step 7: Review the logs after startup
Look at the startup log for warnings or errors. A service can appear to start successfully but still contain application-level issues such as missing classes, incompatible libraries, or connection problems to a database.
How to restart a Tomcat-based Java app safely
For Tomcat hosting, a safe restart is similar, but there are a few extra details to keep in mind. Tomcat may need to unload web applications, close connectors, and reinitialise deployment descriptors. If you are running a private JVM with Apache Tomcat in a hosting account, make sure the restart is handled from the service control area rather than by manually killing processes.
Useful Tomcat restart considerations
- Deployments in the
webappsdirectory should be complete before restart. - Context files and server configuration should be syntactically valid.
- Custom JVM arguments should be checked for typos.
- Applications using sessions may need users to log in again after restart.
When working with a private Tomcat instance, the safest approach is always: stop, wait, check, then start.
What not to do during a restart
Some restart habits create avoidable downtime or instability. Avoid these common mistakes:
- Do not force restart immediately after a clean stop without confirming the process has exited.
- Do not change multiple variables at once if you are troubleshooting. Restart after each meaningful change so you can identify the cause.
- Do not overwrite application files while the service is still running if the files are in active use.
- Do not assume the service is healthy just because the control panel shows it as started.
- Do not switch Java versions casually without confirming application compatibility.
Safe restart workflow for deploys and updates
If you are restarting because of a new release, use a simple deployment order to reduce risk:
- Upload the new application package or files.
- Verify the file set and configuration.
- Stop the Java service cleanly.
- Confirm the old process has fully ended.
- Start the service with the updated version.
- Test the main page, login, and key functionality.
- Check logs for warnings after the first request and after a few minutes of runtime.
This method is especially effective for WAR-based deployments and small to medium applications hosted in a controlled Java environment.
Troubleshooting if the application does not restart
If the restart fails, the issue is often visible in the startup output or service logs. Common causes include:
- Invalid configuration syntax in XML or properties files.
- Wrong Java version for the application.
- Port already in use by another process.
- Missing application files or incomplete deployment.
- Permission issues on uploaded files or directories.
- Out-of-memory settings that are too aggressive for the hosting limits.
What to check first
- Read the latest error lines in the log.
- Confirm the application files were not partially uploaded.
- Compare the startup command and Java options with the last known working setup.
- Check whether another instance is still running.
- Review the service limits available in your hosting account.
If the application still fails to start, restore the previous working version if possible, then investigate the specific error before trying another restart.
Restarting after switching Java version
In My App Server, one of the practical benefits is the ability to choose from available Java versions or configure a custom runtime for the account. After changing the Java version, always restart the application so the new JVM is actually loaded.
Before restarting, confirm:
- The selected Java version matches your application requirements.
- Any required library or framework version is compatible.
- Environment variables and startup arguments still apply correctly.
If the application worked on one version and fails on another, return to the previous known-good version first, then troubleshoot compatibility separately.
Restarting scheduled or background Java tasks
Some Java applications include background workers, import jobs, or periodic tasks. A restart can interrupt these tasks, so check whether any job is actively running before you stop the service.
For this type of workload, safe restart means:
- Pausing or completing the job before stop.
- Confirming data was written successfully.
- Restarting during a quiet period.
- Verifying that the scheduler or worker resumes correctly after the service comes back up.
If the application depends on a queue, database transaction, or file-based job state, make sure the restart will not leave incomplete work behind.
Best practices for stable daily service control
For everyday operation in a hosted Java environment, a few habits can prevent most restart problems:
- Keep a record of working Java versions and JVM options.
- Change one setting at a time when possible.
- Use the control panel service controls instead of manual process management.
- Monitor logs after each restart.
- Restart only when needed, not as a substitute for diagnosing the underlying issue.
- Test after each deploy before making additional changes.
These practices fit well with private JVM hosting, Tomcat hosting, and JSP or servlet applications managed through Plesk.
FAQ
Is a restart the same as a full redeploy?
No. A restart stops and starts the JVM or Tomcat service. A redeploy usually replaces application files as well. In many cases you may need both, but they are not the same action.
Will users lose their sessions after a restart?
Often yes, especially if sessions are stored in memory. If the application does not use external session storage, users may need to log in again after restart.
Can I restart a Java app without downtime?
Not usually in a standard shared hosting JVM setup. Some enterprise systems use advanced high availability designs, but that is outside the scope of typical private JVM hosting. For most small and medium applications, expect a short service interruption during restart.
What should I do if the app starts but shows errors in the browser?
Check the logs first. The JVM may have started correctly, but the application itself may be missing a library, database connection, or configuration value.
Is it safe to restart from the hosting control panel?
Yes, that is usually the safest method in a managed environment. The control panel start and stop actions are designed to work with the service configuration and are preferable to manual process termination.
How do I know whether the restart was successful?
Confirm that the service status is running, the application URL responds, the expected version is loaded, and the logs do not contain startup errors.
Conclusion
A safe Java application restart is simple when you follow a controlled sequence: verify the current state, stop the service cleanly, wait for it to exit, check your configuration, then start and test again. In a Plesk-based Java hosting environment with My App Server, this approach helps you manage your private JVM or Tomcat instance reliably without unnecessary downtime.
For hosted Java, JSP, servlet, and Tomcat applications, the goal is not just to make the service run again, but to make sure it restarts in a known-good state. That is the best way to keep daily service control predictable and reduce avoidable incidents.