Get your CodeRanch badge!*
The moose likes JNLP and Web Start and the fly likes Not accessing or saving data in browser in a  Web Start application Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » JNLP and Web Start
Bookmark "Not accessing or saving data in browser in a  Web Start application" Watch "Not accessing or saving data in browser in a  Web Start application" New topic
Author

Not accessing or saving data in browser in a Web Start application

Mishaal Khan
Ranch Hand

Joined: Aug 21, 2008
Posts: 61
Hello,

I ' m trying to run a swing application which is writing and reading data from MySql Database in
browser using JNLP file. Application is working fine if I run it on desktop , I mean its saving and
retrieveing data , but when I run the appplication in browser it is displaying the window with all the fields.
But all the data related code is not responding and also not showing any errors. Any clue ,what am I missing?



Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18110
    
    8

How do you run your JNLP application in the browser?
Mishaal Khan
Ranch Hand

Joined: Aug 21, 2008
Posts: 61
Thanks for the reply.

I simply type the address of my html page which has javascript code
to initilaize the launch button i.e here the code for the html page,

<body>
....
<script src="http://www.java.com/js/deployJava.js"></script>
<script>
// using JavaScript to get location of JNLP file relative to HTML page
var dir = location.href.substring(0, location.href.lastIndexOf('/')+1);
var url = dir + "dynamictree-webstart.jnlp";
deployJava.createWebStartLaunchButton(url, '1.6.0');
</script>
....
</body>



when I click the button it starts the application and displays the window,but not diplaying
any data ,but working fine as a desktop appplication.

Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18110
    
    8

Ah, I see. So actually you are using the browser to download and install the application on the client system. So the installation is working correctly, and the application starts running on the client system? You will know if it does, because it will start up in a separate window and you can close the browser without causing the application to terminate. Can you confirm that?
Mishaal Khan
Ranch Hand

Joined: Aug 21, 2008
Posts: 61
Yes, even when I close the browser window the application keeps running.
Any advice what can I do to run as expected i.e interact with database?

Thanks.
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18110
    
    8

Okay. Then you're just running it in the normal way. (Your reference to "running in the browser" confused me.) Anyway it's just an ordinary Java application, so you connect to the database in the normal way. If your code fails to connect to the database, do you have any way of finding out (a) that it failed to connect, and (b) the errors which caused it to fail? If you don't, then your first step should be to fix that problem.

I'm guessing that probably you just need to sign the application, but it's certainly possible that (for example) you hard-coded "localhost" as the location of the database server, and that worked OK in your testing because your test machine was the database server but now it doesn't work in the wild. Or there could be any number of other problems.
Mishaal Khan
Ranch Hand

Joined: Aug 21, 2008
Posts: 61
Yes I have hardcoded the server location as localhost and as you said its not able to find the server ,so what do mean
by sign the application ? Could it solve the problem ?

Thanks.
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18110
    
    8

Mishaal Khan wrote:Yes I have hardcoded the server location as localhost and as you said its not able to find the server ,so what do mean
by sign the application ? Could it solve the problem ?

Well, it might, but first you have to fix the obvious stuff. The server location in your JDBC URL has to be the actual location of the database server. If it says "localhost" then that means "this computer" and therefore the application won't work on any computer except the database server computer. This might be the desired outcome but if it is, there isn't any point in distributing it via Web Start.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Not accessing or saving data in browser in a Web Start application
 
Similar Threads
Any Solution for this.
Spring + Hibernate - EJB = ?
RCP: Passing data to workbench/ Saving workbench data
running an executable file on the server by client
running an executable file on the server by client