Applet served by Java Web Start problem

I am having a similar problem to this one.

I am using applets through webstart, and they are starting really slow, like loading each resource/class separated when needed instead loading all jars at start, sometimes failing too.


.... 2.6.32-26-generic-pae) Java/1.6.0_22"
**** - - [29/Dec/2010:14:56:31 -0200] "GET /prototipos/discoverthename-release/resources-0.0.1-SNAPSHOT.jar HTTP/1.1" 200 812712 "-" "Mozilla/4.0 (Linux 2.6.32-26-generic-pae) Java/1.6.0_22"
**** - - [29/Dec/2010:14:56:36 -0200] "GET /prototipos/discoverthename-release/resources-0.0.1-SNAPSHOT.jar HTTP/1.1" 200 812712 "-" "Mozilla/4.0 (Linux 2.6.32-26-generic-pae) Java/1.6.0_22"
**** - - [29/Dec/2010:14:56:40 -0200] "GET /prototipos/discoverthename-release/resources-0.0.1-SNAPSHOT.jar HTTP/1.1" 200 812712 "-" "Mozilla/4.0 (Linux 2.6.32-26-generic-pae) Java/1.6.0_22"
**** - - [29/Dec/2010:14:56:44 -0200] "GET /prototipos/discoverthename-release/resources-0.0.1-SNAPSHOT.jar HTTP/1.1" 200 812712 "-"

That is happening with my new applets, I have others working right, using webstart too, The only difference I can think between old and new applets is the dependencies (resources and nativelibs).

I have tried to put download=“eager” to all resources and nativelibs in the jnlp but didn’t work either, it kept the lazy behavior.

Hope anyone knows a solution :smiley:

you can try using to see if that helps.

tried that, it seems it didn’t work either.

The problem seems to be other, I said classes and resources were loaded separately, but no, all jars are loaded at start and validated, but then when trying to get a class from

JNLP2ClassLoader.findClass

it fails and try to get permissions to access a jar.

This is a trace example:


basic: JNLP2ClassLoader.findClass: org.newdawn.slick.AppletGameContainer$1: try again ..
basic: JNLP2ClassLoader.findClass: org.newdawn.slick.GameContainer: try again ..
basic: JNLP2ClassLoader.findClass: org.newdawn.slick.gui.GUIContext: try again ..
basic: JNLP2ClassLoader.findClass: org.newdawn.slick.AppletGameContainer$Container: try again ..
basic: JNLP2ClassLoader.findClass: org.newdawn.slick.AppletGameContainer$2: try again ..
basic: Subprograma cargado.
basic: Applet resized and added to parent container
basic: PERF: AppletExecutionRunnable - applet.init() BEGIN ; jvmLaunch dt 151070 us, pluginInit dt 18048582 us, TotalTime: 18199652 us
basic: JNLP2ClassLoader.findClass: com.gemserk.games.discoverthename.Game: try again ..
basic: JNLP2ClassLoader.getPermissions() ..
basic: Plugin2ClassLoader.getPermissions CeilingPolicy allPerms
security: JAVAWS AppPolicy Permission requested for: http://www.gemserk.com/prototipos/discoverthename-release/main-0.0.1-SNAPSHOT.jar
basic: JNLP2ClassLoader.getPermissions() X
basic: JNLP2ClassLoader.findClass: org.newdawn.slick.state.StateBasedGame: try again ..
basic: JNLP2ClassLoader.findClass: org.newdawn.slick.Game: try again ..

Again, the problem seems to be other, but it is really difficult to debug or to find information over the web.

Here in this log, each time I load an asset, it seems to try to get the jar again, local on my machine that works really fast, but on our games server it is slow, because there are a lot of requests…But we don’t know if asset loading is related either.


09:10:34.085 [Thread-15] INFO  c.g.r.d.ClassPathDataSource - loading stream classpath://assets/images/ball_animation.png
network: Conectando http://acoppes-laptop.local/prototipos/discoverthename-latest/resources-0.0.1-SNAPSHOT.jar con proxy=DIRECT
09:10:34.099 [Thread-15] INFO  c.g.r.d.ClassPathDataSource - loading stream classpath://assets/images/block_crack_animation.png
network: Conectando http://acoppes-laptop.local/prototipos/discoverthename-latest/resources-0.0.1-SNAPSHOT.jar con proxy=DIRECT
09:10:34.107 [Thread-15] INFO  c.g.r.d.ClassPathDataSource - loading stream classpath://assets/images/block_crack_animation.png
network: Conectando http://acoppes-laptop.local/prototipos/discoverthename-latest/resources-0.0.1-SNAPSHOT.jar con proxy=DIRECT
09:10:34.115 [Thread-15] INFO  c.g.r.d.ClassPathDataSource - loading stream classpath://assets/images/block_crack_animation.png
network: Conectando http://acoppes-laptop.local/prototipos/discoverthename-latest/resources-0.0.1-SNAPSHOT.jar con proxy=DIRECT
09:10:34.125 [Thread-15] INFO  c.g.r.d.ClassPathDataSource - loading stream classpath://assets/images/block_crack_animation.png
network: Conectando http://acoppes-laptop.local/prototipos/discoverthename-latest/resources-0.0.1-SNAPSHOT.jar con proxy=DIRECT
09:10:34.134 [Thread-15] INFO  c.g.r.d.ClassPathDataSource - loading stream classpath://assets/images/block_crack_animation.png
network: Conectando http://acoppes-laptop.local/prototipos/discoverthename-latest/resources-0.0.1-SNAPSHOT.jar con proxy=DIRECT
09:10:34.144 [Thread-15] INFO  c.g.r.d.ClassPathDataSource - loading stream classpath://assets/images/block_crack_animation.png
network: Conectando http://acoppes-laptop.local/prototipos/discoverthename-latest/resources-0.0.1-SNAPSHOT.jar con proxy=DIRECT
09:10:34.155 [Thread-15] INFO  c.g.r.d.ClassPathDataSource - loading stream classpath://assets/images/block_crack_animation.png
network: Conectando http://acoppes-laptop.local/prototipos/discoverthename-latest/resources-0.0.1-SNAPSHOT.jar con proxy=DIRECT
09:10:34.163 [Thread-15] INFO  c.g.r.d.ClassPathDataSource - loading stream classpath://assets/images/block_crack_animation.png
network: Conectando http://acoppes-laptop.local/prototipos/discoverthename-latest/resources-0.0.1-SNAPSHOT.jar con proxy=DIRECT
09:10:34.173 [Thread-15] INFO  c.g.r.d.ClassPathDataSource - loading stream classpath://assets/images/block_crack_animation.png
network: Conectando http://acoppes-laptop.local/prototipos/discoverthename-latest/resources-0.0.1-SNAPSHOT.jar con proxy=DIRECT
09:10:36.511 [Thread-15] INFO  c.g.g.d.g.PlayingGameStateEntityBuilder - Leaving playing state

Personally had way too many problems with JWS and caching, just given up on it, something is seriously broken in there somewhere.

A workaround you could use is the AppletLoader. It has its own download mechanism and cache system so bypasses most the problems with JWS and its cache system.

fu%$#$ keyboard shortcuts… I wrote a big post and press back or something and firefox killed all my writings in 1 second… :’(

Well… first of all, as I said on slick forums:

[quote]… all games are working perfectly as independent webstart but not working when using new generation applets. Some old games are working even using that format too.

We cant find the difference between working and not working games.

It should be some new dependency or something we are doing differently inside the game.
[/quote]
We want to discover this applet bug because:

  1. we believe using jws should be the right way to deploy our games, how the cache, update and stuff is managed
  2. we have all the build and deploy process automated, we deploy for applet and webstart almost without extra cost
  3. we cant sleep without knowing what the hell is happening :smiley:

Of course, we think to use lwjgl applet loader as the first option if we couldn’t fix this.

Btw, we have no problems at all using webstart outside the browser.

  1. Have you tried different computers? i.e. is the issue reproducible at different computer.
  2. Are you using a different server for the newer jars that have the issue?
  3. Are you using some extra parameters maybe for the applet version as opposed to the jws version?
  4. Does it also happen if you try it in different browsers?
  5. If you have an older version of java somewhere maybe you can try that to see if its related to some recent change made in the jre itself.
  1. I have tried on 3 different computers, on Windows and Linux and Firefox and Chrome (all combinations :D)
  2. Same server, same folder structure and permissions, etc. I am signing with same certificates, etc, certificates are not outdated.
  3. Jnlp for applets have one difference with jnlp for webstart applciations (the applet tag) but running them from linux terminal with javaws http://…applet.jnlp works great, so I believe the problem is inside the browser :frowning:
  4. answered on 1)
  5. I have games working and games not working, compiled using the same jdk and running in the same jre, so I believe jre versions is not related. I have even “recompiled” with new jdk the old games and they keep working.

keep you updated if I found something.

I am using logback for logging, I found if I remove the logback.xml (for configuring the appenders, etc) the applet loads fast. It is a first workaround, but I want to know why this happens exactly.