• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Thread with static resources fails in Sun JVM. Why?

 
Ranch Hand
Posts: 35
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 ]
 
Bartender
Posts: 9626
16
Mac OS X Linux Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 ]
 
Ranch Hand
Posts: 1170
Hibernate Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Hibernate Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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?
reply
    Bookmark Topic Watch Topic
  • New Topic