Ashish Pancholi
Ashish Pancholi

Reputation: 4659

how to go live with the sample web application for testing deployed on remote server?

I have created a sample web application and deployed it on my remote server desktop. I am able to run the sample web application locally on that remote server desktop by URL : http://localhost:8080/HelloWeb/.

Now I would like run that application using URL like : http://<192.168.0.111>/HelloWeb/ from other desktops because it hosted on server but it showing me 404 error.

Steps what I did-

I have downloaded the Apache Tomcat core 64 bit zip from http://tomcat.apache.org/download-60.cgi. Copy that folder "apache-tomcat-6.0.37" to Z: Drive and extract the folder. I already had Java 1.7 installed on my system in C: Drive. Created System Environment of JAVA_HOME and TOMCAT_HOME. Copy my sample web application into apache-tomcat-6.0.37\webapps\ You can see the structure in the below image.

enter image description here

web.xml contains-

<?xml version="1.0" encoding="UTF-8"?>
<web-app version="3.0" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd">
    <servlet>
        <servlet-name>HelloServlet</servlet-name>
        <servlet-class>org.mypackage.hello.HelloServlet</servlet-class>
    </servlet>
    <servlet-mapping>
        <servlet-name>HelloServlet</servlet-name>
        <url-pattern>/HelloServlet</url-pattern>
    </servlet-mapping>
    <session-config>
        <session-timeout>
            30
        </session-timeout>
    </session-config>
</web-app>

Context.XML contains

<?xml version="1.0" encoding="UTF-8"?>
<Context antiJARLocking="true" path="/HelloWeb"/> 

You can download the source code from here I followed this link to deployed the web application.

Please help me to run my application form my remote server using URL like - http://<192.168.0.111>/HelloWeb/

Upvotes: 2

Views: 975

Answers (2)

Terry Zhao
Terry Zhao

Reputation: 115

In the Tomcat server folder there is a file conf/server.xml. There you can search for 8080 as a keyword, then modify it to 80 (TCP port). Then you can visit the app using http://192.168.0.111/HelloWeb/

Upvotes: 2

SpringLearner
SpringLearner

Reputation: 13854

you should write port number also in the URL like this

http://192.168.0.111:8080/HelloWeb/

8080 is the default port number

Upvotes: 1

Related Questions