public static XMultiServiceFactory connect(String connectStr) throws com.sun.star.uno.Exception, com.sun.star.uno.RuntimeException, Exception {
XComponentContext xcomponentcontext = null;
XMultiComponentFactory xMultiComponentFactory = getMultiComponentFactory();
// create a connector, so that it can contact the office
Object xUrlResolver = xMultiComponentFactory.createInstanceWithContext("com.sun.star.bridge.UnoUrlResolver", xcomponentcontext);
XUnoUrlResolver urlResolver = (XUnoUrlResolver) UnoRuntime.queryInterface(XUnoUrlResolver.class, xUrlResolver);
Object rInitialObject = urlResolver.resolve(connectStr);
XNamingService rName = (XNamingService) UnoRuntime.queryInterface(XNamingService.class, rInitialObject);
XMultiServiceFactory xMSF = null;
if (rName != null) {