InternalError: couldn't create component peer - AWT Applet refresh

R

Richard Maher

Hi,

I've got the simplest of Mickey-Mouse AWT dialogue boxes created from an
Applet that is now returning the following error when I refresh the page
(i.e. first time through everything is peachy): -

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 java.awt.Window.pack(Unknown Source)
at tier3Client.Tier3Logon.<init>(Tier3Logon.java:67)
at tier3Client.Tier3Session$Connection.open(Tier3Session.java:352)
at tier3Client.Tier3Session.checkIn(Tier3Session.java:680)
at tier3Client.Tier3Application.init(Tier3Application.java:96)
at sun.applet.AppletPanel.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)

As you can see below the triggering code is a simple "pack": -

package tier3Client;

import java.awt.*;
import java.awt.event.*;

import tier3Client.Tier3ClientException;


final class Tier3Logon extends Dialog
implements ActionListener
{
Label headr = new Label("Server Authentication Required"
, Label.LEFT);
Label user = new Label("Username:", Label.RIGHT);
Label pass = new Label("Password:", Label.RIGHT);

TextField inUser = new TextField(40);
TextField inPass = new TextField(40);

Button okay = new Button("OK");
Button cncl = new Button("Cancel");

Checkbox cb = new Checkbox("Display logon confirmation",true);

boolean logonAborted = false;

protected Tier3Logon(Frame dFrame)
{
super(dFrame,"Tier3 Logon",true);

setBackground(Color.white);

headr.setFont(new Font("Helvetica", Font.BOLD, 14));

inPass.setEchoChar('*');

Panel top = new Panel();
top.setLayout(new GridLayout(1, 2, 8, 2));
top.add(headr);
top.add(cb);
add("North", top);

Panel pc = new Panel();
pc.setLayout(new GridLayout(2, 2, 8, 2));
pc.add(user);
pc.add(inUser);
pc.add(pass);
pc.add(inPass);
add("Center", pc);

okay.addActionListener(this);
cncl.addActionListener(this);

Panel pb = new Panel();
pb.add(okay);
pb.add(cncl);
add("South", pb);

setBounds(200, 210, 300, 300);
pack();
setResizable(false);
setVisible(true);
}

public void actionPerformed(ActionEvent ae)
{
if (ae.getSource() == cncl)
logonAborted = true;

setVisible(false);
}
}

I have the same code working/refreshable elsewhere and the only differences
that stand out are that in that case it's all done from the Applet's init()
method, and in this case Tier3Logon forms part of a static class variable.

For the working example see: -
http://manson.vistech.net/t3$examples/demo_client_flex.html
Username: TIER3_DEMO
Password: QUEUE

Anything a bit more helpful than "InternalError"?

Cheers Richard Maher

BTW. I"ve juggled things around a bit and the error still occurs but is now
on the setVisible(true) method.

PS. I understand AWT is not the sexiest or most modern toolkit on the planet
but I'd appreciate it if we could stick with it for the sake of the example.
 
J

John B. Matthews

[...]
For the working example see: -
http://manson.vistech.net/t3$examples/demo_client_flex.html
Username: TIER3_DEMO
Password: QUEUE

Anything a bit more helpful than "InternalError"?
[...]

I am unable to reproduce this error with SAfari 3.2.1 or Firefox 3.0.9:

<console>
Java Plug-in 1.5.0
Using JRE version 1.5.0_16 Java HotSpot(TM) Client VM
....
MRJ Plugin for Mac OS X v1.0.1
[starting up Java Applet Security @ Mon Apr 27 10:02:29 EDT 2009]
Mon Apr 27 10:02:30 EDT 2009 JEP creating applet CornuCopiae
(http://manson.vistech.net/t3$examples/)
<<< ProxyClassLoader: defined LiveConnectProxy class. >>>
<<< Here're the permissions you've got: >>>
<<< java.security.Permissions@b54362 (
(java.net.SocketPermission manson.vistech.net connect,accept,resolve)
)<<< ProxyClassLoader: defined LiveConnectProxy class. >>>
<<< Here're the permissions you've got: >>>
<<< java.security.Permissions@d5b89c (
(java.net.SocketPermission manson.vistech.net connect,accept,resolve)
)</console>
 
R

Richard Maher

Hi John,

John B. Matthews said:
[...]
For the working example see: -
http://manson.vistech.net/t3$examples/demo_client_flex.html
Username: TIER3_DEMO
Password: QUEUE

Anything a bit more helpful than "InternalError"?
[...]

I am unable to reproduce this error with SAfari 3.2.1 or Firefox 3.0.9:

Thanks for the reply but when I said "working example" I should have said
"an example of the same code working/not producing the error" and not a
"working example [of the error]". Sorry for the confusion.

I don't have a net accessible version of the failing example but was really
hoping this error message, stack trace, and/or symptoms (refresh only)
might trigger someone's memory?

As I said in the earlier post: -
[I have the same code working/refreshable elsewhere and the only differences
that stand out are that in that case it's all done from the Applet's init()
method, and in this case Tier3Logon forms part of a static class variable.]

Any ideas what could make AWT throw an Internal Error "Couldn't create
component peer" in these circumstances?

Cheers Richard Maher

PS. Or were you saying you couldn't get the example to work at all?
 
J

John B. Matthews

R

Richard Maher

Hi John,

John B. Matthews said:
[...]
Any ideas what could make AWT throw an Internal Error "Couldn't create
component peer" in these circumstances?

This brings to mind a dim recollection of AWT failing on a headless
system:

<http://java.sun.com/developer/technicalArticles/J2SE/Desktop/headless/>

Thanks, I'm reading it now. But it's just dawned on me that when I pluck an
existing/matching Session from the static session registry (as would happen
with an application-match during a refresh) the I don't replace/renew the
parentFrame from the Applet.

I'll put money on the old one being trashed/nolonger valid and in need of an
update. (If you don't hear back from me, that was it :)
[...]
PS. Or were you saying you couldn't get the example to work at all?

No, the login appeared to work correctly, opening a tcp4 connection on
port 5255.

Thanks for trying it out for me. (Flex and MXML are pretty flash aren't
they? Excuse the pun :)

Cheers Richard Maher
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,020
Latest member
GenesisGai

Latest Threads

Top