JamixOy
asked on
Signing a jar slows app when first time accessing data from servlet
Hi,
After signing a jar, there came a 10 - 15 sec delay when accessing a servlet for a first time. Does this delay come from cert trying to check that it is valid? Is there any workaround on this?
Regards,
Mika
After signing a jar, there came a 10 - 15 sec delay when accessing a servlet for a first time. Does this delay come from cert trying to check that it is valid? Is there any workaround on this?
Regards,
Mika
wht do u mean by signing a jar ?
ASKER
Hi karanw,
We have purchased a certificate for signing jar-files. So I'll sign the jar-file with that sertificate to avoid security warnings; which are otherwise shown to the user when he/she starts the app. Usually we use WebStart to start the app, but now for showcase and testing, the jar-file is started from the command prompt.
/ mika
We have purchased a certificate for signing jar-files. So I'll sign the jar-file with that sertificate to avoid security warnings; which are otherwise shown to the user when he/she starts the app. Usually we use WebStart to start the app, but now for showcase and testing, the jar-file is started from the command prompt.
/ mika
> Does this delay come from cert trying to check that it is valid?
would say so
> Is there any workaround on this?
should just be a once off if user says to trust cert always
would say so
> Is there any workaround on this?
should just be a once off if user says to trust cert always
ASKER
Hi Objects,
There is also difference when jar is started from command propmt vs. double clicking. If I start the program with java -jar prog.jar, the delay is not so long (maybe 2 - 3 sec which is good enough).
After a little testing I am not sure that the validating is the issue which is delaying the first acces to servlet (Maybe signing the jar makes some other changes to the jar). The cpu load is in 100 % when delay is on.
What am I missing here?
Cheers,
Mika
There is also difference when jar is started from command propmt vs. double clicking. If I start the program with java -jar prog.jar, the delay is not so long (maybe 2 - 3 sec which is good enough).
After a little testing I am not sure that the validating is the issue which is delaying the first acces to servlet (Maybe signing the jar makes some other changes to the jar). The cpu load is in 100 % when delay is on.
What am I missing here?
Cheers,
Mika
ASKER
Hi Objects,
Thanks for the link. I would think that this might be the same issue.
I use the javax.crypto.* classes to encrypt datatransfer over the internet. The jar size is about 5MB. I am using JRE 1.5.0_08.
Here are some timings:
no jar: 359 ms
Running from command prompt (java -jar app.jar):
========================== =======
unsigned jar: 953 ms
signed jar: 1437 ms
Running with double clicking the jar:
=======================
unsigned jar: 986 ms
signed jar: 23144 ms
My desktop is P4 3.00GHz, 1GB RAM.
Regards,
Mika
Thanks for the link. I would think that this might be the same issue.
I use the javax.crypto.* classes to encrypt datatransfer over the internet. The jar size is about 5MB. I am using JRE 1.5.0_08.
Here are some timings:
no jar: 359 ms
Running from command prompt (java -jar app.jar):
==========================
unsigned jar: 953 ms
signed jar: 1437 ms
Running with double clicking the jar:
=======================
unsigned jar: 986 ms
signed jar: 23144 ms
My desktop is P4 3.00GHz, 1GB RAM.
Regards,
Mika
> signed jar: 23144 ms
thats the strange one, check what the .jar association is ie. what it runs
try this:
javaw -jar app.jar
thats the strange one, check what the .jar association is ie. what it runs
try this:
javaw -jar app.jar
ASKER
Hi Objects,
It is opened by: Java(TM) 2 Platform Standard Edition binary. Have no idea where this links to..
The time with javaw -jar app.jar is: 1531 ms.
It is opened by: Java(TM) 2 Platform Standard Edition binary. Have no idea where this links to..
The time with javaw -jar app.jar is: 1531 ms.
I don't see how that can take so much longer, you can check the file mappings in
Tools>Folder Options>File Types
Tools>Folder Options>File Types
ASKER
The mapping is: Java(TM) 2 Platform Standard Edition binary, but have no idea where that is mapped to..
Standard Edition binary? java.exe? javaw.exe? which parameters does it use?
I'll try to debug the app deeper to find where the delay actually is..
Standard Edition binary? java.exe? javaw.exe? which parameters does it use?
I'll try to debug the app deeper to find where the delay actually is..
you can check further and find the exact copmmand it executes.
ASKER
Hi,
Sorry, had no time to test this earlier, but here it is:
The rows that consume lots time are:
private Cipher cipherAES = null;
private SecretKeySpec skeySpec = null;
skeySpec = new SecretKeySpec(key, "AES");
cipherAES = Cipher.getInstance("AES");
cipherAES.init(Cipher.DECR YPT_MODE, skeySpec);
return cipherAES.doFinal(toDec);
Expecially the row: 'cipherAES.init(Cipher.DEC RYPT_MODE, skeySpec);' takes the 99.99% of the time (and only if the jar package is signed). Any suggestions?
/ mika
Sorry, had no time to test this earlier, but here it is:
The rows that consume lots time are:
private Cipher cipherAES = null;
private SecretKeySpec skeySpec = null;
skeySpec = new SecretKeySpec(key, "AES");
cipherAES = Cipher.getInstance("AES");
cipherAES.init(Cipher.DECR
return cipherAES.doFinal(toDec);
Expecially the row: 'cipherAES.init(Cipher.DEC
/ mika
i meant the windows command it executes.
it appears javaw is taking considerably longer than java
it appears javaw is taking considerably longer than java
ASKER
Hi objects,
I think that I found what causes the problem. I previously told that I was using jre 1.5.0_08, but I think that the link from windows to .jar file was to version 1.5.0_06 even I had ver _08 installed.
When running the jar with _06, the delay is very long (appox. 25 sec), but when using jre ver _08, the delay is quite short (maybe that 1,5 sec). _07 is as fast as _08.
I'll try to find what Sun did with the _07 jre..
Cheers,
Mika
I think that I found what causes the problem. I previously told that I was using jre 1.5.0_08, but I think that the link from windows to .jar file was to version 1.5.0_06 even I had ver _08 installed.
When running the jar with _06, the delay is very long (appox. 25 sec), but when using jre ver _08, the delay is quite short (maybe that 1,5 sec). _07 is as fast as _08.
I'll try to find what Sun did with the _07 jre..
Cheers,
Mika
ASKER
Hi,
Found this:
6354728 java classes_security Verification of signed JAR files is very slow (performance reduction)
Patched to _07.
/ mika
Found this:
6354728 java classes_security Verification of signed JAR files is very slow (performance reduction)
Patched to _07.
/ mika
ah, thats explains the time discrepancy. was getting confused :)
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.