Hi together again, > I created a singleton in Java but when trying to call it > (theSpringLoader.get(xComponentContext)), I get following exception: > -----%<----- > com.sun.star.uno.RuntimeException: no service object raising singleton > /singletons/de.twc.oocom.comp.theSpringLoader > -----%<----- > > My singleton is stored in a Extension. How can I solve this problem?
I had to pass not only the singleton name to the Factory.createComponentFactory method, but also the service name. I had to change my __writeRegistryServiceInfo like this: -----%<----- public static boolean __writeRegistryServiceInfo(XRegistryKey regKey) { try { XRegistryKey newKey = regKey.createKey( SpringLoaderImpl.class.getName() + "/UNO/SINGLETONS/" + theSpringLoader.class.getName()); newKey.setStringValue(SpringLoaderImpl.__singeltonName); } catch (InvalidRegistryException e) { return false; } // NOTE: use the service Names!!! boolean regSpring = FactoryHelper.writeRegistryServiceInfo( SpringLoaderImpl.class.getName(), SpringLoaderImpl.__serviceNames, regKey); boolean regJudas = FactoryHelper.writeRegistryServiceInfo( JudasProtocolHandler.class.getName(), JudasProtocolHandler.SERVICENAME, regKey); return regJudas && regSpring; } -----%<----- And my __getComponentFactory like this: -----%<----- public static XSingleComponentFactory __getComponentFactory (String implName) { XSingleComponentFactory xSingleComponentFactory = null; if (implName.equals(JudasProtocolHandler.class.getName())) { xSingleComponentFactory = Factory.createComponentFactory( JudasProtocolHandler.class, new String[] {JudasProtocolHandler.SERVICENAME} ); } else if (implName.equals(SpringLoaderImpl.class.getName())) { xSingleComponentFactory = Factory.createComponentFactory( SpringLoaderImpl.class, SpringLoaderImpl.__serviceNames ); } return xSingleComponentFactory; } -----%<----- While __serviceNames is defined as: -----%<----- public static final String[] __serviceNames = { "de.twc.oocom.comp.SpringLoaderImpl", "de.twc.oocom.comp.theSpringLoader"}; -----%<----- Greetings, Tobias --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]