We recently upgraded to open office 4.1.1
version(Apache_OpenOffice_incubating_4.1.1_Win_x86_install_en-US.exe).We
installed it and and connect to open office 4.1.1 with UNO Java API.
We used to start the open office from commnad prompt by issue the below
command. We kill and start the open office service by process id if our
application found issues with open office processing(hung, failed to
connect).

Command :C:\Program Files (x86)\OpenOffice 4\program\soffice -invisible
-"accept=socket,host=0,port=8100;urp"&

We tried to start the multiple open office services by providing multiple
port numbers such as below
C:\Program Files (x86)\OpenOffice 4\program\soffice -invisible
-"accept=socket,host=0,port=8100;urp" &
C:\Program Files (x86)\OpenOffice 4\program\soffice -invisible
-"accept=socket,host=0,port=8600;urp" &

Both the ports are listening on their respective ports but surprisingly the
process associated to them is one.When there is failure with respective any
one of the service, killing and starting the open services stops all
ports.But we wanted at least one service should available to serve the
requests, any solution/suggestions/alternatives to have such kind of
multiple services.

Is there a specific restriction to have singleton for the remote context of
XComponentContext type?
We use the below code snippet to create and get the service manager
instance.

Code Snippet:
--------------------
XComponentContext xRemoteContext =null;
      if (xRemoteContext ==null  ) {


         XComponentContext xLocalContext =
com.sun.star.comp.helper.Bootstrap
               .createInitialComponentContext(null);
         XMultiComponentFactory xLocalServiceManager = xLocalContext
               .getServiceManager();
         Object urlResolver = xLocalServiceManager
               .createInstanceWithContext(
                     "com.sun.star.bridge.UnoUrlResolver", xLocalContext);

         XUnoUrlResolver xUnoUrlResolver = (XUnoUrlResolver) UnoRuntime
               .queryInterface(XUnoUrlResolver.class, urlResolver);


         Object initialObject = xUnoUrlResolver.resolve(unoUrl);
         XPropertySet xPropertySet = (XPropertySet) UnoRuntime
               .queryInterface(XPropertySet.class, initialObject);
         Object context = xPropertySet.getPropertyValue("DefaultContext");

            xRemoteContext=(XComponentContext) UnoRuntime.queryInterface(
               XComponentContext.class, context));


      }

      return xRemoteContext.get("8100").getServiceManager();
}
-- 

Thanks & Regards,
VijayChandra

Reply via email to