Web application running without a name - java

I just made a simple web application (using java and jersey as i want to start making a rest endpoint). I am working on intelliJ idea
I used this tutorial to build it.
I gave the project a name, group id and artifact.
Now when i run it in my local tomcat server, it runs successfully but does not show me the name of my web application in URL. It only shows localhost:8080 as can be seen in the screen shot below.
Why is it displayed like that? How can i give my application a name/URL?

Basically, you need to watch this video first: Domains and the Domain Name System and then fully understand what the following paragraph means. Then your question will solve itself. Good luck! :D
localhost is the IP address of the server where the tomcat (which is an application server) is running. 8080 is the port. The localhost maps (from Windows hosts file) to 127.0.0.1 and this is a loopback IP address (meaning that it is, in fact, yourself).
p.s. that's what about the name in the URL. About the actual browser tab name, it's the <title> HTML tag.
How can i give my application a name/URL?
You need to buy a domain name.

So what i was looking for was to set the application context in tomcat server.
Here is how i did it: On IntelliJ idea, clicked on 'Edit configuration' -> than on 'Deployment' tab.
There is an option for "application context' there. I give it the name of my application(or any name that i like) and click 'apply' and restarted the server.
Here is how it appears in the browser now:

Related

How to deploy my Dynamic web project on internet

I am working in my final year project and I created a web service in a dynamic web project using eclipse JEE, tomcat 8.5 and Axis 2 ( all this is running in Ubuntu 16). this web servicie calls some programs that are installed on a computer ( Matlab for instance) so I need this computer to host the Web Service. This web service works fine in local host ( I created a client to check it) now I need to do the next step. how can I deploy this web service on internet? ( NO localhost), There is any tutorial or documentation to do something like this? The computer where I am working is of my university so it is connected to the university network.
I have read that I need a WAR file, I know that if I right click my project and the select export it says "WAR file", this war is going to have all the references and .jar that I added ? ( I am afraid of this because I neeeded to add some .jar and also some native library locations to them) Also I know that I need to have a Statc IP instead of a dynamic one. how can I achieve it if I have no access to the university routers?
Thanks for your help.
If you want your own domain, then you will have to buy a domain if you want to be on internet. There are website like GoDaddy or BigRock, that provide domains.
If you are doing it for testing or demonstration purpose, you can use NGROK tool. This tool will provide a domain over internet (something like http://.ngrok.io), that will be mapped to your localhost. The domain can be customized if you are using paid version.
ngrok.exe http 8080
OR
ngrok.exe start -config="config.yml" config-name
config.yml
http_proxy: ""
log: ngrok.log
tunnels:
config-name:
proto: http
addr: 8080
As you stated you need a "computer to host the Web Service" on internet, as you also have the constrain to use specific libraries so you cannot use a "ready-to-host"(paas) solution like heroku because you wouldn't have access/control to the computer hosting your webapp. The only solution I know to deal with that is VPS hosting (https://www.ovh.com/us/vps/) with that you can "rent" a remote computer (with ubuntu 16 if you want) and have total control on it for example you can install whatever native library you want on it, and also any servlet container/web server you want like you would on your local computer.
But then your web service will be on internet, which is "outside" the university network, if you need to access some data/services only accessible from the university network, you cannot use this solution unless you have a special (and secured) access to connect the university network via VPN for example but you'd have to ask to your university if something exists in the university network to allow traffic coming from internet (which I suppose is not the case...but you can still ask to the IT department of the university). Anyway, what you want to do cannot be achieved the "easy-way", lot of work foreseen to have something like this working. If it's a university project, maybe it should stay inside the university network.

hosting my website on a LAN using tomcat server

I am badly stuck in a doubt that i have tried various ways to get it cleared and coul'nt find a solution and therefore i decided to come back to the good old place where i have never missed out on getting what i want!
I have a simple hello world jsp page that will trigger a java servlet when a button on this page is clicked. I am running it in a tomcat server that i have installed on my laptop. i am using the Eclipse IDE. so when i run my jsp page, it asks if i want to make the server up, and i will say yes and the jsp page comes up in the browser inside eclipse IDE. and i can access the same page through my system's browser (chrome) too using http:/// . (90 is the port that i have configured for this tomcat). but if i hit to the same url pattern as i have told you above on a desktop which is in the same network as my laptop is, nothing comes up and then i thought, i will hit using the IP of my laptop where the server (tomcat) is actually running, still no result.
when i googled a bit, i learnt that IIS server should be running on my windows to achieve what i want. but my doubt is: Is there a difference between IIS server and tomcat server?because tomcat is already running, do i need an IIS server?
Update - Solution
i used the private IP of my laptop and then it works!!! i was using teh public IP of my network till now so was unsuccessful!!
IIS is a web server while Tomcat is a web container. You can find more information
here
You dont need IIS to access Tomcat. Tomcat is a standalone web container which can server JSP pages you are trying to access. Simplest thing to do is try to ping your laptop from your desktop. If that doesnt work then your need to check firewall settings as suggested by another user. But if that works, make sure your port and application context name is correct.
Thanks.
As you told that you are using your public IP address to access the page but nothing happing, it's because the public IP you are seeing is not your laptop's IP. it's your router's IP. Your private IP is your laptop's IP which is assigned by your router. if you want to access the page using your public IP you have to forward that particular PORT on your router. By doing that you can easily access the page from anywhere not only from your home network but from other networks as well.
Solution i used the private IP of my laptop and then it works!!! i was using teh public IP of my network till now so was unsuccessful!!

How do I know the URL of a web app on my machine?

So I just got internship at this company, and they would like me to complete a project(Web application) which someone else did but didn't finish two years ago. But the person didn't leave any documentation about this web app. Right now I would like to run and test this web app, but I couldn't get it started.
So it's running on WebSphere Application Server in IBM Rational Application Developer, the code is written in java and javascript. (I could start the server, but I don't know where to go and open up the web app)
Sorry I'm really new to this, questions might be stupid, appreciate any help:)
Do you know what port it's running on? You should be able to access it from a web browser on the host machine by going to
http://127.0.0.1:XX
where XX is the port in question. If you don't know, try 80 - that's the default HTTP port and it's worth a shot.
The default websphere web port is 9080, so try http://localhost:9080/
So it's running on WebSphere Application Server in IBM Rational Application Developer
and
I could start the server
Assuming you are able to start the server via RAD as I assume from the above and you are able to publish the app to WebSphere via RAD, you should then be able to right click on the project folder and choose "Run on Server." It will walk you through publishing the app to the server and will then launch a browser to the index page or URL via the context path and web project settings. You can have RAD use an embedded browser (default) or adjust it to launch an external browser via Preferences -> Web Browser.
To manually check where a webapp will be deployed you can either check application.xml (if you have one) OR you can right click on the project root folder in RAD, choose Properties, and Web Project Settings. The context path is in a field there.
Run-On-Server will show you both server/hostname (usually localhost), port, and application context path in one operation.

Deploying example application

I am trying to deploy the example form based authentication application to my glassfish server, but everytime I launch the application, I am redirected to yahoo, saying that
The requested URL "http://localhost:8080/com-byteslounge-jaas/" cannot be found or is not available. Please check the spelling or try again later.
Anyone have any ideas? I downloaded the source straight from here:
http://www.byteslounge.com/tutorials/jaas-form-based-authentication-in-tomcat-example
You can also launch Server Domain Console (http://localhost:4848 by default) and there, in Applications section, You should have Your app listed. You can see the URL to Your app either by clicking it's name or by clicking Launch link on the right.
The example in your linked article describe the URL is http://localhost:8080/com-byteslounge-jaas-1.0-SNAPSHOT, have you ensured you deploy the app to the same context path you're requesting? Check glassfish log to see what context path your app is deployed as

How to check Google web application in iPhone

I have designed a google web application using Eclipse and the Google GWT plugin.
Is there some way I can see the GUI of my application on iPhone or iPad.
Please, give me suggestions or tell me if it is possible.
You are referring to a company server (IP 10.24.56.34). If that is a web server that you or someone from your company can administer, then follow the below process:
In eclipse select your project, right click on it, go to google
option and select GWT compile.
At the pop-up press compile.
Wait some time (can be a lot, if your project is big/complex).
After compilation has finished successfully, go to your workspace
using an filesystem explorer utility (Note: Right click your project in
Eclipse, select project properties, select resource to find your
project's location on disk, if you have any doubt as to where it is
located.
Inside project's directory, you should find a war directory. Copy all its contents
in a suitable directory for your webserver to be able to publish.
Hit the werbserver's IP and the publish location you used at the previous step, appending the name of the only HTML file you will find in the above mentioned war directory. You should be able to see your application. Of course you can browse this location from a browser from your PC to make sure you do not have iPhone related issues.
Hope this helps you!
If you have a Mac you can install Xcode and then see it in the simulator by typing in the localhost URL. That should give a pretty good indication of how it will look.
You may also be able to make your computer visible on the local wi-fi network by enabling web sharing and then just access it by IP address from the iPhone browser.
Alternatively, if you set up your computer as an adhoc wireless network, you can connect to it from your iPhone (select your computer as the wi-fi router) and again access it from the iPhone browser using its IP address.
In debug mode you'll have to use -bindAddress and use an address that you can access from your phone. If you have a local wireless that both your compter and iphone can connect to then using -bindAddress 0.0.0.0 will bind to your wireless card IP address (so you don't have to type it). On my laptop it looks like this:
Dev Mode initialized. Startup URL:
http://192.168.1.100:8888/index.html?gwt.codesvr=192.168.1.100:9997
then just open this address in iPhone.

Categories