Download Java Application using JNLP with single domain and multiple IPs - java

We have a Java Application having multiples jar and launch over JNLP using a URL. Whenever we change the IP behind the URL our all jars download again.
What information on client machine are checked to download the jars?

Related

FTP - Client downloads WAR file instead if showing it as a website

Okay so my problem is that I need to deploy my website from eclipse to an online server which is provided by my university. I've been handled a guide, which suggested that I converted my entire project into a WAR file. The WAR file is placed on my desktop and that particular path is also applied in my Filezilla setup.
The problem is, when I try to run the code through filezilla with the following URL
ftp://Kristian1709tomcat#Kristian1709.tomcat.student.hum.au.dk/webapps/b-exam-ba-newssite.war -
My browser starts downloading the WAR file instead of showing it as a website.
My instructions from my teacher is as followed:
The Host
Kristian1709.tomcat.student.hum.au.dk
Username: Kristian1709#tomcat
Password: *******
Any sort of help will be very welcomed as I have to handle in the entire project for my finally exame tomorrow.
In advance thank you!
FTP stands for File Transfer Protocol, in my experience War files are to be run inside an application server, such as glassfish or tomcat server, and viewed through a browser, not a FTP client
Make sure its hosted within an application server and a change of url should fix your problem.
I have about 4 war files deployed on a glassfish server, that's independent of http and ftp.
go here in your browser Kristian1709.tomcat.student.hum.au.dk
And login/deploy

How to deploy war file to Glassfish?

I've developed a RESTful web service in netbeans and it made a .war file for me. now i want to deploy it to my host using glassfish.
there are lots of tutorials on the net about deploying war file to glass fish(for example) but they all describe how to deploy to local machine(localhost), but as i mentioned i want to deploy to my website host. how to do that?
You should be able to do that using the admin console. This is an old documentation link, but it is still valid:
http://docs.oracle.com/cd/E19798-01/821-1757/ghgjn/index.html
It tells you to go to http://localhost:4848 but you will obviously need to make sure that you can access the admin console remotely (i.e. replacing localhost with your hostname).
If not, you will need to use the command-line asadmin commands change-admin-password (if the admin password hasn't been set - it defaults to nothing) follwed by enable-secure-admin to allow remote access. Remote access to the console is only allowed over https, so these two steps are necessary before you can use it.
You will need SSH access to the server you are using to enable that - but if you already have SSH access then you can always use SCP or FTP to transfer your WAR to the server and then follow the steps in the guide you linked to.

How can I host a Jar file on Tomcat

I have developed a simple management software like library,shop item management. when I compiled my java files I get a .Jar file which I want to host somewhere (tomcat etc.) so that anybody can go to that IP and add/modify the iteams. Is it possible ? I developed that software using java Jframe.
You need to create a JNLP (Java Network Launch Protocol)
The Java Network Launch Protocol (JNLP) enables an application to be launched on a client desktop by using resources that are hosted on a remote web server
See This for detail about JNLP.
Also you will get a lot of information from google about JNLP.

Recommended server for JNLP

I have never used JNLP, and I have no web/war server already running so I will install it from sratch:
Which to use?
GlassFish
Tomcat
Apache
Jetty
Another?
I wonder if someone already using JNLP could make any recomendation for the server.
I just want a blank page with a button in the middle for starting the application nothing more, nothing less.
If you use only JNLP you don't need Java server. JNLP is client side. Simple http server like Apache HTTP Server should be OK. HTTP server will be better solution than use of web container/Java EE server because JNLP (usually) is a static content. Even lighthttpd should be enough.
As already stated any server capable to serve HTTP will do. If your WebStart application is not signed by itself (i.e. you code-signed the corresponding Jar files) you could probably consider to publish the JNLP plus its resources via HTTPS. This way your clients will know that the software they are going to execute came from its rightful origin. Although unsigned WebStart applications are restricted in their privileges on the client's machine it still is a measure to elicit trust in your clients. On the other hand this requires more configuration effort with regard to the server you chose.
If your application will need some extended privileges on the client's machine such as access to the file system then I would recommend that you do sign your jar files to gain the necessary privileges automatically (don't forget to specify them in a element within your JNLP).
These are the default restrictions for unsigned WebStart apps:
No access to local disk.
All your jars must be downloaded from the same host. Note, however, that you can download extensions and JREs from any host as long as they are signed and trusted.
Network connections are allowed only to host from which your jars were downloaded. ("Phone home restriction.")
No security manager can be installed.
No native libraries (not even in extensions).
Limited access to system properties. (The application has read/write access to all system properties defined in the jnlp file, as well as read-only access to the same set of properties as applets
You dont need a server to run JNLP(Webstart).. This is how webstart works
it simply is an application that can be started over the web, this would be the procedure from the user perspective:
user goes to yourwebsite.com
user see's link: run my awesome app
user clicks link, which downloads .jnlp file
user runs the jnlp file through java web start (part of java SE, user requires java runtime environment JRE to run this)
java web start reads jnlp to get information about the server that holds the corresponding application
jar files get downloaded automatically (the first time) and then the application starts
user gets bored and closes application
the next day, user comes back and clicks your link again
application is already downloaded, so it starts right away
user gets bored again and closes your application
1 day later, you decide to update your application and you deploy the new jar file on your
server, replacing one of the old files
after 2 days user clicks your link again
java web start recognizes that the user has a different version, downloads update automatically and starts the application again
...
..
.

Using an applet embedded in html page to communicate with database

I have created an applet that communicates with a MS Access database (or at least, it should). It works fine when I run it through Dr Java or NetBeans, but when I embed the .class file in an html page and open the html page, it seems to run but none of the changes it is supposed to make to the database actually happen and it cannot retrieve data from the database either. What do I need to do?
Note: the html file, the class file, and the java source file are all on my computer, and in the same folder. The html file is not published or anything, I just created it myself to test the applet.
If you want the database on a server, you need to have it on the same server as the applet is on. E.g. Use Jetty and write a Servlet that communicates with the database via JDBC. The applet then has to communicate with your Servlet, maybe as a web service.
applets run in a sandbox environment . if applet requires access to user system resources it needs to be signed.
package your ".class" files in a jar . have an html file outside the jar that references your jar inside applet tag. then sign your applet jar. see http://java.sun.com/developer/onlineTraining/Programming/JDCBook/signed.html
-----------UPDATE------------------------------
There are two ways of connecting to a database on the server side.
1- The hard way. Untrusted applets cannot touch the hard disk of a computer. Thus, your applet cannot use native or other local files (such as JDBC database drivers) on your hard drive. The first alternative solution is to create a digitally signed applet which may use locally installed JDBC drivers, able to connect directly to the database on the server side.
2- The easy way. Untrusted applets may only open a network connection to the server from which they were downloaded. Thus, you must place a database listener (either the database itself, or a middleware server) on the server node from which the applet was downloaded. The applet would open a socket connection to the middleware server, located on the same computer node as the webserver from which the applet was downloaded. The middleware server is used as a mediator, connecting to and extract data from the database
(Comment by OP on the other thread.)
Could you please explain how the applet can "phone home" to its own server?
I suspect the basic problem with your current approach is that the JRE is getting confused as to whether the DB and applet are on the same 'server'. The first thing to do is stop thinking about folders or directories (or their associated URLs), and do everything, including access the applet, via. your local server. So the URL to the applet should be something like..
http://localhost:8080/the/applet.html
Then make sure all calls to the DB are done through the server as well.

Categories