Hi Chanaka, [1] contains the Machine Learner Mediator source code. [2] This is the MachineLearnerMediatorFactory class which initializes the MLModelHandler.
Here is the method call machineLearnerMediator.initializeModel(); [1] https://github.com/manoramahp/carbon-mediation/tree/master/components/mediators/machine-learner [2] https://github.com/manoramahp/carbon-mediation/blob/master/components/mediators/machine-learner/org.wso2.carbon.mediator.machinelearner/src/main/java/org/wso2/carbon/mediator/machinelearner/xml/MachineLearnerMediatorFactory.java Thanks On Fri, Mar 27, 2015 at 3:20 PM, Chanaka Fernando <[email protected]> wrote: > Hi Manorama, > > If you could share the code you have written for this mediator may be we > can help. > > > Thanks, > Chanaka > > On Fri, Mar 27, 2015 at 3:04 PM, Isuru Udana <[email protected]> wrote: > >> Hi Manorama, >> >> This could be due to a bundle/service activation order issue. Could be >> ESB is starting up and deploying services, before activating your component >> MLModelHandler. >> >> On Fri, Mar 27, 2015 at 8:38 AM, Manorama Perera <[email protected]> >> wrote: >> >>> 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 >>> [email protected] >>> http://wso2.org/cgi-bin/mailman/listinfo/dev >>> >>> >> >> >> -- >> *Isuru Udana* >> Senior >> *Software Engineer* >> WSO2 Inc.; http://wso2.com >> email: [email protected] cell: +94 77 3791887 >> blog: http://mytecheye.blogspot.com/ >> twitter: http://twitter.com/isudana >> >> _______________________________________________ >> Dev mailing list >> [email protected] >> http://wso2.org/cgi-bin/mailman/listinfo/dev >> >> > > > -- > -- > Chanaka Fernando > Technical Lead > WSO2, Inc.; http://wso2.com > lean.enterprise.middleware > > mobile: +94 773337238 > Blog : http://soatutorials.blogspot.com > LinkedIn:http://www.linkedin.com/pub/chanaka-fernando/19/a20/5b0 > Twitter:https://twitter.com/chanakaudaya > Wordpress:http://chanakaudaya.wordpress.com > > > > -- Manorama Perera Software Engineer WSO2, Inc.; http://wso2.com/ Mobile : +94716436216
_______________________________________________ Dev mailing list [email protected] http://wso2.org/cgi-bin/mailman/listinfo/dev
