Created attachment 154264 [details] Test class When I trying to write a simple Java application to connect to remote headless LibreOffice server. I use SDK from maven. I found some documentation https://wiki.openoffice.org/wiki/Documentation/DevGuide/ProUNO/Java/Getting_a_Service_Manager and got com.sun.star.frame.XDesktop object, but next application doesn't stop. In the debugger I got MessageDispatcher who waits for messages from the server: SocketInputStream.socketRead0 SocketInputStream.socketRead:116 SocketInputStream.read:171 SocketInputStream.read:141 BufferedInputStream.fill:246 BufferedInputStream.read1:286 BufferedInputStream.read:345 Hidden Source Calls SocketConnection.read:138 XConnectionInputStream_Adapter.read:48 DataInputStream.readInt:387 Hidden Source Calls urp.readBlock:364 urp.readMessage:96 java_remote_bridge$MessageDispatcher.run:92 I've tried to call XDesktop::terminate() method in the end but as expected it closed remote LibreOffice. Are there other way to disconnect from the server and stop application?
Found documentation here https://wiki.openoffice.org/wiki/Uno/Remote/Tutorials/Disposing_Remote_Bridges and example here: https://www.programcreek.com/java-api-examples/?code=LibreOffice/noa-libre/noa-libre-master/src/ag/ion/bion/officelayer/internal/application/connection/RemoteOfficeConnection.java This snippet allows application to be correctly closed: Object oBridgeFactory = xcomponentcontext.getServiceManager().createInstanceWithContext("com.sun.star.bridge.BridgeFactory", xcomponentcontext); XBridgeFactory xBridgeFactory = (XBridgeFactory) UnoRuntime.queryInterface(XBridgeFactory.class, oBridgeFactory); for (XBridge bridge : xBridgeFactory.getExistingBridges()) { XComponent xComponent = (XComponent) UnoRuntime.queryInterface(XComponent.class, bridge); xComponent.dispose(); }
Closing as RESOLVED NOTABUG