OpenOffice BootstrapException NoConnectException with Invisible (Hidden/Headless) Mode with Linux
I got this exception
com.sun.star.comp.helper.BootstrapException: com.sun.star.connection.NoConnectException
while connecting to open office from another application (PhpBridge custom servlet in my case).
Here’s the original code i was using
BootstrapSocketConnector.bootstrap(installationPath);
Here how I got around it.
List<String> oooOptions = OOoServer.getDefaultOOoOptions();
oooOptions.add(“-headless”);
oooOptions.add(“-nofirststartwizard”);
The -headless & -nofirststartwizard are important. In linux, the “headless” package must be separately installed.
Next, do the following
OOoServer oooServer = new OOoServer(installationPath, oooOptions);
BootstrapSocketConnector bootstrapSocketConnector = new BootstrapSocketConnector(oooServer);
XComponentContext context = bootstrapSocketConnector.connect();
Once you have a componentContext, you’re all set and good to go!
