Solved

JNLP - input parameters not recieved

Posted on 2003-11-26
12
2,136 Views
Last Modified: 2012-06-21
I have two different servers with the exact same .jar and the exact same dynamic .jnlp file.

On one server, when I run it - my application gets the parameters it needs. On the other, it's empty.

On BOTH servers, the HTTP log looks like this:

Nov 26 16:01:54 notus httpd: test.bam - rundod: automode=openwork, user=testuser, user-agent=Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)Nov 26 16:01:55 notus httpd: test.bam - rundod: automode=, user=, user-agent=JNLP/1.0.1 javaws/1.4.2_01 (b06) J2SE/1.4.2_01


The first time the JNLP is called (from the browser) - the arguments are correct (automode & user) - the second time it is called (from javaws) the arguments are empty.

As I said, the http log is the same on both servers, but on one my app gets the arguments and on the other it doesn't. I run it from the same machine, so it can't be differences in the java version.

I know it doesn't get the arguments on one of the servers because I do a println of all arguments passed and look at the Java Web Start log.
0
Comment
Question by:borbjo
12 Comments
 
LVL 3

Expert Comment

by:savalou
ID: 9826255
I think you need to post the code you're using to make the call.

What does it mean that one call is from the browser and the other is from javaws?  

If the log  entries you posted are from one server and the other looks exactly the same, is the javaws http call not supposed to have parameters?  

What is the difference between server platforms?
0
 

Author Comment

by:borbjo
ID: 9830145
>What is the difference between server platforms?

Sorry, it's the same server - but different subdomains.

>What does it mean that one call is from the browser and the other is from javaws?

The app is run with Java Web Start. It seems that JWS produces two requests for the JNLP file. The first when the user clicks on the link in his browser, and the second when JWS downloads / requests the file (as shown in the http log). I output the user agent in the log, and this shows that the first request is from IE and the second is from javaws.

>If the log  entries you posted are from one server and the other looks exactly the same, is the javaws http call not
>supposed to have parameters?  

I do not know. All I know is that on one server my app gets the parameters - and the other it doesn't. Both have parameters in the first request, and none in the second.

Here's the JNLP file (it's PHP):

<?

Header ("Content-Type: application/x-java-jnlp-file");
include("inc/connect.conf");
include("inc/checkAccess.inc");

error_log("test.bam - rundod: automode=$automode, user=".$user->username.", user-agent=".$HTTP_SERVER_VARS["HTTP_USER_AGENT"]);

echo "<?";?>
xml version="1.0" encoding="utf-8"<?
echo "?>";
?>

<jnlp spec="0.2 1.0"
      codebase="<?=SYSTEM_DOMAIN?>"
      href="run.php">
   <information>
      <title>Test Application</title>
      <vendor><?=COMPANY_NAME?></vendor>
      <homepage href="index.html"/>
      <description>Test Application</description>
      <description kind="short">Just a test</description>
   </information>
   <resources>
      <j2se version="1.4+" href="http://java.sun.com/products/autodl/j2se"/>
      <j2se version="1.2+"/>
      <jar href="test.jar" main="true" download="eager"/>
      <jar href="jaxb-ri.jar"/>
      <jar href="jaxb-libs.jar"/>
      <jar href="jaxb-xjc.jar"/>
      <jar href="commons-codec-1.1.jar"/>
   </resources>
   <application-desc main-class="com.xxx.test">
      <argument>user=<?=$user->username?></argument>
      <argument>password=<?=$user->md5password?></argument>
      <argument>serverroot=<?=SERVER_ROOT?></argument>
      <?
            if($automode != "") {
                  echo "<argument>automode=" . $automode . "</argument>";
            }
?></application>
   <security>
      <all-permissions>
   </security>
</jnlp>



0
 
LVL 4

Expert Comment

by:Howie_Ly
ID: 9833928
Assuming PHP runs okay on server#2, then

it could be a problem with your connection to retrieve the username + password?  i.e.

> include("inc/connect.conf");
> include("inc/checkAccess.inc");

Where is it going to for for connect?  Could it be a permission problem if it is a database.. can you run a debug on these two files?  Can you substitute username and password with hard-coded text to establish that this is actually a connection problem?
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:borbjo
ID: 9835527
This was my first thought also ..

The PHP runs ok on both servers, if I do a mget of the file I retrieve the correct JNLP with username/password. The third argument is retrieved via GET (eg. run.php?automode=openwork). Also, you can see that the username/password is correct in the first http log entry.

it's just very weird.
0
 

Author Comment

by:borbjo
ID: 9835567
uhm, sorry, I meant wget :)

0
 
LVL 4

Expert Comment

by:Howie_Ly
ID: 9840565
Does it help by fully qualifying the url of
> include("inc/connect.conf");
??

e.g. include("http://mywebserver.com/inc/connect.conf");

I think you're on the right track however.
0
 

Author Comment

by:borbjo
ID: 9848641
It doesn't help even if I remove those lines entirely.

I decided to remove everything that has to do with user-authentication, and removed all includes. The only parameter left is the automode which is recieved via GET (run.php?automode=openwork).

It seems that the file is cached or something, because even if I run the file with run.php?automode=new when I run the app autmode will still be "openwork" - as it was the first time.
0
 

Author Comment

by:borbjo
ID: 9848660
Sorry, I made a mistake .. I had set the href="run.jnlp" (static) which had the autmode=openwork by default when testing on friday.

When I changed back to run.php it turns out that it continues to ignore the input parameter completely so that autmode is empty again.
0
 

Author Comment

by:borbjo
ID: 9866003
I decided to solve the problem by writing a .jnlp file to a temp directory every time my application is run.

This is sort of a "hack" that I'm not totally comfortable with as argument info will be placed in the jnlp for everyone to read (even though the filename is random and it's placed in a directory that doesn't perform file listing).

0
 
LVL 4

Expert Comment

by:Howie_Ly
ID: 9866103
Good to hear you solved it !

Ask for a refund on your points here
http://www.experts-exchange.com/Community_Support/

0
 

Accepted Solution

by:
SpazMODic earned 0 total points
ID: 9887973
PAQed, with points refunded (250)

SpazMODic
EE Moderator
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
String array comparison 4 45
collection output issue 9 59
java mysql insert application 14 41
Where to place postgres JDBC driver jar on tomcat 8 25
INTRODUCTION Working with files is a moderately common task in Java.  For most projects hard coding the file names, using parameters in configuration files, or using command-line arguments is sufficient.   However, when your application has vi…
Introduction This article is the first of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article explains our test automation goals. Then rationale is given for the tools we use to a…
Viewers will learn about arithmetic and Boolean expressions in Java and the logical operators used to create Boolean expressions. We will cover the symbols used for arithmetic expressions and define each logical operator and how to use them in Boole…
Viewers will learn about the regular for loop in Java and how to use it. Definition: Break the for loop down into 3 parts: Syntax when using for loops: Example using a for loop:

740 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question