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
My code looks likewhen 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 :
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();
}
}
}
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)