Hi together, I changed the name of the thread, because I progressed a lot implementing a singleton...
After implementing my singleton (see Steps below) I want to retrieve it using the following Java code: -----%<----- mySpringLoader.get(xComponentContext); -----%<----- But I get an exception: -----%<----- com.sun.star.uno.RuntimeException: no service object raising singleton /singletons/de.twc.oocom.comp.mySpringLoader at ... -----%<----- What went wrong? Can you help me? Here is the way, I created my singleton (thanks Daan de Wit for your great help): STEP 1. I created an IDL file for my UNO interface for my extension: -----%<----- #ifndef __de_twc_oocom_comp_xspringloader_idl__ #define __de_twc_oocom_comp_xspringloader_idl__ #include <com/sun/star/uno/XInterface.idl> module de { module twc { module oocom { module comp { published interface XSpringLoader : com::sun::star::uno::XInterface { }; }; }; }; }; #endif -----%<----- STEP 2. Then I defined my UNO singleton with the following IDL file: -----%<----- #ifndef __de_twc_oocom_comp_myspringloader_idl__ #define __de_twc_oocom_comp_myspringloader_idl__ #include "XSpringLoader.idl" module de { module twc { module oocom { module comp { published singleton mySpringLoader : XSpringLoader; }; }; }; }; #endif -----%<----- STEP 3. I created a Java implementation of my singleton (very rudimentary): -----%<----- package de.twc.oocom.comp; public class SpringLoaderImpl implements XSpringLoader { private static final SpringLoaderImpl INSTANCE = new SpringLoaderImpl(); private SpringLoaderImpl() { } public static final SpringLoaderImpl getInstance() { return INSTANCE; } /** * The name of the singleton implemented. */ static final String SINGLETONNAME = "de.twc.oocom.comp.mySpringLoader"; } -----%<----- STEP 4. I stored the singleton by adding the following code in my __writeRegistryServiceInfo of my component registration class: -----%<----- public static boolean __writeRegistryServiceInfo(XRegistryKey regKey) { try { XRegistryKey newKey = regKey.createKey( SpringLoaderImpl.class.getName() + "/UNO/SINGLETONS/" + mySpringLoader.class.getName()); newKey.setStringValue(SpringLoaderImpl.SINGLETONNAME); } catch (InvalidRegistryException e) { return false; } // Registering my service implemented in the same component boolean regJudas = FactoryHelper.writeRegistryServiceInfo( JudasProtocolHandler.class.getName(), JudasProtocolHandler.SERVICENAME, regKey); return regJudas; } -----%<----- STEP 5. I changed my __getServiceFactory of my component registration class. I am not sure if this step is correct. Daan adviced me the change the method __getComponentFactory. But my component registration class has no such method. Thus I used the __getServiceFactory. Can someone tell me, if this is correct? Here is my code: -----%<----- public static XSingleServiceFactory __getServiceFactory(String implName, XMultiServiceFactory multiFactory, XRegistryKey regKey) { XSingleServiceFactory xSingleServiceFactory = null; if (implName.equals(JudasProtocolHandler.class.getName())) { xSingleServiceFactory = FactoryHelper.getServiceFactory( JudasProtocolHandler.class, JudasProtocolHandler.SERVICENAME, multiFactory, regKey); } else if (implName.equals(SpringLoaderImpl.class.getName())) { xSingleServiceFactory = FactoryHelper.getServiceFactory( SpringLoaderImpl.class, SpringLoaderImpl.SINGLETONNAME, multiFactory, regKey); } return xSingleServiceFactory; } ------%<------ STEP 6. I try to get my singelton this way: -----%<----- mySpringLoader.get(xComponentContext); -----%<----- Here, the failure described above happend. Can you help me solving this? Thanks in advance! Greeting, Tobias --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]