Tomcat and Eclipse Real Website - java

I have created a website running on eclipse and tomcat. What is the way to make this website running online for real?? I have developed it, adding filters and sessions and using a database. I want to allow people to use this website. What I have to do?

You need to publically expose your computer and the port you set up.
If your application runs locally, it must be able to be hit by the outside world.
Make sure the tomcat config is setup correctly and ensure port forwarding on your router or modem is setup. Your public IP (available if you google whats my ip) and the port is all your users would need.

Related

Java web app not responding to HTTP requests when deployed to Azure App Service using Windows app service plan

I have built a web app which runs with simply java -jar app.jar. It looks at the environment variable PORT to decide which port to listen on. now I want to deploy it to Azure with a Windows app service plan, this is called This is called "Java SE deployment" in Azure.
On a Linux app service plan, I can simply deploy the app.jar file (using vs code plugin, zipdeploy, or whatever), set the environment variable PORT, and everything is fine.
With a Windows app service plan, attempting to access the app gives a 500 error with the body "The web server failed to respond within the specified time". I've turned on all the logging I can, and I can see the request gets into IIS but no indication that it's attempted to send the request to my app.
However I can access my app directly from the Azure console using curl http://localhost:<port>. so I know it has started up.
I've done this tutorial https://learn.microsoft.com/en-us/azure/app-service/quickstart-java?tabs=javase&pivots=platform-windows which works fine, but I'm not using maven or spring boot - I need to build the jar file myself.
I've read https://learn.microsoft.com/en-us/azure/app-service/deploy-zip and https://learn.microsoft.com/en-us/azure/app-service/configure-language-java?pivots=platform-windows but they doesn't seem to be telling me anything I don't already know.
By dumping out the environment in my app, I discovered that Azure sets the environment variable SERVER_PORT to a number and that if you listen on that number, the requests are forwarded correctly. It actually sets quite a few environment variables to the same port number, but I chose SERVER_PORT because it looks like the most meaningful name, and there are some references to it in various blogs etc. HTTP_PLATFORM_PORT is also set.
I'd still be grateful for any references to official Microsoft documentation, so at least I know whether there's a "proper" way to do this.

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 to put Java program online?

I am learning Java and am trying to do some experiments with networking Java programs.
I have a program made in 2 parts with a client and a server and it works in local testing but the program actually has usefulness for me and a friend of mine and I want to put the server online so both of us can connect to it and use it.
Where/How can I put the program online and have it running so that the client programs can connect to the ServerSocket with an ip address? (Preferably free)
If you dont want to pay server hosting then I would open a virtual server on my computer, then playaround with modem and forward related port to server ip. I would use a port more than 40000. Then just send your ip and port your friend or update application.
If you really want the application to go live within 5 mins, try Jelastic. If you have built a WAR file, simply sign up with their server,choose a provider closest to your geo location, configure Tomcat and you can upload the WAR file through their fantastic web console. Otherwise if you have some source control system(SVN,GIT etc), you just connect and build it with their Maven console and you can be ready. I used it for my start up(Cloudlabz) and really found it exciting.
Surya
You could also consider the cheapest Rackspace Cloud Server. You'll get a full fledged Linux server (distribution of your choice) for about USD 11/month. I've done that now and then myself to try things out.
Just install Java on it and you're good to go.
http://www.rackspace.com/cloud/cloud_hosting_products/servers/pricing/
http://ideone.com/
is that what you want for this?
This is a free web app for you to run your program online....so you can just paste your code and run it.
On the cloud you could use two different services in order to host your Java application.
IaaS (Infrastructure as a Service). Where you can just rent a specific infrastructure on the cloud and you could install and configure all the services that you need.
PaaS (Platform as a Service). In this case, you still enjoy the infrastructure on the cloud + the service Aaren full pre-configured. It means that you can deploy your application without installing or configuring anything. You just need to deploy your application. You have an example about how it works here. Also, you usually can test your Java apps on the cloud without paying.
You should host the server in Heroku ,they offer a free hosting with limits , I have an app there

Domino server 7.0.3FP1 Proxy settings with java agent

First, this is not the first time I ask a question related to this problem, but now that we have talked with the network admin guys and we know we absolutely HAVE to get through that proxy, I will ask again the question but with further details.
So here is the deal. We have an application built for Lotus Notes. That application needs to talk with a web service that is located outside the network of our client, but nothing can get out of the network without going through a proxy server. Since the Agent is running on the server, we need to tell the server to go through the proxy first. That can be achieved in Java using the System's properties (http.proxyHost, etc). That being said, I set all the properties related to the proxy settings in my Java Agent, and then I try getting the XML file from the web service. What I get is a connection time out exception. So, I was wondering why? We did a network analysis with WireShark, and the application is not trying to go through the proxy. Here is what it STRANGELY does.
I built the application and set the proxy host to a dummy address, just for the time I get the real proxy address and my credentials. Let's say proxy.mydomain.com
I get my credentials, so I change the proxy config with the real ones, say webproxy.ca.mydomain.net
Nothing works, so we restart the Domino server and do a clearcache, thinking it might be related to this
We did a network analysis with WireShark and the application queries the DNS for this:
proxy.mydomain.com
proxy.mydomain.com.ca.mydomain.com
proxy.mydomain.com.eu.mydomain.com
proxy.mydomain.com.anotherknowdomain.com
And that goes for a while. BUT, I can see it's still using the dummy address. Where does it get it. It's not in notes.ini, it's not in the server's cache, it's not in my source code, it's not in java.properties, it not in the JVM (since we restarted the machine). Any idea? We're at the end of a project and we need this to work to deliver it and preassure is building!!! I searched the WHOLE WEB!!!
One more thing I would say, when I set my properties in java code, I tryied to print them before to see if it was ok and everything is fine...
For your information, even though it was a web proxy going through HTTP, the JVM setting sockProxyHost was set and preceds on the other. That was our problem...

Categories