Hi, I'm implementing the ESB mediator for WSO2 Machine Learner.
To use this mediator, Machine Learner features need to be installed in the ESB. I have a requirement to create a new instance of org.wso2.carbon.ml.core.impl.MLModelHandler at the mediator initialization. (MLModelHandler class will be avaiable in the classpath once the Machine Learner feature is installed) At the initialization of the MLModelHandler, it needs to read some configuration files (in repository/conf). I tried the following steps and got the below mentioned exception, indicating that the proxy cannot be loaded. 1. Add the machineLearner mediator in the inSequence of a proxy service. (Machine Learner feature is already installed in ESB) 2. Restart the ESB server 3. At the server startup, a null pointer exception is thrown as below, indicating that the configurations required at the initlializatoin of org.wso2.carbon.ml.core.impl.MLModelHandler are not loaded. WARN - SynapseXMLConfigurationFactory Proxy Service configuration: MLMediatorTestProxy cannot be built - Continue in fail-safe mode java.lang.NullPointerException at org.wso2.carbon.ml.core.utils.ThreadExecutor.<init>(ThreadExecutor.java:32) at org.wso2.carbon.ml.core.impl.MLModelHandler.<init>(MLModelHandler.java:68) at org.wso2.carbon.mediator.machinelearner.util.ModelHandler.<init>(ModelHandler.java:65) at org.wso2.carbon.mediator.machinelearner.MachineLearnerMediator.<init>(MachineLearnerMediator.java:45) at org.wso2.carbon.mediator.machinelearner.xml.MachineLearnerMediatorFactory.createSpecificMediator(MachineLearnerMediatorFactory.java:46) I noticed that, at the ESB server start-up, the mediator constructor is called twice per each proxy server configuration. However at the second time of mediator initialization, the configurations are available. So the proxy service is loaded successfully. It seems that the proxy is loaded before loading the configuration files required for the installed Machine Learner feature. How can I overcome this issue? Isn't it a good practice to access the installed features at the mediator initialization? As a solution, I can use the lazy loading approach. So that the new instance of org.wso2.carbon.ml.core.impl.MLModelHandler will be initialized only when the first message comes to the the mediator's mediate() method. Is this a suitable approach? Thanks. -- Manorama Perera Software Engineer WSO2, Inc.; http://wso2.com/ Mobile : +94716436216
_______________________________________________ Dev mailing list Dev@wso2.org http://wso2.org/cgi-bin/mailman/listinfo/dev