You are viewing a plain text version of this content. The canonical link for it is here.
Posted to api@openoffice.apache.org by vijay chandra <jv...@gmail.com> on 2015/03/04 13:53:52 UTC

Multiple open office services are associated to same PID(OS)

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

Re: Multiple open office services are associated to same PID(OS)

Posted by Jürgen Schmidt <jo...@gmail.com>.
Hi,

I would suggest to use only one connection per office process and use
several instances with their own user profile.

Maybe put your own dispatcher in front of your own stuff and dispatch
the incoming API calls to one of the managed office processes.

It make also sense to observe the office processes and kill or start
them on demand. It can make also sense to add a further office node if
the load of API calls increase.

But this kind of server logic is not yet available and you have to do it
on your own. Existing solutions like the PDF conversion server from
Oracle was not open sourced.

Juergen

On 04/03/15 13:53, vijay chandra wrote:
> 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();
> }
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: api-unsubscribe@openoffice.apache.org
For additional commands, e-mail: api-help@openoffice.apache.org