HELP: problem with EAI getBrowser call in COSMO 1.0 
Author Message
 HELP: problem with EAI getBrowser call in COSMO 1.0

Hi,

        I've been wrestling with this problem for some time now: Can't get
a reference to the browser handle...

        I've tried using the static call Browser.getBrowser(this) which
throws a NullPointer exception. I then mocha'd the vrml.external.Browser
class file and found out that the static call is using the old JSObject
stuff anyway.

        I have found that the getBrowser function fails when

        embeds = (JSObject)doc.getMember("embeds");

        is called.

        What's even more infuriating is that this problem dissapears on
other machines I've tested at my office. Is this a configuration issue?
Has anybody had similar experiences. Any help REALLY appreciated...

Using Netscape 4.04 and Cosmo 1.02

Thanks in advance,
Brant Chamberlain

public class XApplet extends Applet {
  Browser browser;
  Node root;
  JSObject embeds;

  public void init() {

    System.out.println("REV #024");

    try{
      System.out.println("Sleeping");
      Thread.sleep(5000);
    }
    catch(InterruptedException ie) {
      System.out.println("Done sleeping");
    }

    JSObject win = JSObject.getWindow(this);
    JSObject doc = (JSObject)win.getMember("document");
          embeds = (JSObject)doc.getMember("embeds");

    System.out.println(embeds); //let's print out the embeds info
    browser = (Browser)embeds.getSlot(0);

    if(browser == null) {
      System.out.println("Browser still null");
    }

  }

---------------------------HTML stuff----------------------------------

<html>
<title>Embed Test</title>

<center>
<applet MAYSCRIPT code="XApplet.class"  width="300" height="300" >
</applet>
</center>

<center>
<embed src="file:///d|/work/build/root.wrl" border=0 height="300"
width="300">
</embed>
</center>

</html>



Fri, 16 Jun 2000 03:00:00 GMT  
 HELP: problem with EAI getBrowser call in COSMO 1.0

Brant already has his answer (answered through www-vrml) but I thought
I'd repeat a few of the things that came up cuz they could be useful to
others.

First, my original reply:

We've seen this problem before and believe that it's a netscape problem
and it appears to only happen in the 4.x versions.  The hack-around is
to
put the getBrowser() call in a loop:

---
        for (int count = 0; count < 10; count++) {
            browser = Browser.getBrowser (this);
            if (browser != null) break;
            try {Thread.sleep (200);}
            catch (InterruptedException ignored) {}
            System.out.println ("browser was null, trying again");
        }
        if (browser == null) {
            throw new Error ("Failed to get the browser after 10 tries!");
        }
        browser.print ("Got browser\n");
---

Might I also *strongly* suggest that you move your getBrowser() call out
of the init() function and into the start() function.  If you do it in
the
init() function and you hang on to the browser reference, if the user
does
a reload or goes back then forward, your applet will crash.  The reason
is
that init() gets called once when the page is first visited.  However
every time the page is reloaded, the vrml browser gets destroyed and
re-created.  So any reference that you had to the browser (or any
events,
etc.) are bogus after re-loading.  If you move that stuff to start(),
which gets called each time you visit a page, then you should be fine.

----

Then when that didn't help, some more investigation was done and it was
determined that the problem was that the applet he was trying to run was
on his CLASSPATH.  I've done some testing on this and it appears as
though there's a bug in netscape where if you have the EAI applet on
your CLASSPATH, then calls to getBrowser() will always fail.  By simply
removing the EAI applet's directory from the CLASSPATH (or moving the
applet), everything seems to work fine.  This is very odd indeed.
However, note that it works just fine in IE4 (even with the applet on
the CLASSPATH).

-Dave

Quote:

> Hi,

>         I've been wrestling with this problem for some time now: Can't get
> a reference to the browser handle...

>         I've tried using the static call Browser.getBrowser(this) which
> throws a NullPointer exception. I then mocha'd the vrml.external.Browser
> class file and found out that the static call is using the old JSObject
> stuff anyway.

>         I have found that the getBrowser function fails when

>         embeds = (JSObject)doc.getMember("embeds");

>         is called.

>         What's even more infuriating is that this problem dissapears on
> other machines I've tested at my office. Is this a configuration issue?
> Has anybody had similar experiences. Any help REALLY appreciated...

> Using Netscape 4.04 and Cosmo 1.02

> Thanks in advance,
> Brant Chamberlain


--


A Silicon Graphics Company  |   http://reality.sgi.com/chamber
  Phone: (650) 933-6414     |          http://doh.engr/


Sat, 17 Jun 2000 03:00:00 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. EAI,Cosmo Player: getBrowser return NullPointerException!

2. getBrowser problem (EAI)

3. getBrowser() problem in EAI

4. Problem with EAI and getBrowser

5. REQ: Crack or Reg for Cosmo Worlds 2.0 Trial and Cosmo PageFX 1.0 Trial

6. EAI with cosmo player problem!

7. Problems with Cosmo and EAI

8. Cosmo 2.0 and EAI problem

9. Problem: EAI+Cosmo 1.0.1 crashes Netscape 3.01 (win95)

10. Cosmo+EAI crashes - a cry for help

11. EAI: getBrowser

12. EAI: getBrowser(Applet,frame,index)

 

 
Powered by phpBB® Forum Software