How to connect a domain to a Java application in the UK

To connect a domain to a Java application, you usually need two things to work together: your domain’s DNS and the public web server configuration that forwards requests to your Java runtime. In a managed hosting setup with Plesk and My App Server, this is typically done by pointing the domain to the hosting account, then mapping that domain to the correct Tomcat-based application path or public URL.

This is the most common way to publish a Java web app, JSP site, or servlet application under a friendly domain such as example.co.uk instead of a technical address or port number. If your application runs on a private JVM or Apache Tomcat instance inside your hosting account, the domain must be connected to the correct web space and service configuration before visitors can reach it.

What you need before connecting the domain

Before changing anything, make sure the following is ready:

  • The domain is registered and active.
  • You have access to DNS settings or nameserver settings for the domain.
  • Your hosting account is already set up with Java hosting / My App Server.
  • The Java application is installed, deployed, or ready to receive a WAR file.
  • You know whether the app should open on the root domain, a subdomain, or a subpath.

In a Plesk-based hosting environment, the domain is usually connected at the subscription or domain level, and the Java application is then mapped through the hosting control panel. For Tomcat hosting, this mapping decides whether the app is available as the main site, for example www.example.co.uk, or under a public path such as example.co.uk/app.

Typical ways to connect a domain to a Java application

There are several common setup patterns, and the right one depends on how your Java app is structured.

1. Connect the domain to the root application

This is the simplest option when the Java application should answer directly on the main domain, without an extra folder in the URL. Visitors open:

  • example.co.uk
  • www.example.co.uk

This setup is suitable for a standalone web app, a JSP site, or a servlet application that is meant to be the main website.

2. Connect the domain to a subdomain

You can also publish the Java app under a subdomain such as:

  • app.example.co.uk
  • java.example.co.uk
  • portal.example.co.uk

This is useful when the main website runs elsewhere, or when you want to separate the Java application from other services on the same domain.

3. Connect the domain to a public path

Some applications are exposed under a path rather than a separate hostname, such as:

  • example.co.uk/app
  • example.co.uk/myservice

This is common when Tomcat hosts more than one application, or when the Java app is part of a larger website.

Step 1: Point the domain to your hosting account

The first step is DNS. Your domain must resolve to the correct hosting platform before the Java application can be reached in a browser.

If you use your provider’s nameservers

If the domain uses the hosting provider’s nameservers, then DNS is usually managed in the hosting control panel. In that case:

  • Add the domain inside Plesk if it is not already there.
  • Check that the DNS zone exists for the domain.
  • Confirm that the A record or AAAA record points to the right server.
  • Wait for DNS propagation after changes.

If you manage DNS elsewhere

If DNS is managed at a domain registrar or another DNS provider, update the relevant records there. Usually you will need:

  • An A record pointing to the server IPv4 address.
  • Optionally an AAAA record for IPv6 if supported and required.
  • A CNAME for www if you want www.example.co.uk to follow the main domain.

For most hosting setups, the main domain and www should both resolve to the same application. If one of them is missing, visitors may see a different page, a redirect loop, or a certificate warning later when HTTPS is enabled.

Step 2: Add the domain in Plesk

After DNS points to the hosting account, the domain should be created or attached in the control panel. In a managed hosting environment, this is often done inside Plesk.

Depending on your setup, you may need to:

  • Register the domain as a primary domain, addon domain, or subdomain.
  • Set the document root if the app uses a specific public folder.
  • Choose whether the domain should serve the Java app directly or route to a subdirectory.
  • Confirm that the web hosting service is active for that domain.

If the application is managed by My App Server, the domain should be linked to the correct app instance so requests are passed to the right Tomcat process and JVM.

Step 3: Install or select the Java runtime and Tomcat instance

Once the domain exists in the panel, you need the application runtime that will handle the requests. In ITA Java hosting, this is done through My App Server, which allows you to install and manage a private JVM and Apache Tomcat instance inside your shared hosting account.

Depending on your environment, you may have:

  • Ready-to-install Java/Tomcat versions available from the panel.
  • The option to upload and configure a custom app server manually.
  • A choice of Java version for different application requirements.

This is important because the domain does not connect to Java by itself. It connects to the hosting service, and the hosting service forwards the request to the configured app server. If the wrong Java version or Tomcat version is selected, the app may start but fail to run correctly.

Step 4: Deploy the application to the correct location

After the domain is attached and the app server is ready, deploy the Java application.

For WAR applications

If you have a WAR file, upload or deploy it through the app server interface or the relevant deployment location. Make sure the application name matches the intended public URL if your platform uses context-based deployment.

For JSP or servlet applications

Ensure that the project structure, static files, and servlet mappings are correct. A JSP or servlet app may work directly under the root of the Tomcat context, but only if the deployment path is configured properly.

For custom server setups

If you use a manually configured Tomcat or a custom app server, verify:

  • the correct server port or internal connector;
  • the deployment directory;
  • the context path;
  • file permissions;
  • startup and service settings.

If any of these are wrong, the domain may resolve correctly but still show an error page, a blank response, or the wrong application.

Step 5: Map the public URL to the Java app

This is the part that many users are actually trying to solve when they ask how to connect a domain to a Java application.

In Tomcat hosting, the public URL usually depends on the context path. A few examples:

  • https://example.co.uk/ serves the root application.
  • https://example.co.uk/shop serves an app deployed under the /shop context.
  • https://app.example.co.uk/ serves the app through a dedicated subdomain.

Make sure the public path in the browser matches the app’s configured context. If your app is deployed as /myapp but you open the domain root, you may not see the expected content unless there is a redirect or reverse mapping in place.

When to use a redirect

You may want to redirect one URL to another, for example:

  • example.co.uk redirects to www.example.co.uk
  • example.co.uk redirects to example.co.uk/app
  • app.example.co.uk redirects to a canonical app URL

Use one preferred public address to avoid duplicate URLs and inconsistent indexing by search engines.

Step 6: Enable HTTPS for the domain

For a public Java application, HTTPS should be enabled as soon as the domain is connected and DNS is correct. This is especially important for logins, forms, API calls, and session-based applications.

In a Plesk hosting environment, you would typically:

  • Issue or install an SSL certificate for the domain.
  • Include both the root domain and www if both are used.
  • Check that the Java app redirects HTTP traffic to HTTPS.

If your application uses a subdomain, make sure the certificate covers that subdomain too. A mismatch between the public URL and the certificate is one of the most common causes of browser warnings after a new domain connection.

Step 7: Test the final connection

Once everything is in place, test the connection carefully.

  • Open the domain in a browser.
  • Check the homepage and a few internal links.
  • Confirm that forms submit correctly.
  • Verify that session login works if the app has authentication.
  • Check the logs if the application does not load.

It is also useful to test both the naked domain and www version. If only one works, DNS or redirect settings may still need adjustment.

Common issues when connecting a domain to Java hosting

Domain-to-app mapping issues often fall into one of the following categories.

The domain opens the wrong site

This usually means the domain is attached to the wrong hosting subscription, document root, or app context. Check whether the domain is linked to the correct Plesk subscription and whether the public path points to the intended Tomcat application.

The browser shows a default hosting page

If you see a standard hosting page instead of your app, the domain may be pointing to the web root but not to the Java app. Confirm the app deployment, reverse mapping, or Tomcat context path.

The app loads on a port number but not on the domain

This usually means the Java service is running, but the public domain is not forwarded correctly. Review the app server mapping in My App Server and verify the domain configuration in Plesk.

SSL works on one hostname but not another

Often this happens when www or a subdomain was not included in the certificate. Make sure all public hostnames used by the app are covered.

Changes do not appear immediately

DNS changes can take time to propagate. Also clear browser cache and, if needed, restart or refresh the app server to ensure the latest deployment is active.

Best practices for UK domain setups

For UK-facing projects, keep the public domain setup simple and consistent:

  • Use one canonical hostname for the application.
  • Redirect alternate versions such as www or non-www to the preferred host.
  • Use HTTPS from the start.
  • Keep the Java context path short and meaningful.
  • Make sure the app name, domain, and SSL certificate match the public URL strategy.

This is especially helpful for small and medium Java hosting deployments where the goal is a clean public URL, predictable routing, and easy management from the control panel.

Example setup

Here is a practical example of how the connection can look in a managed Java hosting environment:

  • Domain: example.co.uk
  • Preferred public URL: https://www.example.co.uk/
  • DNS: A record points to the hosting IP
  • Control panel: domain added in Plesk
  • App server: My App Server running a private Tomcat instance
  • Deployment: WAR file deployed as the main application
  • Redirect: non-www redirects to www
  • SSL: certificate installed for both hostnames

With this setup, the Java application is available under a clean public URL and is managed through the hosting control panel instead of requiring direct server administration.

FAQ

Do I need a separate server to connect a domain to a Java app?

No. In a managed Java hosting setup, the domain can be connected inside the hosting account and mapped to a private JVM or Tomcat instance through the control panel.

Can I use the root domain and a subdomain at the same time?

Yes, but you should decide which hostname is primary. Usually one host should be redirected to the other to avoid duplicate content and confusion.

Can I connect a domain to a WAR file?

Yes. A WAR file is one of the most common deployment formats for Java web applications. After deployment, the domain or subdomain can be mapped to that application context.

What if my Java app is in a subfolder like /app?

Then the domain must point to the correct context path. If needed, configure a redirect from the root URL to the subfolder or deploy the application as the main context.

Why does the domain work on HTTP but not HTTPS?

This usually means SSL is not installed, not assigned to the correct hostname, or the application is not redirecting traffic correctly. Check the certificate and hostname coverage first.

Can I change the Java version later?

In My App Server, you can typically select from available Java/Tomcat versions or adjust the custom app server setup. Always test the application after any runtime change because compatibility may differ between versions.

Why do I see an error after pointing the domain to Tomcat?

The domain may be resolving correctly, but the app server may not be running, the deployment may be incomplete, or the context path may be wrong. Check service status, logs, and the public mapping in the control panel.

Conclusion

Connecting a domain to a Java application is mostly a matter of correct DNS, proper domain setup in the hosting panel, and accurate mapping to the Tomcat or JVM instance that runs the app. In a Plesk-based environment with My App Server, this process is usually manageable without manual server administration: point the domain, attach it in the panel, deploy the Java app, and make sure the public URL and HTTPS settings match your intended setup.

If the domain is connected but the application is not showing correctly, the most useful checks are DNS, hosting assignment, app server status, context path, and SSL coverage. Once these pieces line up, the Java application can run under a clean public domain that is easier for users to access and easier for you to maintain.

  • 0 Users Found This Useful
Was this answer helpful?