As we transition to the new Hyland Community, some post links may be temporarily disrupted as we finalize redirects. We apologize for the inconvenience and are working to resolve this as quickly as possible. Details.
Exception: org.alfresco.config.ConfigException - 03060000 Reading the Server config via the generic interfaces is not supported
package com.xxxx.alfresco.km.property; import java.io.IOException; import java.io.InputStream; import java.util.Properties; import org.apache.log4j.Logger; /** * @author Lalit Jangra. * Class to read property from a property file. */ public class KmPropertyReader { private static Logger logger = Logger.getLogger(KmPropertyReader.class); public String property; Properties properties = new Properties(); public static final String PROPERTIES_FILE = "alfresco-global.properties"; public KmPropertyReader() { ClassLoader classLoader = Thread.currentThread() .getContextClassLoader(); InputStream inputStream = classLoader .getResourceAsStream(PROPERTIES_FILE); try { properties.load(inputStream); } catch (IOException e) { logger .error("Error while loading property file in KmPropertyReader() : " + e.getMessage()); e.printStackTrace(); } finally { if (inputStream != null) { try { inputStream.close(); } catch (IOException e) { logger .error("Error while closing property file in KmPropertyReader() : " + e.getMessage()); e.printStackTrace(); } } } } public String getProperty(String property) { return properties.getProperty(property); } public void setProperty(String property) { this.property = property; } }
you can inject the global properties as a dependency. The bean is called "global-properties" and it's a java.util.Properties type. Then you can read whatever you want from that value.
<?xml version='1.0' encoding='UTF-8'?> <!DOCTYPE beans PUBLIC '-//SPRING//DTD BEAN//EN' 'http://www.springframework.org/dtd/spring-beans.dtd'> <beans> <bean id="global-properties" parent="baseJavaScriptExtension" class="java.util.Properties"> <property name="extensionName"> <value>globalProperties</value> </property> </bean> </beans>