Re: [dev] DisposedException when connecting to OpenOffice

2007-02-26 Thread Eric Charles | U-Mangate

Hi,
I had such an exception the second time I invoked my application.
I looked at 
http://api.openoffice.org/docs/common/ref/com/sun/star/lang/DisposedException.html


you will read:
This exception occurs if the object behind this interface has been 
disposed before and can't uphold its method specification anymore.


I tough I had to free the resources I was using (in my case, the first 
time, it was perfectly working, the second, I had the DisposedException).


So I called dispose() method on my document.

snip
_xDoc = _xComponentLoader.loadComponentFromURL(loadUrl, _default, 0, 
_loadProps);

snip

try {
// use methods on _xDoc.
snip
}
finally {
// free _xDoc
_xDoc.dispose();
}


... and the second, third,...time, everything was working.

Kind regards,

Eric


Jan Pavelka wrote:

Hello everybody,
 
I'm using OpenOffice 2.1 on Solaris
 
I'm trying to connect to listening OpenOffice with my application.
 
I have a Xvfb started, so I use this command to start openoffice
 
soffice -invisible -display :0

-accept=socket,host=localhost,port=6000;urp;StarOfficeServiceManager

When I try to bootstrap the OO with given code:
 
OpenOfficeHost = localhost;


OpenOfficePort = 6000;

String con = socket,host=+OpenOfficeHost+,port=+OpenOfficePort;

xRemoteContext = Bootstrap.createInitialComponentContext(null);

XUnoUrlResolver urlResolver = UnoUrlResolver.create(xRemoteContext);

Object initialObject = urlResolver.resolve(

uno:socket,host= + OpenOfficeHost + ,port= + OpenOfficePort +
;urp;StarOffice.ServiceManager);

xRemoteServiceManager = (XMultiComponentFactory)

UnoRuntime.queryInterface(XMultiComponentFactory.class,

initialObject);

XPropertySet xProperySet = (XPropertySet) UnoRuntime.queryInterface(

XPropertySet.class, xRemoteServiceManager);

Object oDefaultContext = xProperySet.getPropertyValue(DefaultContext);

xRemoteContext = (XComponentContext)

UnoRuntime.queryInterface(XComponentContext.class, oDefaultContext);

desktop = xRemoteServiceManager.createInstanceWithContext(

com.sun.star.frame.Desktop, xRemoteContext);

 


I got the exception

com.sun.star.lang.DisposedException: java.io.IOException:
com.sun.star.io.IOException: EOF reached -
socket,host=localhost,port=6000,localHost=localhost,localPort=35109,peer
Host=localhost,peerPort=6000
at
com.sun.star.lib.uno.bridges.java_remote.java_remote_bridge$MessageDispa
tcher.invoke(java_remote_bridge.java:237)
at
com.sun.star.lib.uno.bridges.java_remote.java_remote_bridge$MessageDispa
tcher.run(java_remote_bridge.java:144)


at line

Object initialObject = urlResolver.resolve(

uno:socket,host= + OpenOfficeHost + ,port= + OpenOfficePort +
;urp;StarOffice.ServiceManager);

Thanks for any help

Jan Pavelka


  


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: [dev] OpenOffice Tomcat

2007-01-15 Thread Eric Charles | U-Mangate

com.sun.star.comp.helper.BootstrapException: no office executable  found!

When you access OpenOffice from JAVA, at least the juh.jar located in 
OpenOffice.org 2.0/program/classes/juh.jar (where the BootStrap class 
resides) must be in your classpath.


If you copy the juh.jar at another place and you place it in your 
classpath, this will *not* work (OpenOffice returns no office executable 
found!).


As a consequence, I always leave all the openoffice jars in their 
original directory, and I put these jars in the server (tomcat) classpath.


Hope this helps,

Eric


Markus Auchmann wrote:

Hi guys,

currently I'm working on an application where I try to use OpenOffice 
in a

Tomcat servlet. I'm running Tomcat 5.5.20 and OpenOffice 2.1. To talk to
OpenOffice I decided to use the BSF4Rexx engine which works properly 
with my
servlet. But when I try to invoke OpenOffice I get an error. The 
scripts are

all running fine when trying it without the servlet, so this is a
Tomcat/OpenOffice/Configuraiton issue.

Here is a part of the error which I receive from Tomcat:

-8
 Exception in thread http-8080-Processor25 
 org.apache.bsf.BSFException: /// Java-exception (RexxAndJava) occurred:
 [com.sun.star.comp.helper.BootstrapException: no office executable 
 found!] \\\ BSF4Rexx subfunction invoke: object 
 '[EMAIL PROTECTED]' - method [BOOTSTRAP], method not found or 
error

(exception) executing method!
-8

I added all necessary lib's to my lib directory of my application but
apparently tomcat is not able to speak with OpenOffice. As BSF4Rexx 
itself

is calling Java to talk to OpenOffice there may be a problem with Java,
Tomcat and OpenOffice as the script is running fine when executing it 
from

the console without the servlet.

Maybe someone of you can give me a hint how to get this to work!
All hints are appreciated :)

Thanks a lot in advance,
Markus
  
-

To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]