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

Problem to connect to OOo

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


Joined: 07 Jul 2006
Posts: 52

PostPosted: Fri Sep 15, 2006 11:17 am    Post subject: Problem to connect to OOo Reply with quote

I am using the following code and I am able to connect openoffice:

Code:
  public static com.sun.star.frame.XDesktop getDesktop()
  throws java.lang.Exception
  {
  XComponentContext xLocalContext = com.sun.star.comp.helper.Bootstrap.
  createInitialComponentContext(null);
  XMultiComponentFactory xLocalServiceManager = xLocalContext.getServiceManager();
  Object urlResolver = xLocalServiceManager.
  createInstanceWithContext("com.sun.star.bridge.UnoUrlResolver", xLocalContext);
  XUnoUrlResolver xUrlResolver = (XUnoUrlResolver) UnoRuntime.
  queryInterface(XUnoUrlResolver.class, urlResolver);           
  Object initialObject = xUrlResolver.
  resolve("uno:socket,host=150.164.5.74,port=2083;urp;StarOffice.ServiceManager");
  XPropertySet xPropertySet = (XPropertySet)UnoRuntime.
  queryInterface(XPropertySet.class, initialObject);     
  Object context = xPropertySet.getPropertyValue("DefaultContext");   
  XComponentContext xRemoteContext = (XComponentContext)UnoRuntime.
  queryInterface(XComponentContext.class, context);           
  XMultiComponentFactory mxRemoteServiceManager = xRemoteContext.
  getServiceManager();           
  Object desktop = mxRemoteServiceManager.
  createInstanceWithContext("com.sun.star.frame.Desktop", null);           

  return (com.sun.star.frame.XDesktop)desktop;
  }



I get the error
Code:
com.sun.star.connection.NoConnectException: java.net.ConnectException: Connection refused: connect
when the line
Code:
Object initialObject = xUrlResolver.
  resolve("uno:socket,host=150.164.5.74,port=2083;urp;StarOffice.ServiceManager");
is reached.
Back to top
View user's profile Send private message
hol.sten
Super User
Super User


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

PostPosted: Fri Sep 15, 2006 11:32 am    Post subject: Re: Problem to connect to OOo Reply with quote

aloiziops wrote:
I am using the following code and I am able to connect openoffice:

Did you omit a not in the above sentence? If so, try one of this links to get a working connection:
- http://www.oooforum.org/forum/viewtopic.phtml?t=39950
- http://www.oooforum.org/forum/viewtopic.phtml?t=40525
- http://www.oooforum.org/forum/viewtopic.phtml?t=41093
I hope that one of this links can guide you to a working connection.

With kind regards
hol.sten
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