Error creating resolver with createInstanceWithContext

Java, C++, C#, Delphi, ??? - Using the UNO bridges

Error creating resolver with createInstanceWithContext

Postby nmset » Fri Nov 29, 2019 11:27 pm

I am trying to bootstrap AOO in C++ with the following lines on Linux :

Code: Select all   Expand viewCollapse view
Reference< XComponentContext > xComponentContext(::cppu::defaultBootstrap_InitialComponentContext());
Reference< XMultiComponentFactory > xMultiComponentFactoryClient(
        xComponentContext->getServiceManager() );
Reference< XInterface > xInterface =
    xMultiComponentFactoryClient->createInstanceWithContext(
        OUString::createFromAscii( "com.sun.star.bridge.UnoUrlResolver" ),
        xComponentContext );


It breaks in createInstanceWithContext throwing a CannotActivateFactoryException with the message 'Cannot load component library : /program/uuresolver.uno.so'.

After many trials, I desperately created /program in the filesystem and copied there uuresolver.uno.so. It then missed 'connector.uno.so', then 'binaryurp.uno.so'. When these two more files are copied in /program, AOO gets started from C++. But exporting a Writer text document to PDF will just fail, no PDF file is created. That is the program's intent.

If AOO is bootstrapped as follows :

Code: Select all   Expand viewCollapse view
xRemoteContext = Reference< XComponentContext >( ::cppu::bootstrap() );
xRemoteServiceManager = Reference< XMultiComponentFactory >(xRemoteContext->getServiceManager() );
RemoteDesktop = Reference < XComponentLoader >(xRemoteServiceManager->createInstanceWithContext(
        OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.frame.Desktop" ) ),
        xRemoteContext ), UNO_QUERY_THROW );


everything works seamlessly.

I just wish to start AOO externally with 'soffice -accept="socket,host=127.0.0.1,port=2083;urp;StarOffice.ServiceManager" -headless' and connect instances of the custom program to this listening instance remotely.

I'm using buildid=450m1(Build:9900) Revision=0cf988a7ab and buildid=420m1(Build:9800) Revision=1849999.

Creating a /program directory is not a solution of course. Please advise how to resolve this.

Thanks.
nmset
 
Posts: 12
Joined: Thu May 13, 2010 7:35 pm

Re: Error creating resolver with createInstanceWithContext

Postby Villeroy » Sat Nov 30, 2019 1:55 pm

OpenOffice comes with that file in its program directory. Possibly you have to change your program's working directory to /opt/openoffice4//program/
Please, edit this topic's initial post and add "[Solved]" to the subject line if your problem has been solved.
Ubuntu 18.04, no OpenOffice, LibreOffice 6.4
User avatar
Villeroy
Volunteer
 
Posts: 28668
Joined: Mon Oct 08, 2007 1:35 am
Location: Germany

Re: Error creating resolver with createInstanceWithContext

Postby nmset » Sat Nov 30, 2019 7:55 pm

Thanks for the reply. After changing cwd to /opt/openoffice4//program/, CannotActivateFactoryException is still thrown. Now every app can't have such cwd limitation, the more so a read only working directory.

I forgot to mention that LD_LIBRARY_PATH already points to /opt/openoffice4/program. Using LD_PRELOAD for the three libraries mentioned above does not help either.

It used to connect over socket to a listening instance a few years back. I suspect some variable related to OOO_BASE_DIR badly set somewhere.

I wish someone else could confirm this issue, which would give a valid reason to open a bug.
nmset
 
Posts: 12
Joined: Thu May 13, 2010 7:35 pm


Return to External Programs

Who is online

Users browsing this forum: No registered users and 2 guests