Unexpected quit / disconnect in Win7

222 views
Skip to first unread message

Frank Schiller

unread,
Dec 28, 2012, 9:51:33 AM12/28/12
to jexplor...@teamdev.com
Hi,
we're using JExplorer 2.6 (IWebBrowser2- Interface) on WinXp and Win7 (64-bit). On WinXp the following example works fine, but on Windows7 we're sometimes receiving an unexpected  quit (Log:  INFO  IEAutomationSamplePeer - onQuit closed false) after calling browserPeer.navigate() dependings on the url (www.google.de works fine, a portal-url does not).
In that case the onQuit-StackTrace  looks like
2012-12-28 15:29:54,589 [Main message loop] INFO  IEAutomationSamplePeer - onQuit closed false
    at IEAutomationSamplePeer$2.onQuit(IEAutomationSamplePeer.java:58)
    at com.jniwrapper.win32.ie.BrowserEventsObserver.onQuit(Unknown Source)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at com.jniwrapper.win32.com.server.IDispatchServer.a(SourceFile:252)
    at com.jniwrapper.win32.com.server.IDispatchServer.invoke(SourceFile:209)
    at sun.reflect.GeneratedMethodAccessor1.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at com.jniwrapper.win32.com.server.CoInterfaceVTBL$VirtualMethodCallback.b(SourceFile:277)
    at com.jniwrapper.win32.com.server.CoInterfaceVTBL$VirtualMethodCallback.callback(SourceFile:168)
    at com.jniwrapper.Callback.enterPoint(SourceFile:223)
    at com.jniwrapper.Function.invokeCFunc(Native Method)
    at com.jniwrapper.FunctionCall.a(SourceFile:127)
    at com.jniwrapper.FunctionCall.call(SourceFile:35)
    at com.jniwrapper.Function.invoke(SourceFile:188)
    at com.jniwrapper.Function.invoke(SourceFile:212)
    at com.jniwrapper.win32.MessageLoopThread$LoopThread.run(MessageLoopThread.java:504)


After the unexpected quit the peer-Object is really disconnected (ComException COM object method returns error code: 0x80010108; RPC_E_DISCONNECTED occured).

He're is the example-Code:


import java.io.*;

import org.slf4j.*;

import com.jniwrapper.win32.automation.types.*;
import com.jniwrapper.win32.ie.*;
import com.jniwrapper.win32.ie.WebBrowser;
import com.jniwrapper.win32.ie.event.*;
import com.jniwrapper.win32.shdocvw.*;

/**
 * The sample demonstrates how to create IEAutomation instance that
 * represents a standard Internet Explorer application, register
 * listeners to it and work with this component.
 */
public class IEAutomationSamplePeer {

    private static final Logger logger = LoggerFactory.getLogger("IEAutomationSamplePeer");


    public static void main(String[] args) throws IOException {

        try {
            final IEAutomation automation = new IEAutomation();
            automation.addNavigationListener(new NavigationEventAdapter() {
                /**
                 * {@inheritDoc}
                 */
                @Override
                public void navigationCompleted(WebBrowser webbrowser, String s) {
                    logger.info("navigationCompleted       " + s);
                    logger.info("navigationCompleted state : " + ((IWebBrowser2) automation.getBrowserPeer()).getReadyState());
                }

                /**
                 * {@inheritDoc}
                 */
                @Override
                public void documentCompleted(WebBrowser webbrowser, String s) {
                    logger.info("documentCompleted       " + s);
                    logger.info("documentCompleted state : " + ((IWebBrowser2) automation.getBrowserPeer()).getReadyState());
                }

                public void entireDocumentCompleted(WebBrowser webBrowser, String url) {
                    logger.info("entireDocumentCompleted " + url);
                    logger.info("entireDocumentCompleted state : " + ((IWebBrowser2) automation.getBrowserPeer()).getReadyState());
                }
            });

            automation.addIEApplicationEventListener(new IEApplicationEventAdapter() {

                /**
                 * {@inheritDoc}
                 */
                @Override
                public void onQuit() {
                   
                    Exception ex = new Exception();
                    ex.printStackTrace();
                   
                    logger.info("onQuit closed " + automation.isClosed());
                }
            });

            automation.getOleMessageLoop().doInvokeLater(new Runnable() {
                @Override
                public void run() {
                    IWebBrowser2 browserPeer = (IWebBrowser2) automation.getBrowserPeer();
                    browserPeer.navigate(new BStr("http://portal:10010/wps/myportal"), Variant.createUnspecifiedParameter(), Variant.createUnspecifiedParameter(), Variant.createUnspecifiedParameter(), Variant.createUnspecifiedParameter());
//                    browserPeer.navigate(new BStr("www.google.de"), Variant.createUnspecifiedParameter(), Variant.createUnspecifiedParameter(), Variant.createUnspecifiedParameter(), Variant.createUnspecifiedParameter());
                   
                    logger.info("navigate state : " + browserPeer.getReadyState());
                    browserPeer.setVisible(VariantBool.TRUE);
                }
            });

            logger.info("sleep beginn....");
            Thread.sleep(5000);
            logger.info("sleep ende...");

            automation.getOleMessageLoop().doInvokeLater(new Runnable() {
                @Override
                public void run() {
                    IWebBrowser2 browserPeer = (IWebBrowser2) automation.getBrowserPeer();
                    browserPeer.quit();
                    browserPeer.release();
                    logger.info("quit/state/closed: " +  automation.isClosed());
                }
            });


        }  catch (Exception e) {
            e.printStackTrace();
        }
    }
}





Vladimir Ikryanov

unread,
Jan 2, 2013, 7:42:53 AM1/2/13
to Frank Schiller, JExplorer Forum
Hello Frank,

First of all please note that in order to dispose IEAutomation instance you need to use the IEAutomation.close() method instead of direct call of the IWebBrowser2.quit() method. For example:


import com.jniwrapper.win32.automation.types.BStr;
import com.jniwrapper.win32.automation.types.Variant;
import com.jniwrapper.win32.automation.types.VariantBool;
import com.jniwrapper.win32.ie.IEAutomation;
import com.jniwrapper.win32.ie.WebBrowser;
import com.jniwrapper.win32.ie.event.IEApplicationEventAdapter;
import com.jniwrapper.win32.ie.event.NavigationEventAdapter;
import com.jniwrapper.win32.shdocvw.IWebBrowser2;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.io.IOException;

/**
 * The sample demonstrates how to create IEAutomation instance that
 * represents a standard Internet Explorer application, register
 * listeners to it and work with this component.
 */
public class IEAutomationSamplePeer {

    private static final Logger logger = LoggerFactory.getLogger("IEAutomationSamplePeer");

    public static void main(String[] args) throws IOException {

        try {
            final IEAutomation automation = new IEAutomation();
            automation.addNavigationListener(new NavigationEventAdapter
() {
                
@Override
                public void navigationCompleted(WebBrowser webbrowser, String s) {
                    logger.info("navigationCompleted       " + s);
                    logger.info("navigationCompleted state : " + ((IWebBrowser2) automation.getBrowserPeer()).
getReadyState());
                }

                
@Override
                public void documentCompleted(WebBrowser webbrowser, String s) {
                    logger.info("documentCompleted       " + s);
                    logger.info("documentCompleted state : " + ((IWebBrowser2) automation.getBrowserPeer()).
getReadyState());
                }

                @Override
                public void entireDocumentCompleted(WebBrowser webBrowser, String url) {
                    logger.info("entireDocumentCompleted " + url);
                    logger.info("entireDocumentCompleted state : " + ((IWebBrowser2) automation.getBrowserPeer()).getReadyState());
                }
            });

            automation.addIEApplicationEventListener(new IEApplicationEventAdapter
() {
                
@Override
                public void onQuit() {
                    Exception ex = new Exception();
                    ex.printStackTrace();
                    logger.info("onQuit closed " + automation.isClosed());
                }
            });

            automation.getOleMessageLoop().doInvokeLater(new Runnable
() {
                
public void run() {
                    IWebBrowser2 browserPeer = (IWebBrowser2) automation.getBrowserPeer();
                    browserPeer.navigate(new BStr("http://portal:10010/wps/myportal"), Variant.createUnspecifiedParameter(), Variant.createUnspecifiedParameter(), Variant.createUnspecifiedParameter(), Variant.createUnspecifiedParameter());
//                    browserPeer.navigate(new BStr("www.google.de"), Variant.createUnspecifiedParameter(), Variant.createUnspecifiedParameter(), Variant.createUnspecifiedParameter(), Variant.createUnspecifiedParameter());

                    logger.info("navigate state : " + browserPeer.getReadyState());
                    browserPeer.setVisible(VariantBool.TRUE);
                }
            });

            logger.info("sleep beginn....");
            Thread.sleep(5000);
            logger.info("sleep ende..."
);

            automation.close();
            logger.info("quit/state/closed: " + automation.isClosed());

        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}

As for the different behavior with different web pages - it seems like the reason of this behavior is in 5 seconds delay. It looks like in case of http://portal:10010/wps/myportal web page, 5 seconds isn't enough to download web page.

I don't have access to this http://portal:10010/wps/myportal web page, so I cannot reproduce this exception. But could you please try to reproduce this issue with the updated sample above and the latest update of JExplorer that you can download from our ftp: ftp://ftp.teamdev.com/updates/jexplorer-2.6.142.zip

Sincerely,
Vladimir Ikryanov








--
You are receiving this email because you have joined the "JExplorer Forum" group or have been added by request. You may choose not to receive emails from this group or unsubscribe completely on "Edit my membership" page.
Go to http://links.teamdev.com/jexplorer-forum, choose "Edit my membership" link on the right. Specify your email preferences in suggested options, or click "Unsubscribe" button.
---
You received this message because you are subscribed to the Google Groups "JExplorer Forum" group.
To post to this group, send email to jexplor...@teamdev.com.
To unsubscribe from this group, send email to jexplorer-for...@teamdev.com.
Visit this group at http://groups.google.com/a/teamdev.com/group/jexplorer-forum/?hl=en.
For more options, visit https://groups.google.com/a/teamdev.com/groups/opt_out.
 
 

Frank Schiller

unread,
Jan 7, 2013, 4:53:35 AM1/7/13
to jexplor...@teamdev.com
Hi Vladimir,

С Новым Годом и Рождеством :-) .

1.) With JExplorer2.6.142  -  if  I change my Code from

            automation.getOleMessageLoop().doInvokeLater(new Runnable() {
                @Override
                public void run() {
                    IWebBrowser2 browserPeer = (IWebBrowser2) automation.getBrowserPeer();
                    logger.info("wait state/closed : " + browserPeer.getReadyState()+ "/" + automation.isClosed());

                    browserPeer.quit();
                    browserPeer.release();
                    logger.info("quit/state/closed: " +  automation.isClosed());
                }
            });

to

            automation.close();
            logger.info("quit/state/closed: " +  automation.isClosed());

and i'm getting the following Exception


java.lang.reflect.InvocationTargetException
    at com.jniwrapper.win32.MessageLoopThread$ThreadSynchronizedAction.rethrowExceptionIfSaved(MessageLoopThread.java:644)
    at com.jniwrapper.win32.MessageLoopThread.doInvokeAndWait(MessageLoopThread.java:273)
    at com.jniwrapper.win32.ie.bz.close(Unknown Source)
    at com.jniwrapper.win32.ie.IEAutomation.close(Unknown Source)
    at IEAutomationSamplePeer2.main(IEAutomationSamplePeer2.java:75)
Caused by: com.jniwrapper.win32.com.ComException: COM object method returns error code: 0x80004005; E_FAIL (Unbekannter Fehler)
    at com.jniwrapper.win32.com.impl.IUnknownImpl.invokeStandardVirtualMethod(SourceFile:758)
    at com.jniwrapper.win32.com.impl.IUnknownImpl.invokeStandardVirtualMethod(SourceFile:737)
    at com.jniwrapper.win32.shdocvw.impl.IWebBrowserAppImpl.getHWND(Unknown Source)
    at com.jniwrapper.win32.ie.br.run(Unknown Source)
    at com.jniwrapper.win32.MessageLoopThread$ThreadSynchronizedAction.run(MessageLoopThread.java:620)
    at com.jniwrapper.win32.MessageLoopThread$LoopThread.run(MessageLoopThread.java:562)
2013-01-07 10:33:46,062 [main] INFO  IEAutomationSamplePeer2 - quit/state/closed: true



The automation.isClosed() returns 'true' after that - but I'm afraid that not all objects are disposed correctly.

Sincerely
Frank
 


Vladimir Ikryanov

unread,
Jan 8, 2013, 8:04:36 AM1/8/13
to Frank Schiller, JExplorer Forum
Hi Frank,

Thank you.

This exception indicates an issue in our IEAutomation functionality. Thank you for letting me know about this. I have implemented a fix and uploaded updated build of JExplorer on our ftp: ftp://ftp.teamdev.com/updates/jexplorer-2.6.143.zip

Could you please try this updated build and let me know the results.

Sincerely,
Vladimir Ikryanov


Frank Schiller

unread,
Jan 10, 2013, 5:33:11 AM1/10/13
to jexplor...@teamdev.com, Frank Schiller

Hi Vladimir,

thanks for your fast reply - with JExplorer 2.6.143 the automation.close() works without any Exceptions.
The most important issue  (unexpected quit on Win 7 ) still exists (btw this works fine under Windows 2008 Server... :-) ). 
Here's the Console-Log from the sample code under Win 7 with JExplorer 2.6.143 - onQuit occured and then the COM-Object is diconnected and  automation.close() fails.


2013-01-10 10:55:45,641 [Main message loop] DEBUG com.jniwrapper.win32.MessageLoopThread - MessageLoopThread.run()
2013-01-10 10:55:45,641 [Main message loop] DEBUG com.jniwrapper.win32.MessageLoopThread - MessageLoopThread.run(): got threadID = 2056
2013-01-10 10:55:45,766 [Main message loop] DEBUG com.jniwrapper.win32.MessageLoopThread - MessageLoopThread.run(), messageQueueIsReady
2013-01-10 10:55:45,906 [Main message loop] DEBUG com.jniwrapper.win32.com.server.IClassFactoryServer - IClassFactoryServer.<init>, Instance class: class com.jniwrapper.win32.ie.BrowserEventsObserver
2013-01-10 10:55:45,937 [Main message loop] DEBUG com.jniwrapper.win32.com.server.IDispatchServer - Public property: com.jniwrapper.win32.ie.BrowserEventsObserver#b is not acceptable for Automation, skipping it.
2013-01-10 10:55:45,937 [Main message loop] DEBUG com.jniwrapper.win32.com.server.IDispatchServer - Public property: com.jniwrapper.win32.ie.BrowserEventsObserver#c is not acceptable for Automation, skipping it.
2013-01-10 10:55:45,937 [Main message loop] DEBUG com.jniwrapper.win32.com.server.IDispatchServer - Public property: com.jniwrapper.win32.ie.BrowserEventsObserver#d is not acceptable for Automation, skipping it.
2013-01-10 10:55:45,937 [Main message loop] DEBUG com.jniwrapper.win32.com.server.IDispatchServer - Public property: com.jniwrapper.win32.ie.BrowserEventsObserver#f is not acceptable for Automation, skipping it.
2013-01-10 10:55:45,937 [Main message loop] DEBUG com.jniwrapper.win32.com.server.IDispatchServer - Public property: com.jniwrapper.win32.ie.BrowserEventsObserver#g is not acceptable for Automation, skipping it.
2013-01-10 10:55:45,937 [Main message loop] DEBUG com.jniwrapper.win32.com.server.IDispatchServer - Public property: com.jniwrapper.win32.ie.BrowserEventsObserver#j is not acceptable for Automation, skipping it.
2013-01-10 10:55:45,937 [Main message loop] DEBUG com.jniwrapper.win32.com.server.IDispatchServer - Public property: com.jniwrapper.win32.ie.BrowserEventsObserver#k is not acceptable for Automation, skipping it.
2013-01-10 10:55:45,937 [Main message loop] DEBUG com.jniwrapper.win32.com.server.IDispatchServer - Public property: com.jniwrapper.win32.ie.BrowserEventsObserver#l is not acceptable for Automation, skipping it.
2013-01-10 10:55:45,937 [Main message loop] DEBUG com.jniwrapper.win32.com.server.IDispatchServer - Public property: com.jniwrapper.win32.ie.BrowserEventsObserver#m is not acceptable for Automation, skipping it.
2013-01-10 10:55:45,937 [Main message loop] DEBUG com.jniwrapper.win32.com.server.IDispatchServer - Public property: com.jniwrapper.win32.ie.BrowserEventsObserver#n is not acceptable for Automation, skipping it.
2013-01-10 10:55:45,937 [Main message loop] DEBUG com.jniwrapper.win32.com.server.IDispatchServer - Public property: com.jniwrapper.win32.ie.BrowserEventsObserver#p is not acceptable for Automation, skipping it.
2013-01-10 10:55:45,937 [Main message loop] DEBUG com.jniwrapper.win32.com.server.IDispatchServer - Public property: com.jniwrapper.win32.ie.BrowserEventsObserver#q is not acceptable for Automation, skipping it.
2013-01-10 10:55:45,937 [Main message loop] DEBUG com.jniwrapper.win32.com.server.IDispatchServer - Public property: com.jniwrapper.win32.ie.BrowserEventsObserver#s is not acceptable for Automation, skipping it.
2013-01-10 10:55:45,937 [Main message loop] DEBUG com.jniwrapper.win32.com.server.IDispatchServer - Public property: com.jniwrapper.win32.ie.BrowserEventsObserver#u is not acceptable for Automation, skipping it.
2013-01-10 10:55:45,937 [Main message loop] DEBUG com.jniwrapper.win32.com.server.IDispatchServer - Public property: com.jniwrapper.win32.ie.BrowserEventsObserver#v is not acceptable for Automation, skipping it.
2013-01-10 10:55:45,937 [Main message loop] DEBUG com.jniwrapper.win32.com.server.IDispatchServer - PARAMS_downloadBegin was not found
2013-01-10 10:55:45,937 [Main message loop] DEBUG com.jniwrapper.win32.com.server.IDispatchServer - PARAMS_onMenuBar was not found
2013-01-10 10:55:45,937 [Main message loop] DEBUG com.jniwrapper.win32.com.server.IDispatchServer - PARAMS_onQuit was not found
2013-01-10 10:55:45,937 [Main message loop] DEBUG com.jniwrapper.win32.com.server.IDispatchServer - PARAMS_onStatusBar was not found
2013-01-10 10:55:45,937 [Main message loop] DEBUG com.jniwrapper.win32.com.server.IDispatchServer - PARAMS_onToolBar was not found
2013-01-10 10:55:45,937 [Main message loop] DEBUG com.jniwrapper.win32.com.server.IDispatchServer - PARAMS_onVisible was not found
2013-01-10 10:55:45,937 [Main message loop] DEBUG com.jniwrapper.win32.com.server.IDispatchServer - PARAMS_propertyChange was not found
2013-01-10 10:55:45,937 [Main message loop] DEBUG com.jniwrapper.win32.com.server.IDispatchServer - PARAMS_beforeNavigate2 was not found
2013-01-10 10:55:45,937 [Main message loop] DEBUG com.jniwrapper.win32.com.server.IDispatchServer - PARAMS_clientToHostWindow was not found
2013-01-10 10:55:45,937 [Main message loop] DEBUG com.jniwrapper.win32.com.server.IDispatchServer - PARAMS_commandStateChange was not found
2013-01-10 10:55:45,937 [Main message loop] DEBUG com.jniwrapper.win32.com.server.IDispatchServer - PARAMS_documentComplete was not found
2013-01-10 10:55:45,937 [Main message loop] DEBUG com.jniwrapper.win32.com.server.IDispatchServer - PARAMS_downloadComplete was not found
2013-01-10 10:55:45,937 [Main message loop] DEBUG com.jniwrapper.win32.com.server.IDispatchServer - PARAMS_fileDownload was not found
2013-01-10 10:55:45,937 [Main message loop] DEBUG com.jniwrapper.win32.com.server.IDispatchServer - PARAMS_navigateComplete2 was not found
2013-01-10 10:55:45,937 [Main message loop] DEBUG com.jniwrapper.win32.com.server.IDispatchServer - PARAMS_navigateError was not found
2013-01-10 10:55:45,937 [Main message loop] DEBUG com.jniwrapper.win32.com.server.IDispatchServer - PARAMS_newWindow2 was not found
2013-01-10 10:55:45,937 [Main message loop] DEBUG com.jniwrapper.win32.com.server.IDispatchServer - PARAMS_newWindow3 was not found
2013-01-10 10:55:45,937 [Main message loop] DEBUG com.jniwrapper.win32.com.server.IDispatchServer - PARAMS_onFullScreen was not found
2013-01-10 10:55:45,937 [Main message loop] DEBUG com.jniwrapper.win32.com.server.IDispatchServer - PARAMS_onTheaterMode was not found
2013-01-10 10:55:45,937 [Main message loop] DEBUG com.jniwrapper.win32.com.server.IDispatchServer - PARAMS_printTemplateInstantiation was not found
2013-01-10 10:55:45,937 [Main message loop] DEBUG com.jniwrapper.win32.com.server.IDispatchServer - PARAMS_printTemplateTeardown was not found
2013-01-10 10:55:45,937 [Main message loop] DEBUG com.jniwrapper.win32.com.server.IDispatchServer - PARAMS_privacyImpactedStateChange was not found
2013-01-10 10:55:45,937 [Main message loop] DEBUG com.jniwrapper.win32.com.server.IDispatchServer - PARAMS_progressChange was not found
2013-01-10 10:55:45,937 [Main message loop] DEBUG com.jniwrapper.win32.com.server.IDispatchServer - PARAMS_setSecureLockIcon was not found
2013-01-10 10:55:45,937 [Main message loop] DEBUG com.jniwrapper.win32.com.server.IDispatchServer - PARAMS_statusTextChange was not found
2013-01-10 10:55:45,937 [Main message loop] DEBUG com.jniwrapper.win32.com.server.IDispatchServer - PARAMS_titleChange was not found
2013-01-10 10:55:45,937 [Main message loop] DEBUG com.jniwrapper.win32.com.server.IDispatchServer - PARAMS_updatePageStatus was not found
2013-01-10 10:55:45,937 [Main message loop] DEBUG com.jniwrapper.win32.com.server.IDispatchServer - PARAMS_windowClosing was not found
2013-01-10 10:55:45,937 [Main message loop] DEBUG com.jniwrapper.win32.com.server.IDispatchServer - PARAMS_windowSetHeight was not found
2013-01-10 10:55:45,937 [Main message loop] DEBUG com.jniwrapper.win32.com.server.IDispatchServer - PARAMS_windowSetLeft was not found
2013-01-10 10:55:45,937 [Main message loop] DEBUG com.jniwrapper.win32.com.server.IDispatchServer - PARAMS_windowSetResizable was not found
2013-01-10 10:55:45,937 [Main message loop] DEBUG com.jniwrapper.win32.com.server.IDispatchServer - PARAMS_windowSetTop was not found
2013-01-10 10:55:45,937 [Main message loop] DEBUG com.jniwrapper.win32.com.server.IDispatchServer - PARAMS_windowSetWidth was not found
2013-01-10 10:55:45,953 [Main message loop] DEBUG com.jniwrapper.win32.com.server.CoInterfaceVTBL - Failed to invoke method: queryInterfaceAggregated; cause: COM object method returns error code: 0x80004002; E_NOINTERFACE (Schnittstelle nicht unterstützt)
2013-01-10 10:55:45,953 [Main message loop] DEBUG com.jniwrapper.win32.com.server.CoInterfaceVTBL - Failed to invoke method: queryInterfaceAggregated; cause: COM object method returns error code: 0x80004002; E_NOINTERFACE (Schnittstelle nicht unterstützt)
2013-01-10 10:55:45,953 [Main message loop] DEBUG com.jniwrapper.win32.com.server.CoInterfaceVTBL - Failed to invoke method: queryInterfaceAggregated; cause: COM object method returns error code: 0x80004002; E_NOINTERFACE (Schnittstelle nicht unterstützt)
2013-01-10 10:55:45,953 [Main message loop] DEBUG com.jniwrapper.win32.com.server.CoInterfaceVTBL - Failed to invoke method: queryInterface; cause: COM object method returns error code: 0x80004002; E_NOINTERFACE (Schnittstelle nicht unterstützt)
2013-01-10 10:55:45,953 [Main message loop] DEBUG com.jniwrapper.win32.com.server.CoInterfaceVTBL - Failed to invoke method: queryInterface; cause: COM object method returns error code: 0x80004002; E_NOINTERFACE (Schnittstelle nicht unterstützt)
2013-01-10 10:55:45,953 [Main message loop] DEBUG com.jniwrapper.win32.com.server.CoInterfaceVTBL - Failed to invoke method: queryInterface; cause: COM object method returns error code: 0x80004002; E_NOINTERFACE (Schnittstelle nicht unterstützt)
2013-01-10 10:55:46,031 [Main message loop] DEBUG com.jniwrapper.win32.com.server.CoInterfaceVTBL - Failed to invoke method: queryInterfaceAggregated; cause: COM object method returns error code: 0x80004002; E_NOINTERFACE (Schnittstelle nicht unterstützt)
2013-01-10 10:55:46,062 [Main message loop] DEBUG com.jniwrapper.win32.com.server.IDispatchServer - Could not find a method for DispID: 282, so returning DISP_E_BADINDEX
2013-01-10 10:55:46,062 [Main message loop] DEBUG com.jniwrapper.win32.com.server.CoInterfaceVTBL - Failed to invoke method: invoke; cause: COM object method returns error code: 0x8002000B; DISP_E_BADINDEX (Ungültiger Index.)
2013-01-10 10:55:46,062 [Main message loop] DEBUG com.jniwrapper.win32.com.server.IDispatchServer - Could not find a method for DispID: 282, so returning DISP_E_BADINDEX
2013-01-10 10:55:46,062 [Main message loop] DEBUG com.jniwrapper.win32.com.server.CoInterfaceVTBL - Failed to invoke method: invoke; cause: COM object method returns error code: 0x8002000B; DISP_E_BADINDEX (Ungültiger Index.)
2013-01-10 10:55:46,062 [Main message loop] DEBUG com.jniwrapper.win32.com.server.IDispatchServer - Could not find a method for DispID: 283, so returning DISP_E_BADINDEX
2013-01-10 10:55:46,062 [Main message loop] DEBUG com.jniwrapper.win32.com.server.CoInterfaceVTBL - Failed to invoke method: invoke; cause: COM object method returns error code: 0x8002000B; DISP_E_BADINDEX (Ungültiger Index.)
2013-01-10 10:55:46,078 [Main message loop] DEBUG com.jniwrapper.win32.com.server.IDispatchServer - Could not find a method for DispID: 282, so returning DISP_E_BADINDEX
2013-01-10 10:55:46,078 [Main message loop] DEBUG com.jniwrapper.win32.com.server.CoInterfaceVTBL - Failed to invoke method: invoke; cause: COM object method returns error code: 0x8002000B; DISP_E_BADINDEX (Ungültiger Index.)
2013-01-10 10:55:46,171 [main] INFO  IEAutomationSamplePeer2 - sleep beginn....
2013-01-10 10:55:46,171 [Main message loop] DEBUG com.jniwrapper.win32.com.server.IDispatchServer - Could not find a method for DispID: 284, so returning DISP_E_BADINDEX
2013-01-10 10:55:46,171 [Main message loop] DEBUG com.jniwrapper.win32.com.server.CoInterfaceVTBL - Failed to invoke method: invoke; cause: COM object method returns error code: 0x8002000B; DISP_E_BADINDEX (Ungültiger Index.)
2013-01-10 10:55:46,235 [Main message loop] INFO  IEAutomationSamplePeer2 - navigate state : 4
2013-01-10 10:55:46,235 [Main message loop] DEBUG com.jniwrapper.win32.com.server.IDispatchServer - Could not find a method for DispID: 283, so returning DISP_E_BADINDEX
2013-01-10 10:55:46,235 [Main message loop] DEBUG com.jniwrapper.win32.com.server.CoInterfaceVTBL - Failed to invoke method: invoke; cause: COM object method returns error code: 0x8002000B; DISP_E_BADINDEX (Ungültiger Index.)
2013-01-10 10:55:46,282 [Main message loop] INFO  IEAutomationSamplePeer2 - onQuit closed false
2013-01-10 10:55:46,313 [Main message loop] DEBUG com.jniwrapper.win32.com.server.IDispatchServer - Could not find a method for DispID: 283, so returning DISP_E_BADINDEX
2013-01-10 10:55:46,313 [Main message loop] DEBUG com.jniwrapper.win32.com.server.CoInterfaceVTBL - Failed to invoke method: invoke; cause: COM object method returns error code: 0x8002000B; DISP_E_BADINDEX (Ungültiger Index.)
2013-01-10 10:55:51,182 [main] INFO  IEAutomationSamplePeer2 - sleep ende...
com.jniwrapper.win32.com.ComException: com.jniwrapper.win32.com.ComException: COM object method returns error code: 0x80010108; RPC_E_DISCONNECTED (Das aufgerufene Objekt wurde von den Clients getrennt.)
    at com.jniwrapper.win32.com.ComException.createComException(SourceFile:189)
    at com.jniwrapper.win32.ah.invoke(SourceFile:265)
    at $Proxy0.getBusy(Unknown Source)
    at com.jniwrapper.win32.ie.by.close(Unknown Source)

    at com.jniwrapper.win32.ie.IEAutomation.close(Unknown Source)
    at IEAutomationSamplePeer2.main(IEAutomationSamplePeer2.java:75)
2013-01-10 10:55:51,182 [Main message loop] DEBUG com.jniwrapper.win32.MessageLoopThread -
java.lang.reflect.InvocationTargetException

    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at com.jniwrapper.win32.ce.run(SourceFile:247)

    at com.jniwrapper.win32.MessageLoopThread$ThreadSynchronizedAction.run(MessageLoopThread.java:620)
    at com.jniwrapper.win32.MessageLoopThread$LoopThread.run(MessageLoopThread.java:562)
Caused by: com.jniwrapper.win32.com.ComException: COM object method returns error code: 0x80010108; RPC_E_DISCONNECTED (Das aufgerufene Objekt wurde von den Clients getrennt.)

    at com.jniwrapper.win32.com.impl.IUnknownImpl.invokeStandardVirtualMethod(SourceFile:758)
    at com.jniwrapper.win32.com.impl.IUnknownImpl.invokeStandardVirtualMethod(SourceFile:737)
    at com.jniwrapper.win32.shdocvw.impl.IWebBrowserImpl.getBusy(Unknown Source)
    ... 7 more
2013-01-10 10:55:51,182 [JNIWrapper.ShutdownHook] DEBUG com.jniwrapper.win32.MessageLoopThread - Terminated thread Main message loop
2013-01-10 10:55:51,182 [JNIWrapper.ShutdownHook] DEBUG com.jniwrapper.win32.automation.types.BStr - Skip releasing of BSTR: 6665116 in JNIWrapper.ShutdownHook thread.
Caused by: com.jniwrapper.win32.com.ComException: COM object method returns error code: 0x80010108; RPC_E_DISCONNECTED (Das aufgerufene Objekt wurde von den Clients getrennt.)

    at com.jniwrapper.win32.com.impl.IUnknownImpl.invokeStandardVirtualMethod(SourceFile:758)
    at com.jniwrapper.win32.com.impl.IUnknownImpl.invokeStandardVirtualMethod(SourceFile:737)
    at com.jniwrapper.win32.shdocvw.impl.IWebBrowserImpl.getBusy(Unknown Source)

    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at com.jniwrapper.win32.ce.run(SourceFile:247)

    at com.jniwrapper.win32.MessageLoopThread$ThreadSynchronizedAction.run(MessageLoopThread.java:620)
    at com.jniwrapper.win32.MessageLoopThread$LoopThread.run(MessageLoopThread.java:562)


------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

JExplorer Forum

unread,
Jan 10, 2013, 9:36:44 AM1/10/13
to JExplorer Forum


---------- Forwarded message ----------
From: JExplorer Forum <jexplor...@teamdev.com>
Date: Thu, Jan 10, 2013 at 4:10 PM
Subject: Re: Unexpected quit / disconnect in Win7
To: Frank Schiller <fsc...@googlemail.com>
Cc: JExplorer Forum <jexplor...@teamdev.com>


Hello Frank,

I tried to reproduce this issue with the sample I sent you, but in my environment (Windows 7 64-bit, JDK 1.5 32-bit) I cannot reproduce this issue. According to your log messages you invoke the close() method after the onQuit() event which is strange. In example I sent, you should receive the following messages:


...
sleep beginn....
navigate state : 1
...
sleep ende...
onQuit closed false
java.lang.Exception
    at IEAutomationSamplePeer$2.onQuit(IEAutomationSamplePeer.java:56)
    at com.jniwrapper.win32.ie.BrowserEventsObserver.onQuit(BrowserEventsObserver.java:593)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:592)
    at com.jniwrapper.win32.com.server.IDispatchServer.a(SourceFile:349)
    at com.jniwrapper.win32.com.server.IDispatchServer.invoke(SourceFile:290)
    at sun.reflect.GeneratedMethodAccessor1.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:592)
    at com.jniwrapper.win32.com.server.CoInterfaceVTBL$VirtualMethodCallback.b(SourceFile:292)
    at com.jniwrapper.win32.com.server.CoInterfaceVTBL$VirtualMethodCallback.callback(SourceFile:179)
    at com.jniwrapper.Callback.enterPoint(SourceFile:232)
    at com.jniwrapper.Function.invokeCFunc(Native Method)
    at com.jniwrapper.FunctionCall.a(SourceFile:127)
    at com.jniwrapper.FunctionCall.call(SourceFile:35)
    at com.jniwrapper.Function.invoke(SourceFile:188)
    at com.jniwrapper.Function.invoke(SourceFile:212)
    at com.jniwrapper.win32.MessageLoopThread$LoopThread.run(MessageLoopThread.java:540)
Wait Internet Explorer process exit...
quit/state/closed: true
Terminated thread Main message loop
Skip releasing of BSTR: 5786916 in JNIWrapper.ShutdownHook thread.

Could you please send me your example that you use to reproduce this issue. Also please let me know if you can reproduce this issue with simple web page such as www.google.com.


Frank Schiller

unread,
Jan 10, 2013, 11:18:59 AM1/10/13
to jexplor...@teamdev.com, jexplor...@teamdev.com
Hi Vladimir,

the rest of my sample code remains unchanged (except the navigation-url).
Today I recognized that the problem always occures if we're trying to navigate to an IBM Websphere Portal-site (intranet). the navigation works fine to all internet-sites. Btw., we're using  ORACLE-jre1.6.0.30 (32 bit) and IE 8 on WinXp, Win2008-Server and Win 7 - and only on Win 7 the problem occures....


Sincerely
Frank





import java.io.*;

import org.slf4j.*;

import com.jniwrapper.win32.automation.types.*;
import com.jniwrapper.win32.ie.*;
import com.jniwrapper.win32.ie.WebBrowser;
import com.jniwrapper.win32.ie.event.*;
import com.jniwrapper.win32.shdocvw.*;

/**
 * The sample demonstrates how to create IEAutomation instance that
 * represents a standard Internet Explorer application, register
 * listeners to it and work with this component.
 */
public class IEAutomationSamplePeer2 {

    private static final Logger logger = LoggerFactory.getLogger("IEAutomationSamplePeer2");
                    logger.info("onQuit closed " + automation.isClosed());
                }
            });

            automation.getOleMessageLoop().doInvokeLater(new Runnable() {
                @Override
                public void run() {
                    IWebBrowser2 browserPeer = (IWebBrowser2) automation.getBrowserPeer();
                    browserPeer.navigate(new BStr("www.google.de"), Variant.createUnspecifiedParameter(), Variant.createUnspecifiedParameter(), Variant.createUnspecifiedParameter(), Variant.createUnspecifiedParameter());
                    logger.info("navigate state : " + browserPeer.getReadyState());
                    browserPeer.setVisible(VariantBool.TRUE);
                }
            });

            logger.info("sleep beginn....");
            Thread.sleep(5000);
            logger.info("sleep ende...");
            automation.close();
            logger.info("quit/state/closed: " +  automation.isClosed());
           



        }  catch (Exception e) {
            e.printStackTrace();

JExplorer Forum

unread,
Jan 11, 2013, 11:23:56 AM1/11/13
to Frank Schiller, JExplorer Forum
Hello Frank,

On Windows 7 with JDK 1.6.0_38 32-bit I receive the following output in console when I run your IEAutomationSamplePeer2 sample:


sleep beginn....
navigate state : 1
navigationCompleted       http://www.google.de/
navigationCompleted state : 1
navigationCompleted       about:blank
navigationCompleted state : 3
documentCompleted       about:blank
documentCompleted state : 3
documentCompleted       http://www.google.de/
documentCompleted state : 4
entireDocumentCompleted http://www.google.de/
entireDocumentCompleted state : 4
sleep ende...
onQuit closed false
Wait Internet Explorer process exit...
quit/state/closed: true

It seems like the reason is in web page you download. Could you please make sure that there's no JavaScript that tries to close web page. According to your log messages, IEAutomation instance is already closed when you invoke the automation.close() method.

Frank Schiller

unread,
Jan 14, 2013, 10:36:01 AM1/14/13
to jexplor...@teamdev.com, Frank Schiller, jexplor...@teamdev.com
Hi Vladimir,


could you analyze the following  stack trace (I inserted a StackTrace in the onQuit-Method - see below).


                /**
                 * {@inheritDoc}
                 */
                @Override
                public void onQuit() {
                    Exception e = new Exception();
                    e.printStackTrace();

                   
                    logger.info("onQuit closed " + automation.isClosed());
                }
            });

--------------------------------------------------------------------------------------------------------------------------------------------------------------------------

I hope that it's possible for you to figure out the reason of the onQuit-Event  (Web-Site, JNI-Problem, .... )....
The  stack-Trace (on Win7) is:

2013-01-14 16:22:22,410 [Main message loop] INFO  IEAutomationSamplePeer2 - onQuit closed false
    at IEAutomationSamplePeer2$2.onQuit(IEAutomationSamplePeer2.java:57)
    at com.jniwrapper.win32.ie.BrowserEventsObserver.onQuit(Unknown Source)

    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at com.jniwrapper.win32.com.server.IDispatchServer.a(SourceFile:349)
    at com.jniwrapper.win32.com.server.IDispatchServer.invoke(SourceFile:290)
    at sun.reflect.GeneratedMethodAccessor1.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)

JExplorer Forum

unread,
Jan 14, 2013, 1:04:27 PM1/14/13
to Frank Schiller, JExplorer Forum
Hi Frank,

This stack trace just indicates that native MS IE engine fires the onQuit event. Unfortunately using only this stack trace I cannot say what causes this quit. If you don't invoke the IEAutomation.close() method in your code, then it seems like JavaScript on a loaded web page causes Browser instance to close. With the sample you sent me I cannot reproduce this issue and without steps to reproduce it's really hard to say what causes this behavior. Please try to create example that reproduces this issue and send it to me. It will help in resolving of this issue.
Message has been deleted

JExplorer Forum

unread,
Jan 22, 2013, 4:09:52 AM1/22/13
to Frank Schiller, JExplorer Forum
Hi Frank,

I have created TestHtServer application according to your sample code and run it using JDK 1.6.0_38 32-bit. Then I navigated IEAutomationSample to the http://127.0.0.1:8000/test URL and this is what I get in console:


JAVA_VERSION = 6
...
sleep beginn....
navigate state : 1
navigationCompleted       http://127.0.0.1:8000/test
navigationCompleted state : 1
documentCompleted       http://127.0.0.1:8000/test
documentCompleted state : 4
entireDocumentCompleted http://127.0.0.1:8000/test
entireDocumentCompleted state : 4
sleep ende...
onQuit closed false
Wait Internet Explorer process exit...
quit/state/closed: true

As you may see I don't receive any unexpected exceptions. The screen shot of opened MS Internet Explorer window is the following:

Inline image 1

I'm using JExplorer 2.6.143 build: ftp://ftp.teamdev.com/updates/jexplorer-2.6.143.zip

It seems like the reason of this behavior is in environment, but it's not clear what can cause this unexpected quit of MS Internet Explorer in your Windows 7 environment. I have tested this sample in Windows 7 64-bit + MS IE8 environment too, but it works as expected.

On Tue, Jan 22, 2013 at 9:38 AM, Frank Schiller <fsc...@googlemail.com> wrote:
Hi Vladimir,

you can reproduce this issue by publishing a local website (code sample below).   After starting TestHtServer you only have to change the navigation-url in the IEAutomationSamplePeer2 to http://127.0.0.1:8000/test
I used ORACLE-jre1.6.0_30-i586 on Win 7 (64 bit) and JExplorer-2.6.143  for this....



import java.io.*;
import java.net.*;

import com.sun.net.httpserver.*;

public class TestHtServer {

    public static void main(String[] args) throws Exception {
        HttpServer server = HttpServer.create(new InetSocketAddress(8000), 0);
        server.createContext("/test", new MyHandler());
        server.setExecutor(null); // creates a default executor
        server.start();
       
       
    }

    static class MyHandler implements HttpHandler {
        public void handle(HttpExchange t) throws IOException {
            String response = "Hi!";
            t.sendResponseHeaders(200, response.length());
            OutputStream os = t.getResponseBody();
            os.write(response.getBytes());
            os.close();
        }
    }

}


#####################################################################################################################
image.png
Reply all
Reply to author
Forward
0 new messages