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

Urgent help required......Facing some connection problem

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

Joined: 10 May 2009
Posts: 7

PostPosted: Fri May 15, 2009 6:11 am    Post subject: Urgent help required......Facing some connection problem Reply with quote


I am facing some problems while connecting to the openoffice.
Following are the s/w specifications

java 1.5.0_12

My code is invoking a custom method named 'initialize connection'. The body of this method is as shown


private void initializeConnection() throws Exception {
connection = openOfficeConnect;
// Getting the given type to convert to
stringConvertType = openOfficeConvertType;
// Getting the given extension that should be appended to the origin document
stringExtension = "sxw";

XComponentContext xComponentContext =;

XMultiComponentFactory xMultiComponentFactory =

Object objectUrlResolver =

// Create a new url resolver
XUnoUrlResolver xurlresolver =
(XUnoUrlResolver) UnoRuntime.queryInterface(XUnoUrlResolver.class,objectUrlResolver);

// Resolves an object that is specified as follow:
// uno:<connection description>;<protocol description>;<initial object name>
      "connecting to openoffice " + connection);
      Object objectInitial = xurlresolver.resolve(connection);

// Create a service manager from the initial object
xMultiComponentFactory = (XMultiComponentFactory) UnoRuntime.queryInterface(

// Query for the XPropertySet interface.
XPropertySet xpropertysetMultiComponentFactory =
   (XPropertySet) UnoRuntime.queryInterface(

// Get the default context from the office server.
Object objectDefaultContext =

// Query for the interface XComponentContext.
xComponentContext =
      (XComponentContext) UnoRuntime.queryInterface(

/* A desktop environment contains tasks with one or more
   frames in which components can be loaded. Desktop is the
   environment for components which can instanciate within
   frames. */
xcomponentloader =
      (XComponentLoader) UnoRuntime.queryInterface(

//if get to here with no error, reset start attempts
connectAttempts = 0;
} catch (Exception e) {
      "Exception connecting to OpenOffice: Attempt ="
            + connectAttempts);
      if (connectAttempts > 3) {
         throw new Exception(
            "Error running OpenOffice conversion",

For starting the service the command line arguments are :

/usr/lib/ooo-1.1/program/soffice   -headless -nofirststartwizard -accept="socket,host=0,port=8100;urp;StarOffice.ServiceManager"

For Connecting to Openoffice

/usr/lib/ooo-1.1/program/soffice   -headless -nofirststartwizard -accept="socket,host=0,port=8100;urp;StarOffice.ServiceManager"

I am getting following exception

Starting OpenOffice /usr/lib/ooo-1.1/program/soffice   -headless -nofirststartwizard -accept="socket,host=0,port=8100;urp;StarOffice.ServiceManager"
connecting to openoffice uno:socket,host=localhost,port=8100;urp;StarOffice.ServiceManager;
service manager created
value is null
Exception connecting to OpenOffice: Attempt =0
        at com.hcl.OpenOfficeConverter.initializeConnection(
        at com.hcl.OpenOfficeConverter.createInstanceIfNeeded(
        at com.hcl.OpenOfficeConverter.getInstance(
        at com.hcl.OpenOfficeConverter.process(
        at com.hcl.OpenOfficeConverter.main(

So far i have debugged the code and come to a conclusion that the xpropertysetMultiComponentFactory is coming out to be null...

Following are the things that I have already tried:::::

1)I have made all necessary changes required for display thing i.e
a) Xvfb :5 -screen 0 800x600x16 &
b) ooffice -invisible -nologo -display :5
2) tried with host=localhost & host=0 & host=
3)installed new version of openofficeorg(3.0.1) and change the classpath with new libraries which are in basic3.0/program/classes :-still facing the above excpetion
4)tried connecting to openoffice installed on windows2003 server by providing the server ip.

But in vain... still um facing that null pointer excpetion...... Please help in this regard...... that is the on;ly cure for my headache as deliverables are near.....

Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic Forum Index -> 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