0

I am very new to web application development. I am facing an issue with my service. I was unable to access my service from other machine/VM. I am using a Virtual Machine (Linux) on windows operating system. My service is running on windows machine. When I was use http://localhost:8080/tdg/ I am able to get the page but when I was accessing this service from VM (http://:8080/tdg/) the page is not opening. Here is the output I am getting.

enter image description here

I searched the web and I found some of the links Accessing a Jetty server from an external machine how to make jetty server accessible from LAN?

I configured my host 0.0.0.0 in jetty even though I am unable to accessing my application from my VM. Also I tried the following URL from windows machine (where my service is running) http://:8080/tdg/ but still there is no luck.

What I missed here.? Can anyone help me on this.? I stuck over here.

Note: I am using Jetty as my web server.

Thanks In Advance, Amar.T

Community
  • 1
  • 1
Amar
  • 755
  • 2
  • 16
  • 36
  • This is most likely not related to jetty at all but a network configuration issue of your VM. What's your windows-machine IP, how's the VM connected to the network? Try to ping your windows IP from within VM... – Jan Nov 06 '15 at 10:05
  • Whats with the no-host authority http URI? Did you really mean `http://:8080/tdg`? – Joakim Erdfelt Nov 06 '15 at 16:21
  • @janschweizer I am able to ping my windows IP from VM box. I observed one more point is, I entered a URL like http://192.168.18.2:8080/tdg/ (Not a original IP) in windows machine but still I am not getting the page. The page is opening only when I gave a URL like http://localhost:8080/tdg/. So what is the reason for this.? – Amar Nov 09 '15 at 09:24
  • Hmm - I just realized the error page you see is generated by jetty! So network-connectivity seems to be okay. Maybe point your browser to http://192.128.18.2:8080/ (your Jetty-Hosting-Windows IP) to see if jetty default start page shows. Can you share directory structure of your jetty-deployment? Or do you run embedded jetty? Then some code on how you setup server / context would be nice – Jan Nov 09 '15 at 10:33
  • @janschweizer I got the solution and I posted my solution. Can you please have a look and let me know your feedback.? – Amar Nov 16 '15 at 07:29

1 Answers1

0

I got the solution. In my WebAppContext I commented the line "webAppContext.setVirtualHosts(webApp.hostName);" and then its start accepting the requests from all the clients.

WebAppContext webAppContext = new WebAppContext();
                    webAppContext.setResourceBase(webApp.appDir);
                    webAppContext.setDescriptor(webApp.appDir
                            + "/WEB-INF/web.xml");
                    webAppContext.setContextPath(webApp.contextPath);
                    webAppContext.setParentLoaderPriority(true);
                    // webAppContext.setWar(webApp.appDir);
                    //webAppContext.setVirtualHosts(webApp.hostName);
Amar
  • 755
  • 2
  • 16
  • 36
  • If you'd add the "broken" code to your question this would help others understand the issue better if they stumble upon this question. From the code you commented out it seems like http://hostname:8080/tgd could have worked from outside before (just not by using IP address). Maybe you should log webApp.hostName once and give that a shot – Jan Nov 16 '15 at 08:03