Wednesday, May 6, 2015

WSO2 ESB java.lang.NullPointerException: Tenant domain has not been set in CarbonContext

When I try to invoke the secure service for NHTTP or PassThrough Transport I'm getting the following error.
WSO2 ESB wirelog is attached herewith for the reference.

[2015-05-05 11:42:11,044] DEBUG - wire >> "POST /services/StockQuoteProxy.StockQuoteProxyHttpsSoap11Endpoint HTTP/1.1[\r][\n]"
[2015-05-05 11:42:11,045] DEBUG - wire >> "Accept-Encoding: gzip,deflate[\r][\n]"
[2015-05-05 11:42:11,045] DEBUG - wire >> "Content-Type: text/xml;charset=UTF-8[\r][\n]"
[2015-05-05 11:42:11,045] DEBUG - wire >> "SOAPAction: "urn:getQuote"[\r][\n]"
[2015-05-05 11:42:11,045] DEBUG - wire >> "Content-Length: 416[\r][\n]"
[2015-05-05 11:42:11,046] DEBUG - wire >> "Host: 10.0.2.15:8243[\r][\n]"
[2015-05-05 11:42:11,046] DEBUG - wire >> "Connection: Keep-Alive[\r][\n]"
[2015-05-05 11:42:11,046] DEBUG - wire >> "User-Agent: Apache-HttpClient/4.1.1 (java 1.5)[\r][\n]"
[2015-05-05 11:42:11,046] DEBUG - wire >> "[\r][\n]"
[2015-05-05 11:42:11,046] DEBUG - wire >> "[\n]"
[2015-05-05 11:42:11,046] DEBUG - wire >> "   [\n]"
[2015-05-05 11:42:11,046] DEBUG - wire >> "   [\n]"
[2015-05-05 11:42:11,046] DEBUG - wire >> "      [\n]"
[2015-05-05 11:42:11,046] DEBUG - wire >> "         [\n]"
[2015-05-05 11:42:11,047] DEBUG - wire >> "         [\n]"
[2015-05-05 11:42:11,047] DEBUG - wire >> "            [\n]"
[2015-05-05 11:42:11,047] DEBUG - wire >> "            HTS[\n]"
[2015-05-05 11:42:11,047] DEBUG - wire >> "         [\n]"
[2015-05-05 11:42:11,047] DEBUG - wire >> "      [\n]"
[2015-05-05 11:42:11,047] DEBUG - wire >> "   [\n]"
[2015-05-05 11:42:11,047] DEBUG - wire >> ""
[2015-05-05 11:42:11,058] ERROR - ServerWorker Error processing POST request 
java.lang.NullPointerException: Tenant domain has not been set in CarbonContext
 at org.wso2.carbon.caching.impl.CacheManagerFactoryImpl.getCacheManager(CacheManagerFactoryImpl.java:79)
 at org.wso2.carbon.security.pox.POXSecurityHandler.getPOXCache(POXSecurityHandler.java:383)
 at org.wso2.carbon.security.pox.POXSecurityHandler.invoke(POXSecurityHandler.java:179)
 at org.apache.axis2.engine.Phase.invokeHandler(Phase.java:340)
 at org.apache.axis2.engine.Phase.invoke(Phase.java:313)
 at org.apache.axis2.engine.AxisEngine.invoke(AxisEngine.java:261)
 at org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:167)
 at org.apache.axis2.transport.http.HTTPTransportUtils.processHTTPPostRequest(HTTPTransportUtils.java:172)
 at org.apache.synapse.transport.nhttp.ServerWorker.processEntityEnclosingMethod(ServerWorker.java:459)
 at org.apache.synapse.transport.nhttp.ServerWorker.run(ServerWorker.java:279)
 at org.apache.axis2.transport.base.threads.NativeWorkerPool$1.run(NativeWorkerPool.java:172)
 at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
 at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
 at java.lang.Thread.run(Thread.java:662)
[2015-05-05 11:42:11,069] DEBUG - wire << "HTTP/1.1 500 Internal Server Error[\r][\n]"
[2015-05-05 11:42:11,069] DEBUG - wire << "Content-Type: text/xml; charset=UTF-8[\r][\n]"
[2015-05-05 11:42:11,069] DEBUG - wire << "Date: Tue, 05 May 2015 06:12:11 GMT[\r][\n]"
[2015-05-05 11:42:11,069] DEBUG - wire << "Transfer-Encoding: chunked[\r][\n]"
[2015-05-05 11:42:11,069] DEBUG - wire << "Connection: Keep-Alive[\r][\n]"

Workaround for this issue is as follows.
Alter axis2.xml i.e move CarbonContentConfigurator as first entry in Transport.
<phase name="Transport">
<handler name="CarbonContentConfigurator"
class="org.wso2.carbon.mediation.initializer.handler.CarbonContextConfigurator"/>

Tested in ESB 4.8.0

No comments:

Post a Comment