Win a copy of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Thread with static resources fails in Sun JVM. Why?  RSS feed

 
Chinh Tran Nam
Ranch Hand
Posts: 35
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,

My applet uses threads to put locks on 2 static resources (a Hashtable and a Vector). It works smoothly in browsers with Microsoft JVM. When i changed browser plugin to Sun's JVM 1.3, the applet failed to run and following exceptions thrown to Java Console continuously:


Please let me know the reason and how to fix it?

Thanks in advance.
Chinh
[ July 21, 2005: Message edited by: Chinh Tran Nam ]
 
Joe Ess
Bartender
Posts: 9425
12
Linux Mac OS X Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You may need to show us some code. . .
 
Chinh Tran Nam
Ranch Hand
Posts: 35
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Here is it:

Resource declaration:


2 methods to add/remove resource elements


Main method for manipulation


The performHashTable() method is called at init() and stop() events of the Applet.
Please note that if I remove "static" from all resources and methods above, the applet works smoothly.

Looking to your reply.
[ July 21, 2005: Message edited by: Chinh Tran Nam ]
 
Mr. C Lamont Gilbert
Ranch Hand
Posts: 1170
Eclipse IDE Hibernate Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It does not appear that the exception is being thrown by any of the code you showed. Can you give more info on where the exception is being thrown?
 
Chinh Tran Nam
Ranch Hand
Posts: 35
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Actually, No user code threw that Exception. Please see the trace below:


Please note that if I remove the "static" from all resource declarations and methods, no exception thrown.

Please advice?
 
Chinh Tran Nam
Ranch Hand
Posts: 35
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I realized that the exception was only thrown when I re-opened the page that contains the applet. It's ok for the first time. It seems that the JRE has trouble re-registering the ViewPanel (retrieved from the stateTable) with Event Listeners. No problem with Microsoft JVM, is it a known bug of Sun JRE?
 
Mr. C Lamont Gilbert
Ranch Hand
Posts: 1170
Eclipse IDE Hibernate Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It would seem that something in that threads run method is null. It appears that you have not properly initialized something. What is inside the run method?
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!