This discussion is archived
6 Replies Latest reply: Dec 27, 2011 11:54 PM by DarrylBurke RSS

Applet does not load in firefox

901819 Newbie
Currently Being Moderated
Hi,

When I try to load an applet in Firefox, it throws an "java.lang.InternalError: couldn't create component peer".

Any help will be greatly appreciated.

Thanks
Ravi
  • 1. Re: Applet does not load in firefox
    817264 Journeyer
    Currently Being Moderated
    Post more details - what is your OS and firefox versions, what JRE is being used, what jre's are installed, full detailed trace log, etc.
    Does problem happen with any applet or only your applet?
    Can you run standalone java application on this system? Also try reinstalling JRE and installing latest JRE - does it change anything?

    See http://docs.oracle.com/javase/7/docs/webnotes/tsg/TSG-Desktop/html/plugin.html for more troubleshooting hints.
  • 2. Re: Applet does not load in firefox
    901819 Newbie
    Currently Being Moderated
    Hi,

    The problem is not related to JRE's and other factors which you have mentioned.
    The applet is nested inside two divs on a webpage.
    The same applet when nested inside two divs on the second webpage works properly.

    But on the page where it does not load properly (this happens in firefox only with any applet and not always), below is the error code: Sometimes it does load properly though.
    Firefox version : 8.0

    Java Plug-in 1.6.0_29
    Using JRE version 1.6.0_29-b11 Java HotSpot(TM) Client VM
    User home directory = C:\Users\XXX
    ----------------------------------------------------
    c: clear console window
    f: finalize objects on finalization queue
    g: garbage collect
    h: display this help message
    l: dump classloader list
    m: print memory usage
    o: trigger logging
    q: hide console
    r: reload policy configuration
    s: dump system and deployment properties
    t: dump thread list
    v: dump thread stack
    x: clear classloader cache
    0-5: set trace level to <n>
    ----------------------------------------------------


    Exception in thread "AWT-EventQueue-2" java.lang.InternalError: couldn't create component peer
         at sun.awt.windows.WComponentPeer.checkCreation(Unknown Source)
         at sun.awt.windows.WComponentPeer.<init>(Unknown Source)
         at sun.awt.windows.WCanvasPeer.<init>(Unknown Source)
         at sun.awt.windows.WPanelPeer.<init>(Unknown Source)
         at sun.awt.windows.WWindowPeer.<init>(Unknown Source)
         at sun.awt.windows.WFramePeer.<init>(Unknown Source)
         at sun.awt.windows.WEmbeddedFramePeer.<init>(Unknown Source)
         at sun.awt.windows.WToolkit.createEmbeddedFrame(Unknown Source)
         at sun.awt.windows.WEmbeddedFrame.addNotify(Unknown Source)
         at sun.plugin2.main.client.PluginEmbeddedFrame.addNotify(Unknown Source)
         at sun.awt.windows.WEmbeddedFrame.<init>(Unknown Source)
         at sun.plugin2.main.client.PluginEmbeddedFrame.<init>(Unknown Source)
         at sun.plugin2.main.client.PluginMain$StartAppletRunner.run(Unknown Source)
         at java.awt.event.InvocationEvent.dispatch(Unknown Source)
         at java.awt.EventQueue.dispatchEventImpl(Unknown Source)
         at java.awt.EventQueue.access$000(Unknown Source)
         at java.awt.EventQueue$1.run(Unknown Source)
         at java.awt.EventQueue$1.run(Unknown Source)
         at java.security.AccessController.doPrivileged(Native Method)
         at java.security.AccessControlContext$1.doIntersectionPrivilege(Unknown Source)
         at java.awt.EventQueue.dispatchEvent(Unknown Source)
         at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
         at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
         at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
         at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
         at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
         at java.awt.EventDispatchThread.run(Unknown Source)
    Checking source domain...
    http://www.ehouse.co.uk/viewer/ is a licensed domain
    This applet is licensed for: http://www.ehouse.co.uk
    eViewer started
    loadImage[0] is not completely loaded...
    *** completed loading image loadImage[0]
    started loading image with id = 1
    Checking source domain...
    http://www.ehouse.co.uk/viewer/ is a licensed domain
    This applet is licensed for: http://www.ehouse.co.uk


    eViewer started
    loadImage[0] is completely loaded!!
    *** completed loading image loadImage[0]
    started loading image with id = 1
    started loading image with id = 2
    started loading image with id = 3
    viewImage is completely loaded!!

    Thanks
    Ravi
  • 3. Re: Applet does not load in firefox
    901819 Newbie
    Currently Being Moderated
    Hi,

    Can anyone help with the above problem?

    Thanks
    Ravi
  • 4. Re: Applet does not load in firefox
    796440 Guru
    Currently Being Moderated
    898816 wrote:
    Exception in thread "AWT-EventQueue-2" java.lang.InternalError: couldn't create component peer
    This might be a red herring. Do you have anything else after this? I think I see this sometimes in my console as well, even when the applet does load. I have a similar problem where, in FF on one particular machine, the JVM sometimes crashes on startup. So I may see your error sometimes when the applet works and other times when it does not. You'll want to look for a hs_err file. On my Windows 7 system, it ends up in C:/Users/((my username))/AppData/LocalLow/Sun/Java/Deployment/log and the file is named something like plugin8907965597188596960.trace

    I have no idea what the problem is or how to fix it. Just trying to make sure you're looking at the actual problem.

    Good luck!
  • 5. Re: Applet does not load in firefox
    901819 Newbie
    Currently Being Moderated
    Hi,

    There are two or three such files in my Win7 system.
    Will paste the contents of one of the trace files here.(could not find option to attach the file).
    It did not help me much but probably can be useful for other people here to extract something out of it.


    security: property package.access value sun.,com.sun.xml.internal.ws.,com.sun.xml.internal.bind.,com.sun.imageio.
    security: property package.access new value sun.,com.sun.xml.internal.ws.,com.sun.xml.internal.bind.,com.sun.imageio.,com.sun.javaws
    security: property package.access value sun.,com.sun.xml.internal.ws.,com.sun.xml.internal.bind.,com.sun.imageio.,com.sun.javaws
    security: property package.access new value sun.,com.sun.xml.internal.ws.,com.sun.xml.internal.bind.,com.sun.imageio.,com.sun.javaws,com.sun.deploy
    security: property package.access value sun.,com.sun.xml.internal.ws.,com.sun.xml.internal.bind.,com.sun.imageio.,com.sun.javaws,com.sun.deploy
    security: property package.access new value sun.,com.sun.xml.internal.ws.,com.sun.xml.internal.bind.,com.sun.imageio.,com.sun.javaws,com.sun.deploy,com.sun.jnlp
    security: property package.definition value null
    security: property package.definition new value com.sun.javaws
    security: property package.definition value com.sun.javaws
    security: property package.definition new value com.sun.javaws,com.sun.deploy
    security: property package.definition value com.sun.javaws,com.sun.deploy
    security: property package.definition new value com.sun.javaws,com.sun.deploy,com.sun.jnlp
    security: property package.access value sun.,com.sun.xml.internal.ws.,com.sun.xml.internal.bind.,com.sun.imageio.,com.sun.javaws,com.sun.deploy,com.sun.jnlp
    security: property package.access new value sun.,com.sun.xml.internal.ws.,com.sun.xml.internal.bind.,com.sun.imageio.,com.sun.javaws,com.sun.deploy,com.sun.jnlp,org.mozilla.jss
    security: property package.definition value com.sun.javaws,com.sun.deploy,com.sun.jnlp
    security: property package.definition new value com.sun.javaws,com.sun.deploy,com.sun.jnlp,org.mozilla.jss
    basic: Added progress listener: sun.plugin.util.GrayBoxPainter$GrayBoxProgressListener@337d0f
    basic: Plugin2ClassLoader.addURL parent called for http://www.ehouse.co.uk/viewer/ehouseviewer4.zip
    security: Blacklist revocation check is enabled
    security: Trusted libraries list check is enabled
    network: Cache entry found [url: http://www.ehouse.co.uk/viewer/ehouseviewer4.zip, version: null] prevalidated=false/0
    network: Connecting http://www.ehouse.co.uk/viewer/ehouseviewer4.zip with proxy=DIRECT
    network: Connecting http://www.ehouse.co.uk:80/ with proxy=DIRECT
    network: ResponseCode for http://www.ehouse.co.uk/viewer/ehouseviewer4.zip : 304
    network: Encoding for http://www.ehouse.co.uk/viewer/ehouseviewer4.zip : null
    network: Disconnect connection to http://www.ehouse.co.uk/viewer/ehouseviewer4.zip
    cache: Reading Signers from 0 http://www.ehouse.co.uk/viewer/ehouseviewer4.zip | C:\Users\Ravi\AppData\LocalLow\Sun\Java\Deployment\cache\6.0\29\724e889d-628ee923.idx
    network: No certificate info for unsigned JAR file: http://www.ehouse.co.uk/viewer/ehouseviewer4.zip
    network: No certificate info for unsigned JAR file: http://www.ehouse.co.uk/viewer/ehouseviewer4.zip
    cache: Read manifest for http://www.ehouse.co.uk/viewer/ehouseviewer4.zip: read=22 full=22
    basic: Applet loaded.
    basic: Applet resized and added to parent container
    basic: PERF: AppletExecutionRunnable - applet.init() BEGIN ; jvmLaunch dt 102031 us, pluginInit dt 542337 us, TotalTime: 644368 us
    Checking source domain...
    http://www.ehouse.co.uk/viewer/ is a licensed domain
    This applet is licensed for: http://www.ehouse.co.uk
    basic: Loaded image: http://www.ehouse.co.uk/viewer/leftbutton.gif
    basic: Loaded image: http://www.ehouse.co.uk/viewer/stopbutton.gif
    basic: Loaded image: http://www.ehouse.co.uk/viewer/rightbutton.gif
    basic: Loaded image: http://www.ehouse.co.uk/viewer/infobutton.gif
    network: Cache entry found [url: http://www.ehouse.co.uk/viewer/standard11/8114376.txt, version: null] prevalidated=false/0
    network: Connecting http://www.ehouse.co.uk/viewer/standard11/8114376.txt with proxy=DIRECT
    network: ResponseCode for http://www.ehouse.co.uk/viewer/standard11/8114376.txt : 304
    network: Encoding for http://www.ehouse.co.uk/viewer/standard11/8114376.txt : null
    network: Disconnect connection to http://www.ehouse.co.uk/viewer/standard11/8114376.txt
    basic: Removed progress listener: sun.plugin.util.GrayBoxPainter$GrayBoxProgressListener@337d0f
    Exception in thread "thread applet-eViewer.class-1" java.lang.InternalError: couldn't create component peer
         at sun.awt.windows.WComponentPeer.checkCreation(Unknown Source)
         at sun.awt.windows.WComponentPeer.<init>(Unknown Source)
         at sun.awt.windows.WCanvasPeer.<init>(Unknown Source)
         at sun.awt.windows.WPanelPeer.<init>(Unknown Source)
         at sun.awt.windows.WWindowPeer.<init>(Unknown Source)
         at sun.awt.windows.WDialogPeer.<init>(Unknown Source)
         at sun.awt.windows.WToolkit.createDialog(Unknown Source)
         at java.awt.Dialog.addNotify(Unknown Source)
         at java.awt.Window.pack(Unknown Source)
         at c.<init>(Unknown Source)
         at eViewer.init(Unknown Source)
         at sun.plugin2.applet.Plugin2Manager$AppletExecutionRunnable.run(Unknown Source)
         at java.lang.Thread.run(Unknown Source)


    Thanks
    Ravi

    Edited by: 898816 on 19-Dec-2011 08:51
  • 6. Re: Applet does not load in firefox
    DarrylBurke Guru Moderator
    Currently Being Moderated
    But on the page where it does not load properly (this happens in firefox only with any applet and not always), below is the error code: Sometimes it does load properly though.
    Sounds like a concurrency issue to me. Make sure that all Swing constructors and methods are invoked only on the EDT. This means wrapping the call(s) in a SwingUtilities#invokeLater. Modified from the Applet development tutorials:
      public void init() {
            //Execute a job on the event-dispatching thread; creating this applet's GUI.
            try {
                SwingUtilities.invokeLater(new Runnable() {
                    public void run() {
                        createGUI();
                    }
                });
            } catch (Exception e) { 
                System.err.println("createGUI didn't complete successfully");
            }
        }
    The createGUI() method runs all the Swing code.

    Note: the tutorial examples use invokeAndWait, not invokeLater, but I've seen a few reports of an Exception being thrown because the init() method was already executing on the EDT. In those cases, the problem was resolved by using invokeLater.

    db

    edit Batter stilll, that should be
      public void init() {
            Runnable runnable = new Runnable() {
    
              public void run() {
                createGUI();
              }
            };
            try {
              if (SwingUtilities.isEventDispatchThread()) {
                runnable.run();
              } else {
                  SwingUtilities.invokeAndWait(runnable();
              }
            } catch (Exception e) { 
                System.err.println("createGUI didn't complete successfully");
            }
        }
    Edited by: Darryl Burke

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points