• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Jeanne Boyarsky
  • Tim Cooke
Sheriffs:
  • Bear Bibeault
  • Henry Wong
  • Devaka Cooray
Saloon Keepers:
  • salvin francis
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Frits Walraven
Bartenders:
  • Jj Roberts
  • Carey Brown
  • Scott Selikoff

Tomcat servlet works on local machine but breaks on server

 
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
m assuming I'm doing something simple and stupid since I'm new to this. But I have a working Tomcat servlet. On my local machine, when the connection is created with:



it works just fine. In fact, I accidentally loaded it to the server with that and of course it still worked :P.

However, whenever I try to run the servlet on the server itself:



it dies, saying that a connection cannot be established to the server. To be honest, I used this https://www.digitalocean.com/community/tutorials/install-tomcat-9-debian-9 to set up the server.  I thought I even briefly disabled the firewall.
 
Ranch Hand
Posts: 127
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
"It doesn't work" unfortunately isn't that much of an information. Unless the Exception is silently suppressed there's a rather helpful IOException telling you the issue. Most likely either a no route to host meaning the dns resolution failed or a connection refused which often means the firewall is blocking (unless the server isn't running at all).
So, to help us to help you to figure out the issue it's best to show us the error message (please post text output as text rather than taking a screenshot as it's hard to read on a mobile device).
I'm sure one here can spot the issue and give you some advice.
 
Saloon Keeper
Posts: 6843
163
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
That looks like JavaScript code - is there further information (or maybe error messages) in the browser console?
 
Calvin Dobson
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yes, I looked in the console.  The only message I seem to be able to get out of it goes along the lines of "could not connnect to server."  It doesn't include any other information about where in the protocol the process failed.  
 
Calvin Dobson
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
So I've managed to tease out some more debugging information:

This is Debain 9 and tomcat 9.
Firefox won't give an error code, chrome gives: failed: Error during WebSocket handshake: Unexpected response code: 500.  I think the error on the tomcat side is:




I tried it on FreeBSD, and this just changed the error to 404 from 500.  However  I also noticed that my subroutine which starts with

and prints a simple website works fine on my computer, but it doesn't work so well on the remote server.  Could a problem with web.xml cause this issue?
 
Paddy spent all of his days in the O'Furniture back yard with this tiny ad:
the value of filler advertising in 2020
https://coderanch.com/t/730886/filler-advertising
reply
    Bookmark Topic Watch Topic
  • New Topic