OpenOffice.org Forum at OOoForum.orgThe OpenOffice.org Forum
 
 [Home]   [FAQ]   [Search]   [Memberlist]   [Usergroups]   [Register
 [Profile]   [Log in to check your private messages]   [Log in

Not able to connect from my java app. Getting a disposed exp

 
Post new topic   Reply to topic    OOoForum.org Forum Index -> OpenOffice.org Macros and API
View previous topic :: View next topic  
Author Message
kaushalc
General User
General User


Joined: 12 Jul 2009
Posts: 31

PostPosted: Thu Apr 26, 2012 12:47 am    Post subject: Not able to connect from my java app. Getting a disposed exp Reply with quote

The java code that I use to connect to OO doesnt seem to be working. I am getting a com.sun.star.lang.DisposedException exception.

I am using this command to start OO in headless mode

soffice --headless --accept="socket,host=192.168.0.176,port=8100;urp;"

My code is as below

Code:
String connectionString = "socket,host=" + "192.168.0.176" + ",port=" + "8100" + ",tcpNoDelay=1";

XComponentContext localContext = Bootstrap.createInitialComponentContext(null);

XMultiComponentFactory localServiceManager = localContext.getServiceManager();

XConnector connector = (XConnector) UnoRuntime.queryInterface(com.sun.star.connection.XConnector.class, localServiceManager.createInstanceWithContext("com.sun.star.connection.Connector", localContext));

XConnection connection = connector.connect(connectionString);

XBridgeFactory bridgeFactory = (XBridgeFactory) UnoRuntime.queryInterface( com.sun.star.bridge.XBridgeFactory.class, localServiceManager.createInstanceWithContext( "com.sun.star.bridge.BridgeFactory", localContext));

XBridge bridge = bridgeFactory.createBridge("", "urp", connection, null);

XComponent bridgeComponent = (XComponent) UnoRuntime.queryInterface(com.sun.star.lang.XComponent.class, bridge);


Object serviceManagerObject = bridge.getInstance("StarOffice.ServiceManager");

I get a disposed exception in the last line at the bridge.getInstance() call.

Any help is greatly appreciated.

Thanks Kaushal



Moderation probe1: set CODE tags
Back to top
View user's profile Send private message Send e-mail
hol.sten
Super User
Super User


Joined: 14 Nov 2004
Posts: 3533
Location: Hamburg, Germany

PostPosted: Thu Apr 26, 2012 12:30 pm    Post subject: Reply with quote

Although you're error message is not a BootstrapException: no office executable found! you can try these threads:
[Java solution] "no office executable found!": http://user.services.openoffice.org/en/forum/viewtopic.php?f=44&t=2520.
[Java] Caution with Bootstrap using OOo 3.0.0: http://user.services.openoffice.org/en/forum/viewtopic.php?f=44&t=10825
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    OOoForum.org Forum Index -> OpenOffice.org Macros and API All times are GMT - 8 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group