Connection failed while connection to OpenOffice

Java, C++, C#, Delphi... - Using the UNO bridges
Post Reply
pratik.a03
Posts: 1
Joined: Sun Oct 27, 2013 10:36 am

Connection failed while connection to OpenOffice

Post by pratik.a03 »

Code: Select all

OpenOfficeConnection socketopenofficeconnection = new SocketOpenOfficeConnection(1234);
        try
        {
            String s3 = (new StringBuilder()).append(s2).append(File.separator).append("uhyof.xls").append(".ods").toString();
            DefaultDocumentFormatRegistry defaultdocumentformatregistry = new DefaultDocumentFormatRegistry();
            File file4 = new File((new StringBuilder()).append(s2).append(File.separator).append("uhyoof.xls").toString());
            File file6 = new File(s3);
            socketopenofficeconnection.connect();
if(socketopenofficeconnection.isConnected())
            {
                OpenOfficeDocumentConverter openofficedocumentconverter = new OpenOfficeDocumentConverter(socketopenofficeconnection);
                openofficedocumentconverter.convert(file4, defaultdocumentformatregistry.getFormatByFileExtension("xls"), file6, defaultdocumentformatregistry.getFormatByFileExtension("ods"));
            } else
            {
                File file7 = new File((new StringBuilder()).append(s2).append(File.separator).append("$$tsjoof$$.xls").toString());
                file7.renameTo(new File((new StringBuilder()).append(s2).append(File.separator).append(s1).toString()));
                throw new OpenOfficeConnectException("Unable to connect to OpenOffice.org to convert Excel Document.");
            }
        }
        catch(ConnectException connectexception)
        {
            String s4 = connectexception.getMessage();
            System.out.println(s4);
            connectexception.getCause();
            connectexception.getStackTrace();
            File file5 = new File((new StringBuilder()).append(s2).append(File.separator).append("$$tsjoof$$.xls").toString());
            file5.renameTo(new File((new StringBuilder()).append(s2).append(File.separator).append(s1).toString()));
            throw new OpenOfficeConnectException((new StringBuilder()).append("Unable to communicate with OpenOffice to convert Excel Document: ").append(s4).toString());
        }
I am getting an exception
connection failed: socket,host=localhost,port=1234,tcpNoDelay=1: java.net.ConnectException: Connection refused: connect
Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException
	at com.artofsolving.jodconverter.openoffice.connection.AbstractOpenOfficeConnection.disconnect(AbstractOpenOfficeConnection.java:88)
	at fileToXliff.ExcelImporter.convert(ExcelImporter.java:90)
	at fileToXliff.MainGui.jbtnConvertActionPerformed(MainGui.java:667)
	at fileToXliff.MainGui.access$800(MainGui.java:55)
	at fileToXliff.MainGui$9.actionPerformed(MainGui.java:179)
	at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1995)
	at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2318)
	at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:387)
	at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:242)
	at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:236)
	at java.awt.Component.processMouseEvent(Component.java:6041)
	at javax.swing.JComponent.processMouseEvent(JComponent.java:3265)
	at java.awt.Component.processEvent(Component.java:5806)
	at java.awt.Container.processEvent(Container.java:2058)
	at java.awt.Component.dispatchEventImpl(Component.java:4413)
	at java.awt.Container.dispatchEventImpl(Container.java:2116)
	at java.awt.Component.dispatchEvent(Component.java:4243)
	at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4322)
	at java.awt.LightweightDispatcher.processMouseEvent(Container.java:3986)
	at java.awt.LightweightDispatcher.dispatchEvent(Container.java:3916)
	at java.awt.Container.dispatchEventImpl(Container.java:2102)
	at java.awt.Window.dispatchEventImpl(Window.java:2440)
	at java.awt.Component.dispatchEvent(Component.java:4243)
	at java.awt.EventQueue.dispatchEvent(EventQueue.java:599)
	at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:273)
	at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:183)
	at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:173)
	at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:168)
	at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:160)
	at java.awt.EventDispatchThread.run(EventDispatchThread.java:121)
what should i need to do for that i am working on windows vista
OpenOffice 3.1 on Windows Vista
User avatar
Villeroy
Volunteer
Posts: 31279
Joined: Mon Oct 08, 2007 1:35 am
Location: Germany

Re: Connection failed while connection to OpenOffice

Post by Villeroy »

Start the office in listening mode.
Please, edit this topic's initial post and add "[Solved]" to the subject line if your problem has been solved.
Ubuntu 18.04 with LibreOffice 6.0, latest OpenOffice and LibreOffice
Post Reply