Question

Java web app deployed and running but I cant access it on browser

It took me 2 full days to deploy my java web app on digital ocean(D.O). My web app is a Java jersey maven project, using payara glassfish server. It’s a REST app with an HTML form as a front end, there is no database, it’s just a simple calculator where the user can input and get a output.

What I did so far? I installed the java environment, glassfish, and maven in the D.O droplet. Then clone my project into the droplet, run a maven clean install, then get the WAR file and deployed it successfully on glassfish. Then started the glassfish server successfully, and now when I go to {dropletIP}:4848 I’m able to have access to my glassfish admin console, from there I see that my Java web app is successfully deployed and running. So all looks really good and this indicates that my app is online on the droplet and ready to be accessed from anywhere in the world.

The problem:

When I go to any of these URLs :

  • {my_dropletIP}:8080
  • {my_dropletIP}:8080/projectName
  • {my_dropletIP}:8080/projectName/myHTMLForm.jsp
  • {my_dropletIP}:8080/applications/projectName
  • {my_dropletIP}:8080/applications/projectName/myHTMLForm.jsp

I tried these URLs using http and https.

When I try to access these URLs it just doesn’t work, it keeps loading, and then it shows this:

This site can’t be reached “dropletIp” took too long to respond. Try: Checking the connection Checking the proxy and the firewall Running Windows Network Diagnostics ERR_TIMED_OUT_

The problem is that I don’t have access to my web application.

note: The project works perfectly locally, and the path to access it is:

Please help, thank you! :)


Submit an answer

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Please send your github link or structure so that we can see the detail problem. But i think this problem is related to network or firewall block connection

ok guys I fixed it! finally :) the problem was that I was deploying the wrong WAR file, I created a war file using jar -cvf anyName.war * but the war file that needs to be deployed for your project to work on the browser is the one that contains the words SNAPSHOT, this WAR file is in the target folder. Deploy that one and it will work.

{my_dropletIP}:8080/projectNameSNAPSHOT/

Hi there,

It sounds like your app might be binding on 127.0.0.1:8080 rather than 0.0.0.0:8080 which would only allow you to access the app locally.

To check that quickly, you could run the following command:

netstat -plant | grep 8080

If this is the case, you would need to update your bind address to 0.0.0.0:8080 and you will be able to access your app as normal.

Let me know how it goes!

Best,

Bobby