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.
Related
I wanna deploy a java app on tomcat 9 to be accessible by typing an address like www.justanormalapp.stuff. Now I have a dedicated server machine on which i'm going to be installing tomcat and deploying the WAR app file but it can be only accessed locally through http://localhost:8080/myapp/ and I don't know how to make it accessible online.
I am not looking for some fancy domain name as anything free will do since the app is only going to be used for 3 - 6 months.
If all your PCs are not in the same net, you have to create an VPN to allow external computers access to your server.
So:
Create your VPN.
Configure VPN in the PCs where you want to access to your application
Use ip:port/myapp
This should be enough.
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.
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.
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
I want to place a server program written in Java on the cloud. It would accept TCP socket connections from clients (clients are android phones using 3G), do some computations, save stuff to a MySQL database (also on EC2), and send stuff back to the clients over the TCP connections. It may even be necessary to create several instances of the server (i.e. a process group).
Is this easy to do? I think I can make a AMI, but I'm not sure how to upload Java files, compile and run them, and create a MySQL database etc
Any help would be much appreciated.
Take a look at using Amazon Elastic Beanstalk. Beanstalk is Amazon's PaaS offering and it will alleviate a lot of the system administration burden. Here's a quick description from their docs:
AWS Elastic Beanstalk is an even
easier way for you to quickly deploy
and manage applications in the AWS
cloud. You simply upload your
application, and Elastic Beanstalk
automatically handles the deployment
details of capacity provisioning, load
balancing, auto-scaling, and
application health monitoring.
Also, if you're interested in using MySQL then you should look at Amazon RDS. Again, this will alleviate the system administration burden for your database tier. Here's a quick description from their docs:
Amazon Relational Database Service
(Amazon RDS) is a web service that
makes it easy to set up, operate, and
scale a relational database in the
cloud. It provides cost-efficient and
resizable capacity while managing
time-consuming database administration
tasks, freeing you up to focus on your
applications and business.
Is this easy to do? I think I can make
a AMI, ...
I think the answer depends on how comfortable you are with system administration in general. Creating a AMI to run in EC2 is really pretty much the same as creating a physical server or a VM image. You'll need to install an operating system, and then install tools, libraries and programs you need (like mysql, the jdk, ssh, etc).
You can save yourself a little work by using one of Amazon's pre-built AMI's http://aws.amazon.com/amis/. But, ultimately, you'll be responsible for all system administration of the server. If you've never built a server from the ground up, you have a pretty big learning curve ahead of you. It's not insurmountable, but just be warned that the devil is in the details; there's a ton of stuff you'll need to learn ;-)
... but I'm not sure how to upload Java
files, compile and run them, ...
Once the server is setup and running in EC2, compiling them and running java files is just the same as compiling and running on your local. Normally, you probably want to compile and package your java app into a jar or war and then transfer that up to your EC2 server. If you install linux os on your EC2 server, you can use scp or a FTP client to transfer your files over sftp to move the files from your local up to the server. Once the latest files are up on your server, you can ssh to the server and start your app.
... and create a MySQL database etc ...
Installing mysql is going to be specific to the OS you choose to install on your server. For example, you can install mysql easily on Ubuntu with a command like:
sudo aptitude install mysql
Again, there will be more system-admin-type stuff to learn here specific to mysql databases.
So, it's definitely doable. An experienced sys admin could build a AMI instance pretty easily/quickly. If this is your first experience with system administration, I'd suggest finding an old Desktop you have lying around and try installing Ubuntu and all the required libraries and tools you need (mysql, jdk, ssh, etc..). Get your java program working on the old desktop and then it should be pretty easy to create an AMI from that. Then you can run your custom AMI on EC2 and will be set up.
If you don't have a spare desktop lying around, you can use one of the Virtual Machine products like VMWare Player or Sun's VirtualBox and build a server instance on one of those.
If you want to avoid the hassle of managing the entire install of the Operating system, you might want to look at services like slicehost and/or linode instead of EC2. They give you ssh access to a pre-installed server. And it's as easy as clicking a button to install programs like mysql, etc.
Hope this answer is relevant and helpful, good luck.
- Dave
If you can use Tomcat as your server - you might want to try Amazon Web Services Elastic Beanstalk It will greatly simplify your task by providing an easy instance of Tomcat to deploy.
EDIT: AWS has a full section on how to develop using Java here: http://aws.amazon.com/java/
How comfortable are you with remote administering a server and solving problems most people have never heard of? That's what you're talking about.
You'll create your EC2 instance, log into it and configure it like you would any other server you're working with. You can download JDKs to it, dbs etc. You might consider using a tool like Chef to help you. You'll use ftp and scp to copy files to the server.
You're probably going to want your Java server on one box and have it talk to a separate db server since you say you may want multiple servers.
Once the server is working the way you like it you can create an image of it to use to launch multiple instances, then configure a load balancer to point at your servers.
If you can create a MySql db on your local box you can create it in the cloud. If not?....
Running Applications needs app. s/w to run them.
Apps such as Cyber Duck helps to upload files via SFTP.
I am successful in doing the same problem addressed.. Trust me, YOU CAN DO IT. All u need is interfaces for server services such as MySQL (use WorkBench to connect using key pair), terminal access (using PUTTY/SSH via MAC) and well you are good to go
I think to get started is to use a a whole unit packed into one archive.
Think of it as you have your Java files compiled, a embedded http server say tomcat. Now all of this packed in a jar ready to be deployed on Amazon's EC2. Use this link for more on embedded servers and relevant code.
As far as database is concerned, you can use Amazon's RDS. You can configure mysql on RDS and obtain a link to it for connection. Amazon RDS would help you to get started with database.
Now that you have everything ready to start and work with application. Now is the time to deploy on Amazon AMI
Perform Following steps to deploy you app on Amazon EC2:
Create a server instance on Amazon EC2 refer EC2 getting started.
Receive Private key file i.e. .pem(receive from Step 1), this file would help you to login to your server instance and perform SFTP.
Use Putty or similar SSH client to login to your EC2 server instance created on Step-1 using .pem file and server's public DNS, refer Accessing Instance for SSH login.
Transfer the archived files packed into jar to server using SFTP client, WinnSCP being one such client, refer SFTP for more on it.
Run application. Note in case of jar file you can simply fire java -jar TomcatApp.jar.
If everything is configured properly you would be to access the app using EC2 instance's public DNS or public IP, which would be of the form:
http://<public_dns_address>:<port number>/servlet
Hope it helps you to get started and provide you an overall view.