[Solved] Can't access openoffice service on remote machine

Creating a macro - Writing a Script - Using the API (OpenOffice Basic, Python, BeanShell, JavaScript)
Post Reply
User avatar
rajeshgajipara
Posts: 2
Joined: Fri Jun 20, 2008 12:19 pm
Location: Ahmedabad,Gujarat (INDIA)

[Solved] Can't access openoffice service on remote machine

Post by rajeshgajipara »

Hi,

I have java program as following on machine 192.1.1.38
I have installed open office on machine 192.1.1.34
Java version : 1.4
Open Office version : 2.3.1
when i executes following code from machine 192.1.1.34
it converts file properly,
but when same code executes from machine 192.1.1.38
i got following error :
My code looks like

Code: Select all


import java.net.ConnectException;
import com.artofsolving.jodconverter.openoffice.connection.SocketOpenOfficeConnection;
import com.sun.star.beans.PropertyValue;
import com.sun.star.comp.helper.BootstrapException;
import com.sun.star.frame.XComponentLoader;
import com.sun.star.frame.XStorable;
import com.sun.star.lang.XMultiComponentFactory;
import com.sun.star.uno.Exception;
import com.sun.star.uno.UnoRuntime;
import com.sun.star.uno.XComponentContext;

public class ReadFile { 

    public static void main(String	[] args) throws BootstrapException, Exception, ConnectException 
    { 
   	try{
    	SocketOpenOfficeConnection connection = new SocketOpenOfficeConnection("192.1.1.34",8100);
		connection.connect();
		//XComponentContext xContext = Bootstrap.bootstrap(); 
        XComponentContext xContext = connection.getComponentContext();
        XMultiComponentFactory xMultiComponentFactory = xContext.getServiceManager(); 
        XComponentLoader xcomponentloader = (XComponentLoader) UnoRuntime.queryInterface(XComponentLoader.class,xMultiComponentFactory.createInstanceWithContext("com.sun.star.frame.Desktop", xContext)); 
        String loadURL = "file:///c:/Constraints.doc";  //192.1.1.38 
        String storeUrl = "file:///c:/Constraints.pdf"; 
        PropertyValue[] propertyvalue = new PropertyValue[1]; 
        propertyvalue[0] = new PropertyValue(); 
        propertyvalue[0].Name = "Hidden"; 
        propertyvalue[0].Value = new Boolean(true); 
         Object objectDocumentToStore = xcomponentloader.loadComponentFromURL(loadURL, "_blank", 0, propertyvalue);
        PropertyValue[] conversionProperties = new PropertyValue[1]; 
        conversionProperties[0] = new PropertyValue(); 
        conversionProperties[0].Name = "FilterName"; 
        conversionProperties[0].Value = "writer_pdf_Export"; 
        XStorable xstorable = (XStorable) UnoRuntime.queryInterface(XStorable.class,objectDocumentToStore);
        xstorable.storeToURL(storeUrl,conversionProperties);
        if(connection!=null)connection.disconnect();
    	}catch(Exception e)
    	{
    		e.printStackTrace();
    	}        
    } 
}
Error description

Code: Select all

com.sun.star.lang.IllegalArgumentException: URL seems to be an unsupported one.
      at com.sun.star.lib.uno.environments.remote.Job.remoteUnoRequestRaisedException(Job.java:187)
      at com.sun.star.lib.uno.environments.remote.Job.execute(Job.java:153)
      at com.sun.star.lib.uno.environments.remote.JobQueue.enter(JobQueue.java:349)
      at com.sun.star.lib.uno.environments.remote.JobQueue.enter(JobQueue.java:318)
      at com.sun.star.lib.uno.environments.remote.JavaThreadPool.enter(JavaThreadPool.java:106)
      at com.sun.star.lib.uno.bridges.java_remote.java_remote_bridge.sendRequest(java_remote_bridge.java:657)
      at com.sun.star.lib.uno.bridges.java_remote.ProxyFactory$Handler.request(ProxyFactory.java:159)
      at com.sun.star.lib.uno.bridges.java_remote.ProxyFactory$Handler.invoke(ProxyFactory.java:141)
      at $Proxy4.loadComponentFromURL(Unknown Source)
      at com.test.URLUnsupported.main(URLUnsupported.java:38)
Last edited by rajeshgajipara on Tue Jun 24, 2008 9:48 am, edited 1 time in total.
OOo 2.3.X on Ms Windows XP
hol.sten
Volunteer
Posts: 495
Joined: Mon Oct 08, 2007 1:31 am
Location: Hamburg, Germany

Re: Can't access openoffice service on remote machine

Post by hol.sten »

rajeshgajipara wrote:I have java program as following on machine 192.1.1.38
I have installed open office on machine 192.1.1.34

Code: Select all

...
    SocketOpenOfficeConnection connection = new SocketOpenOfficeConnection("192.1.1.34",8100);
    connection.connect();
    String loadURL = "file:///c:/Constraints.doc";  //192.1.1.38 
    String storeUrl = "file:///c:/Constraints.pdf"; 
...

Code: Select all

com.sun.star.lang.IllegalArgumentException: URL seems to be an unsupported one.
Your code can only work, if Constraints.doc is stored in c:\ on 192.1.1.34! OOo can not load files from a remote machine. You have to use streams for this: [Java solution] Using XInputStream and XOutputStream: http://user.services.openoffice.org/en/ ... =44&t=3801
OOo 3.2.0 on Ubuntu 10.04 • OOo 3.2.1 on Windows 7 64-bit and MS Windows XP
User avatar
rajeshgajipara
Posts: 2
Joined: Fri Jun 20, 2008 12:19 pm
Location: Ahmedabad,Gujarat (INDIA)

Re: Can't access openoffice service on remote machine

Post by rajeshgajipara »

Thank you, to all supporters.
I have solved my problem by your help.

can i mark this issue as a solved ?? how ?
So, any other users can reffer it easily and hopefully ! :)
OOo 2.3.X on Ms Windows XP
hol.sten
Volunteer
Posts: 495
Joined: Mon Oct 08, 2007 1:31 am
Location: Hamburg, Germany

Re: Can't access openoffice service on remote machine

Post by hol.sten »

rajeshgajipara wrote:can i mark this issue as a solved ?? how ?
Read the chapter Tag your thread when it has been [Solved] of the Survival Guide for the forum of this forum: http://user.services.openoffice.org/en/ ... t=166#p717
OOo 3.2.0 on Ubuntu 10.04 • OOo 3.2.1 on Windows 7 64-bit and MS Windows XP
Post Reply