As I remember this error occurs on Linux when the initialization code in 
Mozilla.java is called before the System Path to the location of XULRunner 
is set. The initialization code in Mozilla.java is only executed once per 
workspace start. The code is in create method

public void create (Composite parent, int style) {
        delegate = new MozillaDelegate (browser);
        Display display = parent.getDisplay ();

        int /*long*/[] result = new int /*long*/[1];
        if (!Initialized) {

the variable Initialized controls when the initialization code is run. The 
first time anybody create a browser component the initialization code is 
run. For instance, the initial welcome page that shows the first time a 
workbench started is a browser component. This will cause the 
initialization code to run when the workbench is first started, but before 
you set the XULRunner System Path variable. The problem will not occur 
when XULRunner is register using ---register-global, since SWT can find 
XULRunner when the first browser component is created. You need to make 
sure that you get the System Path set before any browser component is 
created not just browser components you create. 

    thanks
     Bob

Robert Goodman
IBM Emerging Technologies
[EMAIL PROTECTED]
512-838-8824    T.L. 678-8824



"Philippe Ombredanne" <[EMAIL PROTECTED]> 
Sent by: [EMAIL PROTECTED]
11/09/2007 01:54 PM
Please respond to
[EMAIL PROTECTED]; Please respond to
AJAX Toolkit Framework discussion <atf-dev@eclipse.org>


To
"'AJAX Toolkit Framework discussion'" <atf-dev@eclipse.org>
cc

Subject
RE: [atf-dev] Application doesn't find the Xulrunner instance






Do you have problem on Linux ?
Or windows?
 
--
Cheers
Philippe
http://easyeclipse.org - http://phpeclipse.net - http://eclipse.org/atf -
http://eclipse.org/vep - http://labs.jboss.org/drools/ - 
http://developer.mozilla.org/en/docs/XULRunner


-----Original Message-----
From: Michael A Squillace [mailto:[EMAIL PROTECTED] 
Sent: Friday, November 02, 2007 10:17 AM
To: [EMAIL PROTECTED]; AJAX Toolkit Framework discussion
Subject: RE: [atf-dev] Application doesn't find the Xulrunner instance


Philippe: 
Thanks for the information. I've been digging through the Mozilla.create 
method and that works fine. I have a browser editor, much like ATF, that 
sets up the mozilla browser. The first two lines are: 

                final Browser browser = new Browser(parent, SWT.MOZILLA); 
                final nsIWebBrowser webBrowser = (nsIWebBrowser) 
browser.getWebBrowser(); 

The webBrowser turns out to be null and, upon debugging, I find that I get 
an InvocationTargetException in the getWebBrowser() method.  The relevant 
code is: 

                Class clazz = Class.forName ("org.mozilla.xpcom.Mozilla"); 
//$NON-NLS-1$ 
                Method method = clazz.getMethod ("getInstance", new 
Class[0]); //$NON-NLS-1$ 
                Object mozilla = method.invoke (null, new Object[0]); 
                method = clazz.getMethod ("wrapXPCOMObject", new Class[] 
{Long.TYPE, String.class}); //$NON-NLS-1$ 
                webBrowserObject = method.invoke (mozilla, new Object[] {
new Long (webBrowser.getAddress ()), nsIWebBrowser.NS_IWEBBROWSER_IID_STR
}); 
                return webBrowserObject; 

The exception happens at line 1258, webBrowserObject = method.invoke...Of 
course, there's nothing in the catch blocks so I have no idea regarding 
the root cause of the InvocationTargetException. 
So, it's not in the Mozilla.create method I'm having the problem. 
I have no problem if I register the xulrunner installation via 
--register-global. 

--> Mike Squillace
IBM Human Ability and Accessibility Center
Austin, TX

W:512.823.7423
M:512.970.0066

[EMAIL PROTECTED]
www.ibm.com/able 


"Philippe Ombredanne" <[EMAIL PROTECTED]> 
Sent by: [EMAIL PROTECTED] 
11/09/2007 12:31 PM 

Please respond to
[EMAIL PROTECTED]; Please respond to
AJAX Toolkit Framework discussion <atf-dev@eclipse.org>



To
"'AJAX Toolkit Framework discussion'" <atf-dev@eclipse.org> 
cc

Subject
RE: [atf-dev] Application doesn't find the Xulrunner instance








Michael A Squillace wrote:
>According to the SWT FAQ, the XULRunner instance must also be "properly
installed," 
>which means executing xulrunner.exe with, say, ---register-global. 
>http://www.eclipse.org/swt/faq.php#howusemozilla 
>Does ATF do this as well or is this a manual step required by the user? 
>If a required manual step, it would be nice to find a way around it else
having a 
>xulrunner plug-in becomes pointless - ie I might just as well use any
XULRunner 
>installation, right? I know that there has been some talk of
re-architecting all 
>of this so maybe I'm missing something. Also, apologies if this is a
question 
>that would be more appropriate for the SWT team. 
Hey Mike, no it is perfectly appropriate.
Xulrunner does not have to be registered.
When a Browser with SWT.MOZILLA style is instantiated, a suitable 
Xulrunner
is searched, from the most specific to the least specific.
The code is in the SWt method Mozilla.create (Composite parent, int style) 

here:
http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.swt/Eclipse%20SWT%20Moz

illa/common/org/eclipse/swt/browser/Mozilla.java?revision=1.67&view=markup

The search sequence is roughly: (check the code for exact details)
- lookup a xulrunner at the location  contained in the System property:
org.eclipse.swt.browser.XULRunnerPath
- if not defined, try to initiallized a xulrunner that is registered
(globally or user, usually global)
- if failing then fallback to the mozilla pointed by the MOZILLA_FIVE_HOME
envrionment variable.
if everything fails (including not finding an embeddable mozilla runtine 
or
xulrunner that is embeddable and satifies the versions constraints
(GreVersionRange), then fail.

Therefore the way ATF does it is to provide an extension point such that:
- we can ship a xulrunner as an OSGI bundle
- the extension markup points inside that bundle that contains a proper
xulrunner
- the extension looks that up and if found, creates the
org.eclipse.swt.browser.XULRunnerPath sys prop. It tries to do that at
startup time, so that we can be the very first to initialize a xulrunner.
The first code to instantiates a xulrunner wins. we do for now.

Then we just instantiate the browser widget when needed, and the sequence 
is
that defined in SWT, taking into account our system property.


-- 
Cheers
Philippe

philippe ombredanne | 1 650 799 0949 | pombredanne at nexb.com 
nexB - Open by Design (tm) - http://www.nexb.com 
http://easyeclipse.org - http://phpeclipse.net - http://eclipse.org/atf - 
http://eclipse.org/vep - http://labs.jboss.org/drools/ -
http://developer.mozilla.org/en/docs/XULRunner

_______________________________________________
atf-dev mailing list
atf-dev@eclipse.org
https://dev.eclipse.org/mailman/listinfo/atf-dev
_______________________________________________
atf-dev mailing list
atf-dev@eclipse.org
https://dev.eclipse.org/mailman/listinfo/atf-dev

_______________________________________________
atf-dev mailing list
atf-dev@eclipse.org
https://dev.eclipse.org/mailman/listinfo/atf-dev

Reply via email to