Re: [Dev] Registry Access Using Carbon Context
Axiom jars are probably packaged inside your webapp. Axiom is also exposed from Carbon. On Mon, Feb 23, 2015 at 6:09 PM, Danushka Fernando wrote: > Seems a class like loading issue. Do you have same class in two places in > the server. > On Feb 23, 2015 3:30 PM, "Pubudu Dodangoda" 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 Provided 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 >> >> > ___ > Dev mailing list > Dev@wso2.org > http://wso2.org/cgi-bin/mailman/listinfo/dev > > -- *Kasun Gajasinghe*Senior Software Engineer, WSO2 Inc. email: kasung AT spamfree wso2.com linked-in: http://lk.linkedin.com/in/gajasinghe blog: http://kasunbg.org ___ Dev mailing list Dev@wso2.org http://wso2.org/cgi-bin/mailman/listinfo/dev
Re: [Dev] Registry Access Using Carbon Context
Seems a class like loading issue. Do you have same class in two places in the server. On Feb 23, 2015 3:30 PM, "Pubudu Dodangoda" 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 Provided 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 > > ___ Dev mailing list Dev@wso2.org http://wso2.org/cgi-bin/mailman/listinfo/dev
Re: [Dev] Registry Access Using Carbon Context
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 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 Provided 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
[Dev] Registry Access Using Carbon Context
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 Provided 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