Rony G. Flatscher wrote:
Hi there,

just an additional data point: the same Java exception ("object is not instance of declaring class") occurs on OOo 1.9.113 as well. [The object to inspect is a Java proxy representing a spreadsheet document returned by "loadComponentFromURL("private:factory/scalc", "_blank", ...)".]

---rony

The following Java program works just fine for me:

import com.sun.star.beans.PropertyValue;
import com.sun.star.beans.XIntrospection;
import com.sun.star.beans.XIntrospectionAccess;
import com.sun.star.beans.XPropertySet;
import com.sun.star.bridge.UnoUrlResolver;
import com.sun.star.comp.helper.Bootstrap;
import com.sun.star.frame.FrameSearchFlag;
import com.sun.star.frame.XComponentLoader;
import com.sun.star.lang.XMultiComponentFactory;
import com.sun.star.uno.UnoRuntime;
import com.sun.star.uno.XComponentContext;
public final class Introspect {
    public static void main(String[] arguments) throws Exception {
        XMultiComponentFactory factory = (XMultiComponentFactory)
            UnoRuntime.queryInterface(
                XMultiComponentFactory.class,
                (UnoUrlResolver.create(
                    Bootstrap.createInitialComponentContext(null)).
                 resolve(
                     "uno:socket,host=127.0.0.1,port=12345;urp;"
                     + "StarOffice.ServiceManager")));
        XComponentContext context = (XComponentContext)
            UnoRuntime.queryInterface(
                XComponentContext.class,
                (((XPropertySet) UnoRuntime.queryInterface(
                      XPropertySet.class, factory)).
                 getPropertyValue("DefaultContext")));
        XIntrospectionAccess access =
            ((XIntrospection) UnoRuntime.queryInterface(
                XIntrospection.class,
                factory.createInstanceWithContext(
                    "com.sun.star.beans.Introspection", context))).
            inspect(
                (((XComponentLoader) UnoRuntime.queryInterface(
                      XComponentLoader.class,
                      factory.createInstanceWithContext(
                          "com.sun.star.frame.Desktop", context))).
                 loadComponentFromURL(
                     "private:factory/scalc", "_blank",
                     FrameSearchFlag.CREATE, new PropertyValue[0])));
        System.exit(0);
    }
    private Introspect() {}
}

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to