Hi Devs,
After the code review, Niranjan and myself debugged the code to find a fix
for this issue. This issue is occurring due to unavailability of
ElementQname in mainOutMsgContext.getAxisOperation().getMessage and
unavailability of the schema. Schemas are used by only JsonFormatters.
In the code review, there were some suggestions to check the schema in
mainInMsgContext.
we found that targetNamespace is set as "*http://ws.apache.org/axis2
<http://ws.apache.org/axis2>*" in both *mainInMsgContext*, and
*mainOutMsgContext*. but the actual targetnamespace should be like
"*http://ws.wso2.org/dataservice
<http://ws.wso2.org/dataservice>*". both of these assigning will be done in
AbstractDispatcher line#94 axisService = findService(msgctx);
We found that the targetNamespace of *tenantOutMsgContext* is set correctly.
Therefore we have done below changes to fix the issue in
MultitenantMessageReceiver -line#419
mainOutMsgContext.getAxisOperation().getMessage(WSDLConstants.MESSAGE_LABEL_OUT_VALUE).setElementQName(
tenantOutMsgContext.getAxisOperation().getMessage(WSDLConstants.MESSAGE_LABEL_OUT_VALUE)
.getElementQName());
mainOutMsgContext.getAxisService().addSchema(tenantOutMsgContext.getAxisService().getSchema());
After the above changes It works fine for GET Method in tenant mode and
super tenant mode.
but when I do testing for POST method. It works fine, when there isn't a
response from the data service. like a request for insert query without
expecting request status or return generated key. because It doesn't have
to send response using json formatters.
but when I try to get a response like request status or return generated
key using POST method. I found following null pointer exception in dss log.
Thanks,
Madhawa
On Mon, May 25, 2015 at 12:05 PM, Madhawa Gunasekara <[email protected]>
wrote:
> Please find the public jira [1] for this issue. and the patch.
>
> [1] https://wso2.org/jira/browse/DS-879
>
>
> On Mon, May 25, 2015 at 11:49 AM, Madhawa Gunasekara <[email protected]>
> wrote:
>
>> Hi all,
>>
>> when we are trying to get JSON response in tenant mode, exception will
>> occur. Therefore I have done some changes to fix the issue.
>>
>> - set the tenantOutMsgContext's AxisOperation to mainOutMsgContext in
>> MultitenantMessageReceiver.java (line# 415-421)
>>
>>
>> - in JsonFormatter.java, I have retrieve the schemas from
>> outMsgCtxt.getAxisOperation().getAxisService().getSchema() (line# 90)
>>
>>
>> I have able to fix the issue doing above changes, But when I try to build
>> the carbon-kernel-patch0010 with test cases. Json related test cases are
>> failing.
>>
>> In test cases, the schema is set to the AxisService and the AxisService
>> is set to MessageContext. therefore null pointer exception will occur.
>> because AxisService can't retrieve by getAxisOperation.getAxisService
>> method.
>>
>> Also I have tried to set the AxisService to mainOutMsgContext in
>> MultitenantMessageReceiver.java then I found null pointer exception in
>> org.wso2.carbon.statistics.module.InOutMEPHandler. I have attached the null
>> pointer exception also
>>
>>
>> as per offline chat with Jayanga, He also couldn't find any wrong in
>> these changes, but He told me to check that, why we need to set
>> AxisOperation, because without setting the AxisOperation, we can't retrieve
>> the elementQname in (JsonFormatter.java -line# 87).
>>
>> and also I couldn't find any setAxisOperation method calls in
>> MessageContext.java file as well.
>>
>>
>> Jayanga mentioned about some life cycles for these AxisOperations and
>> AxisServices, I have no idea about those life cycles.
>> Do these changes will effect those life cycles ?
>>
>> applying above mentioned changes json response works fine, but still Json
>> related test cases are failing.
>>
>>
>> Thanks,
>>
>> Madhawa.
>> --
>> *Madhawa Gunasekara*
>> Software Engineer
>> WSO2 Inc.; http://wso2.com
>> lean.enterprise.middleware
>>
>> mobile: +94 719411002 <+94+719411002>
>> blog: *http://madhawa-gunasekara.blogspot.com
>> <http://madhawa-gunasekara.blogspot.com>*
>> linkedin: *http://lk.linkedin.com/in/mgunasekara
>> <http://lk.linkedin.com/in/mgunasekara>*
>>
>
>
>
> --
> *Madhawa Gunasekara*
> Software Engineer
> WSO2 Inc.; http://wso2.com
> lean.enterprise.middleware
>
> mobile: +94 719411002 <+94+719411002>
> blog: *http://madhawa-gunasekara.blogspot.com
> <http://madhawa-gunasekara.blogspot.com>*
> linkedin: *http://lk.linkedin.com/in/mgunasekara
> <http://lk.linkedin.com/in/mgunasekara>*
>
--
*Madhawa Gunasekara*
Software Engineer
WSO2 Inc.; http://wso2.com
lean.enterprise.middleware
mobile: +94 719411002 <+94+719411002>
blog: *http://madhawa-gunasekara.blogspot.com
<http://madhawa-gunasekara.blogspot.com>*
linkedin: *http://lk.linkedin.com/in/mgunasekara
<http://lk.linkedin.com/in/mgunasekara>*
[2015-05-27 12:33:55,455] ERROR {org.apache.catalina.core.StandardWrapperValve}
- Servlet.service() for servlet [bridgeservlet] in context with path [/] threw
exception
java.lang.NullPointerException
at
org.apache.axis2.json.gson.factory.XmlNodeGenerator.processSchemaList(XmlNodeGenerator.java:70)
at
org.apache.axis2.json.gson.factory.XmlNodeGenerator.getMainXmlNode(XmlNodeGenerator.java:248)
at
org.apache.axis2.json.gson.GsonXMLStreamWriter.process(GsonXMLStreamWriter.java:171)
at
org.apache.axis2.json.gson.GsonXMLStreamWriter.writeStartDocument(GsonXMLStreamWriter.java:707)
at
org.apache.axis2.json.gson.JsonFormatter.writeTo(JsonFormatter.java:96)
at
org.apache.axis2.transport.http.CommonsHTTPTransportSender.sendUsingOutputStream(CommonsHTTPTransportSender.java:411)
at
org.apache.axis2.transport.http.CommonsHTTPTransportSender.invoke(CommonsHTTPTransportSender.java:288)
at org.apache.axis2.engine.AxisEngine.send(AxisEngine.java:442)
at
org.apache.axis2.receivers.AbstractInOutSyncMessageReceiver.invokeBusinessLogic(AbstractInOutSyncMessageReceiver.java:45)
at
org.apache.axis2.receivers.AbstractMessageReceiver.receive(AbstractMessageReceiver.java:110)
at org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:180)
at
org.apache.axis2.transport.http.util.RESTUtil.invokeAxisEngine(RESTUtil.java:144)
at
org.apache.axis2.transport.http.util.RESTUtil.processXMLRequest(RESTUtil.java:89)
at
org.apache.axis2.transport.http.AxisServlet$RestRequestProcessor.processXMLRequest(AxisServlet.java:826)
at
org.apache.axis2.transport.http.AxisServlet.doPost(AxisServlet.java:227)
at
org.wso2.carbon.core.transports.CarbonServlet.doPost(CarbonServlet.java:231)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:755)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:848)
at
org.eclipse.equinox.http.servlet.internal.ServletRegistration.service(ServletRegistration.java:61)
at
org.eclipse.equinox.http.servlet.internal.ProxyServlet.processAlias(ProxyServlet.java:128)
at
org.eclipse.equinox.http.servlet.internal.ProxyServlet.service(ProxyServlet.java:68)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:848)
at
org.wso2.carbon.tomcat.ext.servlet.DelegationServlet.service(DelegationServlet.java:68)
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
at
org.wso2.carbon.tomcat.ext.filter.CharacterSetFilter.doFilter(CharacterSetFilter.java:61)
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:222)
at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:123)
at
org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472)
at
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:171)
at
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:99)
at
org.wso2.carbon.tomcat.ext.valves.CompositeValve.continueInvocation(CompositeValve.java:178)
at
org.wso2.carbon.tomcat.ext.valves.TomcatValveContainer.invokeValves(TomcatValveContainer.java:49)
at
org.wso2.carbon.tomcat.ext.valves.CompositeValve.invoke(CompositeValve.java:141)
at
org.wso2.carbon.tomcat.ext.valves.CarbonStuckThreadDetectionValve.invoke(CarbonStuckThreadDetectionValve.java:156)
at
org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:936)
at
org.wso2.carbon.tomcat.ext.valves.CarbonContextCreatorValve.invoke(CarbonContextCreatorValve.java:52)
at
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
at
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:407)
at
org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1004)
at
org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:589)
at
org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1653)
at
java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:895)
at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:918)
at java.lang.Thread.run(Thread.java:662)
_______________________________________________
Dev mailing list
[email protected]
http://wso2.org/cgi-bin/mailman/listinfo/dev