aspose file tools*
The moose likes Tomcat and the fly likes Tomcat servlet runs within local network but refuses to do so online. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Products » Tomcat
Bookmark "Tomcat servlet runs within local network but refuses to do so online." Watch "Tomcat servlet runs within local network but refuses to do so online." New topic
Author

Tomcat servlet runs within local network but refuses to do so online.

Joshua Brumington
Greenhorn

Joined: Jun 01, 2011
Posts: 6
Hello,

I have written a servlet for Tomcat and it works fine within my network but refuses to do so from outside via the tinternet. The starting html form runs but doesn't load the actual servlet correctly. Here is the starting form, the servlet is called mrknowitall:



And here is the xml file:


Any help with this much appreciated,

Thanks.
amit punekar
Ranch Hand

Joined: May 14, 2004
Posts: 515
Hello,
We would need to understand what is meant by not working ?
1) What is the error you are getting when you access the servlet on internet?
2) How you are accessing your local tomcat on internet ? It may not be possible until you bind your static IP to the DNS service. Isnt it?

Regards,
Amit
Joshua Brumington
Greenhorn

Joined: Jun 01, 2011
Posts: 6
Hi, cheers for the reply.

On chromium it's "Oops! Google Chrome could not connect to joshyyy.dyndns.org" you can see the error from another browser by clicking here and submitting the form with some speech in the box.

Otherwise, on my local network I am typing in "192.168.0.62:8080" from a different machine, which works fine.
amit punekar
Ranch Hand

Joined: May 14, 2004
Posts: 515
Hello
To which IP this "http://joshyyy.dyndns.org/" mapped to on DNS??
Is it your local IP. As far as I understand this you need static ip for binding domain name to the IP. And then DNS(DOmain Name server) resolves the portal/sitename to IP.
As you mentioned the access using IP or machine name would work on local intranet.

Regards,
Amit
Joshua Brumington
Greenhorn

Joined: Jun 01, 2011
Posts: 6
My ISP gives me a dynamic ip rather than a static one, so I use dyndns and ddclient to update my routers ip.
My router routes all html requests to my server within the local network. And this seems to work for simple webpages hosted on tomcat but not for my servlet. Which is strange to say the least.

Hope this helps?
amit punekar
Ranch Hand

Joined: May 14, 2004
Posts: 515
Hello,
When I tried accessing the URL I got HTTP error 408/409. I am afraid that I do not understand dydns and stuff related to router.
Anyways when you say webpages hosted on tomcat are accessible over internet, I did not get to see that webpage.
May be try posting the directory structure and content of your tomcat webapp.

regards,
Amit
William Brogden
Author and all-around good cowpoke
Rancher

Joined: Mar 22, 2000
Posts: 12823
    
    5
This has nothing to do with addressing.



One of the most common beginner errors.

ALL classes used in servlet should be in packages and the class files stored accordingly.

The reason being that for classes without a package the JVM looks in the "current" directory - in typical servlet environment you have NO control over the current directory.

That you were able to get it to run in the development environment is just bad luck. This comes up all the time.

Bill

Joshua Brumington
Greenhorn

Joined: Jun 01, 2011
Posts: 6
Just out of curiosity, can you reach it from here?
amit punekar
Ranch Hand

Joined: May 14, 2004
Posts: 515
Hi,
Yes I can see the HTML page.
The thing which is wrong is action attribute of FORM element.
Why it is
action="/mrknowitall/mrknowitall"
.
Assuming that you are using root webapp to deploy your stuff you should use it as
action="/mrknowitall"
.

Also check the directory structure as suggested by William.

Regards,
Amit
Joshua Brumington
Greenhorn

Joined: Jun 01, 2011
Posts: 6
William, could you please elaborate? My servlet class is at "/var/lib/tomcat6/webapps/mrknowitall/WEB-INF/classes/mrknowitall.class" what should I put between the <servlet-class>'s in order for it to work? Thanks.
Joshua Brumington
Greenhorn

Joined: Jun 01, 2011
Posts: 6
Never mind, I think I've got it working now, thanks for the help
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Tomcat servlet runs within local network but refuses to do so online.