Hi Pubudu, Use CarbonContext.getThreadLocalCarbonContext(); instead of CarbonContext. getCurrentContext();. org.wso2.carbon.context module is not using anymore.
See following links [1] and [2] for more information: [1] http://wso2-oxygen-tank.10903.n7.nabble.com/Dev-org-wso2-carbon-context-4-2-0-JAR-missing-in-Nexus-td89619.html [2] https://docs.wso2.com/display/Carbon420/CarbonContext+API#CarbonContextAPI-getThreadLocalCarbonContext() Thanks! Best Regards, On Mon, Feb 23, 2015 at 3:30 PM, Pubudu Dodangoda <pubu...@wso2.com> wrote: > I am trying to access the local registry (to save and to get a resource) > > I get the following exception, > > java.lang.RuntimeException: org.apache.cxf.interceptor.Fault: loader > constraint violation: when resolving method > "org.apache.axis2.util.XMLUtils.toOM(Lorg/w3c/dom/Element;)Lorg/apache/axiom/om/OMElement;" > the class loader (instance of > org/wso2/carbon/webapp/mgt/loader/CarbonWebappClassLoader) of the current > class, org/wso2/carbon/utils/multitenancy/CarbonContextHolder, and the > class loader (instance of > org/eclipse/osgi/internal/baseadaptor/DefaultClassLoader) for resolved > class, org/apache/axis2/util/XMLUtils, have different Class objects for the > type MElement; used in the signature > > Last time when I got this exception, adding <scope>Provided</scope> to the > respective artifact dependency solved the problem > But here, when I do that I get a NoSuchMethod Exception for the line where > the Carbon Context is defined > > > Notes- > I used the following code for registry access > > CarbonContext cctx= CarbonContext.getCurrentContext(); > Registry registry=cctx.getRegistry(RegistryType.LOCAL_REPOSITORY); > try{ > Resource resource=registry.newResource(); > resource.setContent("Dashboard_Test"); > registry.put("RandomPath", resource); > }catch(RegistryException re){ re.printStackTrace();} > > Thank You > -- > Pubudu Dodangoda > BSc Engineering(Hon's) Undergraduate > Department of Computer Science Engineering > University of Moratuwa > 0716053681 / 0775192994 > > _______________________________________________ > Dev mailing list > Dev@wso2.org > http://wso2.org/cgi-bin/mailman/listinfo/dev > > -- Chathura Priyankara Software Engineer | WSO2 Inc. Mobile : +94718795340 Blog : www.codeoncloud.blogspot.com
_______________________________________________ Dev mailing list Dev@wso2.org http://wso2.org/cgi-bin/mailman/listinfo/dev