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.


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



try {
// use methods on _xDoc.

}
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] DisposedException when connecting to OpenOffice

2007-02-22 Thread Stephan Bergmann

Jan Pavelka wrote:

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)


Such an exception is often indicative of an soffice crash.  (At a quick 
glance, your code and setup seems reasonable, so I have no idea why 
there would be an soffice crash, though.)


-Stephan

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