Hi, With the help of sample servlet provided by Nipuni, I was able to create a servlet web-app to get tenant Ghost deployment information without the NullPointException. With further analysis of my REST web-service web-app, I found that a wrong maven dependency is causing this problem.
wrong dependency: *<groupId>org.apache.tomcat</groupId>* *<artifactId>tomcat-catalina</artifactId>* correct dependency: *<groupId>org.apache.httpcomponents</groupId>* *<artifactId>httpcore</artifactId>* Thank you all for your help. Thanks and Best Regards, Saneth Dharmakeerthi Senior Software Engineer WSO2, Inc. Mobile: +94772325511 On Wed, Jan 7, 2015 at 9:27 AM, Saneth Dharmakeerthi <[email protected]> wrote: > Hi Sameera, > > With the ConfigurationContextService also getting the same error > > Thanks and Best Regards, > > Saneth Dharmakeerthi > Senior Software Engineer > WSO2, Inc. > Mobile: +94772325511 > > On Tue, Jan 6, 2015 at 5:03 PM, Sameera Jayasoma <[email protected]> wrote: > >> Hi Saneth, >> >> >> >> On Mon, Jan 5, 2015 at 6:49 PM, Saneth Dharmakeerthi <[email protected]> >> wrote: >> >>> Hi All >>> >>> I am getting NullPointerException when executing the following line in a >>> web-app running on wso2as-6.0.0-SNAPSHOT server. >>> >>> Map<String, ConfigurationContext> tenantConfigContexts = >>> (Map<String, ConfigurationContext>) >>> TenantAxisUtils.getTenantConfigurationContexts( (ConfigurationContext) >>> >>> *PrivilegedCarbonContext.getThreadLocalCarbonContext().getOSGiService(TenantMgtServiceComponent.class,null));* >>> >>> Exception: >>> >>> java.lang.NullPointerException >>> >>> org.wso2.carbon.context.CarbonContext.createFilter(CarbonContext.java:418)* >>> >>> org.wso2.carbon.context.PrivilegedCarbonContext.getOSGiService(PrivilegedCarbonContext.java:362)* >>> org.wso2.qqa.tenant.TenantInfoService.getItem(TenantInfoService.java:31) >>> sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) >>> >>> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) >>> >>> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) >>> java.lang.reflect.Method.invoke(Method.java:597) >>> >>> com.sun.jersey.spi.container.JavaMethodInvokerFactory$1.invoke(JavaMethodInvokerFactory.java:60) >>> >>> com.sun.jersey.server.impl.model.method.dispatch.AbstractResourceMethodDispatchProvider$ResponseOutInvoker._dispatch(AbstractResourceMethodDispatchProvider.java:205) >>> >>> com.sun.jersey.server.impl.model.method.dispatch.ResourceJavaMethodDispatcher.dispatch(ResourceJavaMethodDispatcher.java:75) >>> >>> com.sun.jersey.server.impl.uri.rules.HttpMethodRule.accept(HttpMethodRule.java:288) >>> >>> com.sun.jersey.server.impl.uri.rules.RightHandPathRule.accept(RightHandPathRule.java:147) >>> >>> com.sun.jersey.server.impl.uri.rules.ResourceClassRule.accept(ResourceClassRule.java:108) >>> >>> com.sun.jersey.server.impl.uri.rules.RightHandPathRule.accept(RightHandPathRule.java:147) >>> >>> com.sun.jersey.server.impl.uri.rules.RootResourceClassesRule.accept(RootResourceClassesRule.java:84) >>> >>> com.sun.jersey.server.impl.application.WebApplicationImpl._handleRequest(WebApplicationImpl.java:1469) >>> >>> com.sun.jersey.server.impl.application.WebApplicationImpl._handleRequest(WebApplicationImpl.java:1400) >>> >>> com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:1349) >>> >>> com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:1339) >>> >>> com.sun.jersey.spi.container.servlet.WebComponent.service(WebComponent.java:416) >>> >>> com.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:537) >>> >>> com.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:699) >>> javax.servlet.http.HttpServlet.service(HttpServlet.java:727) >>> >>> I also added the carboncontext-osgi-services.properties as following >>> >>> *osgi.service.1 = >>> org.wso2.carbon.tenant.mgt.internal.TenantMgtServiceComponent* >>> >>> >> I guess you are using the wrong service name here. You need to use the >> ConfigurationContextService class name. >> >> Thanks, >> Sameera. >> >> >>> Appreciate your thoughts on what could have made this gone wrong? >>> >>> >>> >>> Thanks and Best Regards, >>> >>> Saneth Dharmakeerthi >>> Senior Software Engineer >>> WSO2, Inc. >>> Mobile: +94772325511 >>> >> >> >> >> -- >> Sameera Jayasoma, >> Software Architect, >> >> WSO2, Inc. (http://wso2.com) >> email: [email protected] >> blog: http://sameera.adahas.org >> twitter: https://twitter.com/sameerajayasoma >> flickr: http://www.flickr.com/photos/sameera-jayasoma/collections >> Mobile: 0094776364456 >> >> Lean . Enterprise . Middleware >> >> >
_______________________________________________ Dev mailing list [email protected] http://wso2.org/cgi-bin/mailman/listinfo/dev
