Hi everybody,

I am a developer for the memoComp company in Germany. We are supporting openoffice applications as well as other java technologies.

Now my major concern:
We developed a webservice, which transfers data from MS-Excel (xls) type files into a custom template of openoffice calc. This webservice is written in Java and is using the UNO-Api Interface. For its task the service creates an calc file from our template (ots) for every incoming xls file, and simply copies the content from the incoming xls into the newly created file cell by cell. Nothing strange up here. Everything is working in theory and reality.

Relevant code:
XCell newCell = xSpreadsheetOut.getCellByPosition(x, y);
newCell.setFormula("...");

The problem now is that the service throws runtime excptions for which I have not found any useful documentation files till now. The stack trace is the following:

com.sun.star.uno.RuntimeException: getInstance expected XInterface but got com.sun.star.table.XCell at com.sun.star.lib.uno.environments.remote.Job.remoteUnoRequestRaisedException(Job.java:182)
    at com.sun.star.lib.uno.environments.remote.Job.execute(Job.java:148)
at com.sun.star.lib.uno.environments.remote.JobQueue.enter(JobQueue.java:344) at com.sun.star.lib.uno.environments.remote.JobQueue.enter(JobQueue.java:313) at com.sun.star.lib.uno.environments.remote.JavaThreadPool.enter(JavaThreadPool.java:101) at com.sun.star.lib.uno.bridges.java_remote.java_remote_bridge.sendRequest(java_remote_bridge.java:652) at com.sun.star.lib.uno.bridges.java_remote.ProxyFactory$Handler.request(ProxyFactory.java:154) at com.sun.star.lib.uno.bridges.java_remote.ProxyFactory$Handler.invoke(ProxyFactory.java:136)
    at $Proxy8.setFormula(Unknown Source)
at de.xxx.ReportImporter.copyRangesIntoTemplateAndStoreDocument(Unknown Source)
   [...]
java.lang.NullPointerException
    at de.memocomp.oo.OOManager.closeDocument(Unknown Source)
at de.xxx.ReportImporter.copyRangesIntoTemplateAndStoreDocument(Unknown Source)
   [...]

What I am able to say is, that the service was designed to run asynchronous. If we do so, the exception appears more often. If the service runs queued or in a pipline it works quite well. The exception above then appeard only once in ~30 runs, but it appeared. Trying retries if the error occurs, even with 10sec wait in between did not had any positive (or negative) effect on the issue. Testing the cast of the XCell to XInterface before the call works fine, even if the error occurs:

Code:
XCell newCell = xSpreadsheetOut.getCellByPosition(x, y);
XInterface x = newCell;
newCell.setFormula("...");

The environment were the webservice is installed is a windows server where two tomcat instances are running managed by a load balancer. Openoffice is in version 3.1 and is installed on the same server, where the two instances (load balancing) of our webservice are connecting to openoffice via socket. The code to instanciate and connect to openoffice is the Bootstrap-Connector from hol.sten. available under: http://user.services.openoffice.org/en/forum/viewtopic.php?f=44&t=2520

[...]
String hostAndPort = "host="+host+",port="+port;
// accept option
String oooAcceptOption = "-accept=socket,"+hostAndPort+";urp;";
// connection string
String unoConnectString = "uno:socket,"+hostAndPort+";urp;StarOffice.ComponentContext";
[...]
Runtime.getRuntime().exec(oooCommand);
[...]
XComponentContext xLocalContext = Bootstrap.createInitialComponentContext(null);
[...]

We re looking forward to any helpful response, helping to understand and to solve this exception.
Thanks in advance.

--

Johannes Höchstädter
www.memocomp.de


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@openoffice.org
For additional commands, e-mail: dev-h...@openoffice.org

Reply via email to