How to use logs to troubleshoot a Java startup problem

When a Java application fails to start, the fastest way to find the cause is usually in the logs. In a hosted Java environment, startup problems are often related to the JVM version, Tomcat configuration, memory limits, missing files, port conflicts, or an application error that appears only during deployment. If you are using a control panel such as Plesk with a Java hosting service like My App Server, the logs are one of the most useful tools for diagnosing what went wrong and what to fix next.

This guide explains how to read startup logs, what to look for first, and how to narrow down the problem in a practical way. It is written for Java hosting, Tomcat hosting, JSP hosting, servlet hosting, and private JVM hosting on a managed platform where you control the application through a panel rather than a full server console.

What logs can tell you during a Java startup failure

Startup logs usually show the exact stage where the application stopped working. For a Tomcat-based setup, this often includes the container startup, application deployment, class loading, Spring or framework initialization, database connection setup, and the point where the server either becomes available or exits with an error.

In a hosted environment, logs are especially important because you may not have direct access to system-level debugging tools. Instead, you rely on the runtime output from your private JVM, Tomcat logs, and the application’s own logs. These can reveal issues such as:

  • Incorrect Java version for the application
  • Missing environment variables or configuration files
  • WAR deployment errors
  • Unsupported libraries or classpath conflicts
  • Port binding problems
  • Out-of-memory errors during startup
  • Database connection failures
  • Permissions problems when reading or writing files

The main goal is not to read every line, but to locate the first meaningful error and understand what it means in the context of your hosting setup.

Where to check logs in a hosted Java setup

Depending on how your Java service is configured, logs may be available in different places. In a typical Plesk-based Java hosting environment with My App Server, you should check both the control panel and the application directory structure.

Plesk or hosting control panel log area

Many hosting panels provide access to service logs, application logs, or domain logs. If your Java service is managed through a panel, check the service page first. There may be separate entries for:

  • Tomcat or application server startup output
  • Application standard output and error streams
  • Web server logs for Apache or reverse proxy handling
  • System-level service status messages

If your hosting provider offers a service control page, it may also show the last startup attempt, current service state, and any recent error messages.

Tomcat logs

For Apache Tomcat, the most useful files often include the main Catalina log, startup output, and application-specific logs. These logs may show deployment errors, XML configuration problems, or stack traces from your web application.

Look for files that contain terms such as:

  • catalina
  • localhost
  • stdout
  • stderr
  • manager or host manager output

Application logs

Some applications write their own log files using frameworks such as Log4j, Logback, or java.util.logging. If the application starts far enough to initialize its logging framework, these logs can be more detailed than the container logs.

If your app is deployed as a WAR, check whether the application writes logs to a file inside its own directory or to a shared logs folder configured in the app settings.

How to read startup logs in the right order

When troubleshooting a Java startup problem, the order of the messages matters. A common mistake is to focus on the last line only. In practice, the last line may be a symptom, not the root cause.

Start with the first error, not the last line

Scan upward from the bottom of the log and look for the first line marked as:

  • ERROR
  • SEVERE
  • Exception
  • Caused by
  • FATAL

The real cause is often introduced a few lines earlier than the final failure. For example, a stack trace may end with a generic startup crash, but the true issue may be a missing class or a failed database connection near the top of the exception chain.

Compare timestamps

Startup logs are easier to understand when you compare the timestamps of each event. If the application starts normally for several seconds and then fails exactly when it tries to open a database connection or load a config file, that gives you a strong clue about the failing component.

In a control panel environment, the log time and the service restart time are useful reference points. If you manually restarted the service from Plesk, match the timestamp to the restart attempt.

Identify the startup phase

Java applications usually fail in one of these phases:

  • JVM launch
  • Tomcat bootstrap
  • Web application deployment
  • Framework initialization
  • Runtime dependency loading
  • External connection setup

Knowing the phase helps you focus. A JVM launch problem is usually different from a Spring bean initialization issue or a JDBC connection failure.

Common log patterns and what they usually mean

Most Java startup problems in hosted environments fall into a handful of recognizable patterns. If you know these patterns, you can troubleshoot more quickly.

Unsupported Java version

If the log mentions an unsupported class file version, major version mismatch, or incompatible runtime, the application may have been compiled with a newer JDK than the one selected in your hosting service.

Typical signs include messages like:

  • Unsupported class file major version
  • UnsupportedClassVersionError
  • Java runtime version not compatible

In a My App Server setup, verify which Java version is selected for the private JVM or Tomcat instance. If your app needs a newer runtime, switch to one of the available Java versions or update the application build target if that is supported by your project.

Port already in use

If Tomcat cannot bind to its configured port, startup may fail quickly. The log can show a bind exception or a message that the address is already in use.

This may happen if:

  • Another service is using the same port
  • The previous process did not stop cleanly
  • The application was configured for the wrong internal port

In managed hosting, you usually do not need to expose the Java service port publicly. Instead, confirm that the service configuration in the panel matches the expected internal setup and that no duplicate service is running.

Memory-related failures

Java apps can fail during startup if the heap is too small or if the application tries to allocate too much memory too early. Logs may show:

  • OutOfMemoryError
  • Java heap space
  • GC overhead limit exceeded
  • Could not reserve enough space for object heap

If you are on a shared Java hosting plan with limits, check whether the application is larger than the available memory allocation. Lightweight and medium-size applications usually work well in a private JVM model, but memory-hungry enterprise-style deployments may need a different architecture.

Missing file or directory

A startup log may fail because the app cannot find a config file, certificate, upload directory, or temporary folder. This is common when paths are hardcoded for a local development machine instead of the hosted environment.

Typical messages include:

  • File not found
  • No such file or directory
  • Permission denied
  • Cannot create file

Check whether the application expects an absolute path that does not exist on the server. In a hosted setup, use paths that are valid for the account and confirm that the required directories were uploaded.

Database connection errors

If the application connects to a database during startup, a connection failure can stop the deployment before the app becomes usable. Logs may mention connection timeout, authentication failed, JDBC driver errors, or unreachable host.

Look for:

  • Access denied for user
  • Communications link failure
  • Connection timed out
  • Driver class not found
  • Could not create connection

Check the database hostname, port, username, password, and whether the JDBC driver is included in the application package. In some cases, the app starts only after the database becomes available, so this is one of the first items to verify.

Class loading and dependency issues

ClassNotFoundException and NoClassDefFoundError usually indicate a missing JAR, an incorrect dependency scope, or a conflict between libraries packaged in the WAR and libraries provided by the server.

This is especially relevant in Tomcat hosting, where the application must include its own dependencies correctly. If the app works locally but fails on the hosted service, compare the packaged WAR contents with the build output from your development environment.

Step-by-step method to troubleshoot a Java startup problem from logs

Use this method when your application does not start, restarts repeatedly, or becomes unavailable after deployment.

1. Confirm the service state

Open the control panel and check whether the Java service is stopped, starting, restarting, or running with errors. If My App Server provides service control actions, use the panel status as your first checkpoint.

If the service never reaches a running state, the problem is likely in JVM startup, Tomcat bootstrap, or early initialization.

2. Reproduce the problem once

Restart the service once and then inspect the logs immediately. Avoid repeated restarts before reading the output, because that can overwrite the most useful information or make the sequence harder to follow.

If your application only fails after deploying a new version, compare the logs before and after the deployment.

3. Find the first error block

Search for the first error block in the latest startup attempt. Do not rely on generic service messages such as “startup failed” without the detailed exception lines that follow them.

If the log is long, search for:

  • Exception
  • SEVERE
  • Caused by
  • ERROR
  • BindException
  • ClassNotFoundException
  • OutOfMemoryError

4. Identify the subsystem involved

Determine whether the failure belongs to the JVM, Tomcat, the web application, the database, or the file system. This tells you where to act next.

For example:

  • JVM issues usually mean version, memory, or launch parameter problems
  • Tomcat issues often mean connector, deployment, or server configuration problems
  • Application issues usually mean code, dependency, or config file problems
  • Database issues usually mean credentials, reachability, or schema problems

5. Check the configuration used by the hosted service

In a Plesk-based Java hosting environment, review the selected Java version, Tomcat version, service settings, and deployment path. If you are using a custom app server or manually uploaded version, verify that the paths and startup settings match the application package.

Make sure the application was deployed to the correct directory and that the service has permission to read the files it needs.

6. Fix one issue at a time

After changing a setting, restart once and check the logs again. This avoids confusion caused by multiple changes at the same time.

If you change the Java version, memory setting, or context path, note the change so you can match it with the next startup log.

Using logs with My App Server in Plesk

With My App Server, you typically manage a private JVM or Apache Tomcat instance through the control panel. That makes logs especially valuable because the panel controls the service lifecycle, Java version selection, and deployment setup.

For troubleshooting startup issues, focus on these checks:

  • Confirm that the service is using the intended Java version
  • Check whether the Tomcat instance started successfully
  • Review the deployment output for the WAR or application archive
  • Look for permission or path errors in the account directory
  • Review application-specific logs if the app starts but fails during initialization

If your installation supports several ready-made Java or Tomcat versions, a mismatch between the app and the selected runtime is one of the most common startup causes. Logs will often show that mismatch directly.

What to do when logs are not enough

Sometimes logs show the symptom but not the full cause. In that case, use a methodical checklist.

Check deployment integrity

Confirm that the WAR file or application files uploaded correctly and that the archive is not corrupted. If the deployment log stops during unpacking, the archive itself may be the issue.

Verify environment-specific settings

Many apps depend on environment variables, external configuration files, or profile settings. If these are missing, startup may fail even though the code is correct.

Test with a minimal version

If possible, deploy a smaller test application or a simple JSP/servlet example. If the test app starts and the main app does not, the problem is likely in the application rather than the hosting platform.

Review recent changes

Startup failures often begin after a code update, configuration edit, or Java version change. Compare the current log with the last known working deployment.

Practical examples of log-based troubleshooting

Here are a few common scenarios you may see in a hosted Java environment.

Example 1: Application fails immediately after restart

If the log shows that Tomcat starts but the web application fails during deployment, the issue is often a missing class, invalid XML, or a bad dependency in the WAR. Search for the first exception after the deployment begins.

Example 2: Service stops with a memory error

If the JVM exits with an OutOfMemoryError during startup, the application may need more memory than the current service plan allows, or it may contain a leak or heavy initialization routine. Reduce startup load, check heap settings, or optimize the application.

Example 3: App works locally but not on the hosting service

This often means the local runtime differs from the hosted Java version or the app depends on local files, local database access, or a custom path. Compare the log with your local development output and verify every external dependency.

Example 4: Tomcat starts, but the site is unavailable

If the service appears running but the application still does not respond, the issue may be the context path, reverse proxy mapping, deployment location, or an application-level failure after startup. Review both the service log and the web access log.

Best practices for reading Java logs in hosting environments

To make troubleshooting easier in the future, follow a few simple habits:

  • Keep the deployment process consistent so logs are easier to compare
  • Record the Java version, Tomcat version, and service settings used by the app
  • Check logs after every deployment, not only after full outages
  • Use clear application logging so critical startup events are visible
  • Remove stale log files when rotating or testing, if your hosting panel allows it
  • Document known warnings so you can identify new errors faster

Good log hygiene saves time, especially on a managed hosting platform where you want to resolve issues quickly without unnecessary changes to the service.

FAQ

Why does my Java app start locally but fail on hosted Tomcat?

Local and hosted environments often use different Java versions, file paths, environment variables, and dependency sets. The logs usually show the difference, especially if there is a class loading issue, missing file, or version mismatch.

Which log should I check first for a startup failure?

Start with the latest Tomcat or JVM startup log in the control panel, then check the application log if available. The first error block is usually more useful than the final shutdown message.

What does “Caused by” mean in a Java log?

It usually points to the root cause of an exception chain. Read the lines below it carefully, because the real problem is often listed there rather than in the final summary line.

Can a wrong Java version stop Tomcat from starting?

Yes. If the application was built for a newer or older Java release than the one selected in your hosting service, startup may fail immediately or during deployment.

How do I know if the problem is memory-related?

Look for OutOfMemoryError, heap space errors, or JVM launch messages about insufficient memory. If the logs mention these issues during startup, the application may need a smaller footprint or different memory settings.

Should I restart the service many times to test a fix?

No. Restart once after each change and review the logs before trying anything else. Repeated restarts can hide the original error and make troubleshooting harder.

Conclusion

Logs are the fastest way to diagnose a Java startup problem in hosted environments. Whether you are running Apache Tomcat, a private JVM, JSP pages, or a small servlet-based application, the key is to identify the first real error, match it to the startup phase, and compare it with the Java version, deployment settings, and service configuration in your control panel.

In a My App Server setup, this approach is especially practical because you can manage the Java service, choose the runtime version, and inspect the relevant logs from the hosting interface. With a clear reading method and a structured checklist, most startup issues become much easier to isolate and fix.

  • 0 Users Found This Useful
Was this answer helpful?