Tuesday, September 4, 2018

Probable WSO2 Final Interview Questions

  1. Reference: [Tyler's Blog] https://medium.com/@tylerjewell/thank-you-sanjiva-e63c8b24dff0
  2. 1. Are you a dog or a cat person? Seriously, I am a dog person and curious about those who worship cats.
  3. 2. How did you hear about WSO2 in the first place?
  4. 3. I will make a (usually bad and wrong) guess at the historical relevance and significance of your name and accent. Don’t laugh, but I am curious about where you came from and how you ended up where you are at.
  5. 4. What do you hope will be on your tombstone when you leave this world?
  6. 5. What are legal, ethical, and financial implications of Redis Labs’ alteration of their BSD open source license to create stronger commercial protections? Just kidding, but if you have a point of view, then we really should talk more.
  7. 6. What would you like to know more about our company?
  8. 7. What kind of commitments do you make to improving yourself, your team, and your family? We have a simple performance review process here and it’s focused on how you are working on self-improvement and commitment to self, team, and company. We care deeply about how you are developing yourself in any dimension or aspect of life that matters to you.

  9. Well, regarding question 5, if you have an opinion make sure it is solid and you know the subject that you are talking about!

Friday, August 18, 2017

WSO2 DSS Error Nesting problem | Error while writing to the output stream using JsonWriter

I had several resources and out of all, one gave an error as follows when called via a jaggery application.

TID: [-1234] [] [2017-08-18 06:39:17,622] ERROR {org.wso2.carbon.dataservices.core.description.query.SQLQuery} -  Nesting problem. {org.wso2.carbon.dataservices.core.description.query.SQLQuery}
java.lang.IllegalStateException: Nesting problem.
at com.google.gson.stream.JsonWriter.beforeValue(JsonWriter.java:631)
at com.google.gson.stream.JsonWriter.open(JsonWriter.java:325)
at com.google.gson.stream.JsonWriter.beginObject(JsonWriter.java:308)
at org.apache.axis2.json.gson.GsonXMLStreamWriter.writeStartElement(GsonXMLStreamWriter.java:319)
at org.wso2.carbon.dataservices.core.engine.XMLWriterHelper.writeResultElement(XMLWriterHelper.java:144)
at org.wso2.carbon.dataservices.core.engine.StaticOutputElement.executeElement(StaticOutputElement.java:251)
at org.wso2.carbon.dataservices.core.engine.OutputElement.execute(OutputElement.java:89)
at org.wso2.carbon.dataservices.core.engine.OutputElementGroup.executeElement(OutputElementGroup.java:106)
at org.wso2.carbon.dataservices.core.engine.OutputElement.execute(OutputElement.java:89)
at org.wso2.carbon.dataservices.core.description.query.Query.writeResultEntry(Query.java:440)
at org.wso2.carbon.dataservices.core.description.query.SQLQuery.processPostNormalQuery(SQLQuery.java:823)
at org.wso2.carbon.dataservices.core.description.query.SQLQuery.runPostQuery(SQLQuery.java:2197)
at org.wso2.carbon.dataservices.core.description.query.Query.execute(Query.java:307)
at org.wso2.carbon.dataservices.core.engine.CallQuery.executeElement(CallQuery.java:286)
at org.wso2.carbon.dataservices.core.engine.OutputElement.execute(OutputElement.java:89)
at org.wso2.carbon.dataservices.core.description.resource.Resource.execute(Resource.java:67)
at org.wso2.carbon.dataservices.core.engine.DataService.invoke(DataService.java:585)
at org.wso2.carbon.dataservices.core.engine.DSOMDataSource.execute(DSOMDataSource.java:96)
at org.wso2.carbon.dataservices.core.engine.DSOMDataSource.serialize(DSOMDataSource.java:107)
at org.apache.axiom.om.impl.llom.OMSourcedElementImpl.internalSerialize(OMSourcedElementImpl.java:691)
at org.apache.axiom.om.impl.llom.OMSourcedElementImpl.serializeAndConsume(OMSourcedElementImpl.java:754)
at org.apache.axis2.json.gson.JsonFormatter.writeTo(JsonFormatter.java:100)
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.processURLRequest(RESTUtil.java:139)
at org.apache.axis2.transport.http.AxisServlet$RestRequestProcessor.processURLRequest(AxisServlet.java:843)
at org.wso2.carbon.core.transports.CarbonServlet.handleRestRequest(CarbonServlet.java:303)
at org.wso2.carbon.core.transports.CarbonServlet.doGet(CarbonServlet.java:152)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:620)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:727)
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:727)
at org.wso2.carbon.tomcat.ext.servlet.DelegationServlet.service(DelegationServlet.java:68)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:303)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
at org.wso2.carbon.ui.filters.CSRFPreventionFilter.doFilter(CSRFPreventionFilter.java:88)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
at org.wso2.carbon.ui.filters.CRLFPreventionFilter.doFilter(CRLFPreventionFilter.java:59)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
at org.wso2.carbon.tomcat.ext.filter.CharacterSetFilter.doFilter(CharacterSetFilter.java:61)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:220)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:122)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:504)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:170)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103)
at org.wso2.carbon.tomcat.ext.valves.CompositeValve.continueInvocation(CompositeValve.java:99)
at org.wso2.carbon.tomcat.ext.valves.CarbonTomcatValve$1.invoke(CarbonTomcatValve.java:47)
at org.wso2.carbon.webapp.mgt.TenantLazyLoaderValve.invoke(TenantLazyLoaderValve.java:57)
at org.wso2.carbon.tomcat.ext.valves.TomcatValveContainer.invokeValves(TomcatValveContainer.java:47)
at org.wso2.carbon.tomcat.ext.valves.CompositeValve.invoke(CompositeValve.java:62)
at org.wso2.carbon.tomcat.ext.valves.CarbonStuckThreadDetectionValve.invoke(CarbonStuckThreadDetectionValve.java:159)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:950)
at org.wso2.carbon.tomcat.ext.valves.CarbonContextCreatorValve.invoke(CarbonContextCreatorValve.java:57)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:421)
at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1074)
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:611)
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1739)
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1698)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
at java.lang.Thread.run(Thread.java:745)
TID: [-1234] [] [2017-08-18 06:39:17,624] ERROR {org.wso2.carbon.dataservices.core.engine.DataService} -  DS Fault Message: Error in 'SQLQuery.processPostNormalQuery': Nesting problem._DS Code: DATABASE_ERROR_Source Data Service:-_Name: EngineeringAppDashboard_Location: /EngineeringAppDashboard.dbs_Description: N/A_Default Namespace: http://ws.wso2.org/dataservice_Current Request Name: _get_alldepartmentsinallocations_Current Params: {}_Nested Exception:-_java.lang.IllegalStateException: Nesting problem._ (Sanitized) {org.wso2.carbon.dataservices.core.engine.DataService}
DS Fault Message: Error in 'SQLQuery.processPostNormalQuery': Nesting problem.
DS Code: DATABASE_ERROR
Source Data Service:-
Name: EngineeringAppDashboard
Location: /EngineeringAppDashboard.dbs
Description: N/A
Default Namespace: http://ws.wso2.org/dataservice
Current Request Name: _get_alldepartmentsinallocations
Current Params: {}
Nested Exception:-
java.lang.IllegalStateException: Nesting problem.

at org.wso2.carbon.dataservices.core.description.query.SQLQuery.processPostNormalQuery(SQLQuery.java:829)
at org.wso2.carbon.dataservices.core.description.query.SQLQuery.runPostQuery(SQLQuery.java:2197)
at org.wso2.carbon.dataservices.core.description.query.Query.execute(Query.java:307)
at org.wso2.carbon.dataservices.core.engine.CallQuery.executeElement(CallQuery.java:286)
at org.wso2.carbon.dataservices.core.engine.OutputElement.execute(OutputElement.java:89)
at org.wso2.carbon.dataservices.core.description.resource.Resource.execute(Resource.java:67)
at org.wso2.carbon.dataservices.core.engine.DataService.invoke(DataService.java:585)
at org.wso2.carbon.dataservices.core.engine.DSOMDataSource.execute(DSOMDataSource.java:96)
at org.wso2.carbon.dataservices.core.engine.DSOMDataSource.serialize(DSOMDataSource.java:107)
at org.apache.axiom.om.impl.llom.OMSourcedElementImpl.internalSerialize(OMSourcedElementImpl.java:691)
at org.apache.axiom.om.impl.llom.OMSourcedElementImpl.serializeAndConsume(OMSourcedElementImpl.java:754)
at org.apache.axis2.json.gson.JsonFormatter.writeTo(JsonFormatter.java:100)
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.processURLRequest(RESTUtil.java:139)
at org.apache.axis2.transport.http.AxisServlet$RestRequestProcessor.processURLRequest(AxisServlet.java:843)
at org.wso2.carbon.core.transports.CarbonServlet.handleRestRequest(CarbonServlet.java:303)
at org.wso2.carbon.core.transports.CarbonServlet.doGet(CarbonServlet.java:152)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:620)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:727)
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:727)
at org.wso2.carbon.tomcat.ext.servlet.DelegationServlet.service(DelegationServlet.java:68)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:303)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
at org.wso2.carbon.ui.filters.CSRFPreventionFilter.doFilter(CSRFPreventionFilter.java:88)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
at org.wso2.carbon.ui.filters.CRLFPreventionFilter.doFilter(CRLFPreventionFilter.java:59)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
at org.wso2.carbon.tomcat.ext.filter.CharacterSetFilter.doFilter(CharacterSetFilter.java:61)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:220)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:122)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:504)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:170)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103)
at org.wso2.carbon.tomcat.ext.valves.CompositeValve.continueInvocation(CompositeValve.java:99)
at org.wso2.carbon.tomcat.ext.valves.CarbonTomcatValve$1.invoke(CarbonTomcatValve.java:47)
at org.wso2.carbon.webapp.mgt.TenantLazyLoaderValve.invoke(TenantLazyLoaderValve.java:57)
at org.wso2.carbon.tomcat.ext.valves.TomcatValveContainer.invokeValves(TomcatValveContainer.java:47)
at org.wso2.carbon.tomcat.ext.valves.CompositeValve.invoke(CompositeValve.java:62)
at org.wso2.carbon.tomcat.ext.valves.CarbonStuckThreadDetectionValve.invoke(CarbonStuckThreadDetectionValve.java:159)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:950)
at org.wso2.carbon.tomcat.ext.valves.CarbonContextCreatorValve.invoke(CarbonContextCreatorValve.java:57)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:421)
at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1074)
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:611)
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1739)
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1698)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.IllegalStateException: Nesting problem.
at com.google.gson.stream.JsonWriter.beforeValue(JsonWriter.java:631)
at com.google.gson.stream.JsonWriter.open(JsonWriter.java:325)
at com.google.gson.stream.JsonWriter.beginObject(JsonWriter.java:308)
at org.apache.axis2.json.gson.GsonXMLStreamWriter.writeStartElement(GsonXMLStreamWriter.java:319)
at org.wso2.carbon.dataservices.core.engine.XMLWriterHelper.writeResultElement(XMLWriterHelper.java:144)
at org.wso2.carbon.dataservices.core.engine.StaticOutputElement.executeElement(StaticOutputElement.java:251)
at org.wso2.carbon.dataservices.core.engine.OutputElement.execute(OutputElement.java:89)
at org.wso2.carbon.dataservices.core.engine.OutputElementGroup.executeElement(OutputElementGroup.java:106)
at org.wso2.carbon.dataservices.core.engine.OutputElement.execute(OutputElement.java:89)
at org.wso2.carbon.dataservices.core.description.query.Query.writeResultEntry(Query.java:440)
at org.wso2.carbon.dataservices.core.description.query.SQLQuery.processPostNormalQuery(SQLQuery.java:823)
... 66 more
TID: [-1234] [] [2017-08-18 06:39:17,625] ERROR {org.apache.axis2.transport.http.CommonsHTTPTransportSender} -  Error while writing to the output stream using JsonWriter {org.apache.axis2.transport.http.CommonsHTTPTransportSender}
org.apache.axis2.AxisFault: Error while writing to the output stream using JsonWriter
at org.apache.axis2.json.gson.JsonFormatter.writeTo(JsonFormatter.java:104)
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.processURLRequest(RESTUtil.java:139)
at org.apache.axis2.transport.http.AxisServlet$RestRequestProcessor.processURLRequest(AxisServlet.java:843)
at org.wso2.carbon.core.transports.CarbonServlet.handleRestRequest(CarbonServlet.java:303)
at org.wso2.carbon.core.transports.CarbonServlet.doGet(CarbonServlet.java:152)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:620)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:727)
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:727)
at org.wso2.carbon.tomcat.ext.servlet.DelegationServlet.service(DelegationServlet.java:68)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:303)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
at org.wso2.carbon.ui.filters.CSRFPreventionFilter.doFilter(CSRFPreventionFilter.java:88)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
at org.wso2.carbon.ui.filters.CRLFPreventionFilter.doFilter(CRLFPreventionFilter.java:59)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
at org.wso2.carbon.tomcat.ext.filter.CharacterSetFilter.doFilter(CharacterSetFilter.java:61)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:220)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:122)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:504)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:170)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103)
at org.wso2.carbon.tomcat.ext.valves.CompositeValve.continueInvocation(CompositeValve.java:99)
at org.wso2.carbon.tomcat.ext.valves.CarbonTomcatValve$1.invoke(CarbonTomcatValve.java:47)
at org.wso2.carbon.webapp.mgt.TenantLazyLoaderValve.invoke(TenantLazyLoaderValve.java:57)
at org.wso2.carbon.tomcat.ext.valves.TomcatValveContainer.invokeValves(TomcatValveContainer.java:47)
at org.wso2.carbon.tomcat.ext.valves.CompositeValve.invoke(CompositeValve.java:62)
at org.wso2.carbon.tomcat.ext.valves.CarbonStuckThreadDetectionValve.invoke(CarbonStuckThreadDetectionValve.java:159)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:950)
at org.wso2.carbon.tomcat.ext.valves.CarbonContextCreatorValve.invoke(CarbonContextCreatorValve.java:57)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:421)
at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1074)
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:611)
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1739)
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1698)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
at java.lang.Thread.run(Thread.java:745)
Caused by: javax.xml.stream.XMLStreamException: DS Fault Message: Error in 'SQLQuery.processPostNormalQuery': Nesting problem.
DS Code: DATABASE_ERROR
Source Data Service:-
Name: EngineeringAppDashboard
Location: /EngineeringAppDashboard.dbs
Description: N/A
Default Namespace: http://ws.wso2.org/dataservice
Current Request Name: _get_alldepartmentsinallocations
Current Params: {}
Nested Exception:-
java.lang.IllegalStateException: Nesting problem.

at org.wso2.carbon.dataservices.core.engine.DSOMDataSource.execute(DSOMDataSource.java:102)
at org.wso2.carbon.dataservices.core.engine.DSOMDataSource.serialize(DSOMDataSource.java:107)
at org.apache.axiom.om.impl.llom.OMSourcedElementImpl.internalSerialize(OMSourcedElementImpl.java:691)
at org.apache.axiom.om.impl.llom.OMSourcedElementImpl.serializeAndConsume(OMSourcedElementImpl.java:754)
at org.apache.axis2.json.gson.JsonFormatter.writeTo(JsonFormatter.java:100)
... 55 more
Caused by: DS Fault Message: Error in 'SQLQuery.processPostNormalQuery': Nesting problem.
DS Code: DATABASE_ERROR
Source Data Service:-
Name: EngineeringAppDashboard
Location: /EngineeringAppDashboard.dbs
Description: N/A
Default Namespace: http://ws.wso2.org/dataservice
Current Request Name: _get_alldepartmentsinallocations
Current Params: {}
Nested Exception:-
java.lang.IllegalStateException: Nesting problem.

at org.wso2.carbon.dataservices.core.description.query.SQLQuery.processPostNormalQuery(SQLQuery.java:829)
at org.wso2.carbon.dataservices.core.description.query.SQLQuery.runPostQuery(SQLQuery.java:2197)
at org.wso2.carbon.dataservices.core.description.query.Query.execute(Query.java:307)
at org.wso2.carbon.dataservices.core.engine.CallQuery.executeElement(CallQuery.java:286)
at org.wso2.carbon.dataservices.core.engine.OutputElement.execute(OutputElement.java:89)
at org.wso2.carbon.dataservices.core.description.resource.Resource.execute(Resource.java:67)
at org.wso2.carbon.dataservices.core.engine.DataService.invoke(DataService.java:585)
at org.wso2.carbon.dataservices.core.engine.DSOMDataSource.execute(DSOMDataSource.java:96)
... 59 more
Caused by: java.lang.IllegalStateException: Nesting problem.
at com.google.gson.stream.JsonWriter.beforeValue(JsonWriter.java:631)
at com.google.gson.stream.JsonWriter.open(JsonWriter.java:325)
at com.google.gson.stream.JsonWriter.beginObject(JsonWriter.java:308)
at org.apache.axis2.json.gson.GsonXMLStreamWriter.writeStartElement(GsonXMLStreamWriter.java:319)
at org.wso2.carbon.dataservices.core.engine.XMLWriterHelper.writeResultElement(XMLWriterHelper.java:144)
at org.wso2.carbon.dataservices.core.engine.StaticOutputElement.executeElement(StaticOutputElement.java:251)
at org.wso2.carbon.dataservices.core.engine.OutputElement.execute(OutputElement.java:89)
at org.wso2.carbon.dataservices.core.engine.OutputElementGroup.executeElement(OutputElementGroup.java:106)
at org.wso2.carbon.dataservices.core.engine.OutputElement.execute(OutputElement.java:89)
at org.wso2.carbon.dataservices.core.description.query.Query.writeResultEntry(Query.java:440)

at org.wso2.carbon.dataservices.core.description.query.SQLQuery.processPostNormalQuery(SQLQuery.java:823)

Issue causing the issue was in output JSON format.
<result outputType="json">
{"departments": 
    {"department": 
        [ 
            {"department": "$department"}
        ] 
    }
}       </result>

I corrected "department" as "departmentName".
<result outputType="json">
{"departments": 
    {"department": 
        [
            {"departmentName": "$departmentName"
        
    }
}       
</result>

Then the issue got solved.
However in both the situations when I called the resource in my browser, I got the results as usual.

Thursday, March 2, 2017

Ballerina 101

In this tutorial you will learn the basic concepts of Ballerina and why we call it Flexible, Powerful and Beautiful. You will also learn to run your ballerina programs in two modes: server and standalone modes with simple examples.

Introduction

Ballerina is a programming language designed from the ground up specifically for integration which allows you to draw code to life. It allows you to connect apps and services to handle all kinds of integration scenarios. Why do we call it Flexible, Powerful and Beautiful?

You can build your integrations by drawing sequence diagrams, or write your code in swagger or in ballerina. You can add plugins and write ballerina code in IntelliJ IDEA[2], Vim[3], Atom[4], Sublime Text 3[5] and more. Therefore it is FLEXIBLE.

Ballerina can handle everything from a simple Hello World program to complex service chaining and content-based routing scenarios. It comes with native support for REST, Swagger, JSON, and XML, and it includes connectors for popular services like Twitter and Facebook. It has an incredibly fast lightweight runtime which can be deployed in a production environment without any development tools. Therefore it is POWERFUL.

The integration code is written for you as you create the diagram in Ballerina Composer.


Cool! isn't it? All you have to do is drag and drop elements needed for your use case onto a canvas who will easily create your integration scenario for you. You can switch between Source view and Design view anytime. Therefore it is BEAUTIFUL.

Key Concepts

Each Ballerina program represents a discrete unit of functionality that performs an integration task. The complexity of the ballerina program is upon your discretion.

You can create your ballerina program in two ways.
1. Server mode: as a service that runs in the Ballerina server and awaits requests over HTTP.
2. Standalone mode: as an executable program that executes a main() function and then exits.

Following are the available constructs you can use [1].

1. Service: When defining a Ballerina program as a service instead of an executable program, the service construct acts as the top-level container that holds all the integration logic and can interact with the rest of the world. Its base path is the context part of the URL that you use when sending requests to the service.

2. Resource: A resource is a single request handler within a service. When you create a service in Ballerina using the visual editor, a default resource is automatically created as well. The resource contains the integration logic.

3. Function: A function is a single operation. Ballerina includes a set of native functions you can call and you can define additional functions within your Ballerina programs.
 The main() function contains the core integration logic when creating an executable program instead of a service. When you run the program, the main() function executes, and then the program terminates. You can define additional functions, connectors, etc. inside the program and call them from main(). See here for a complex example.

4. Worker: A worker is a thread that executes a function.

5. Connector: A connector represents a participant in the integration and is used to interact with an external system or a service you've defined in Ballerina. Ballerina includes a set of standard connectors that allow you to connect to Twitter, Facebook, and more, and you can define additional connectors within your Ballerina programs.

6. Action: An action is an operation you can execute against a connector. It represents a single interaction with a participant of the integration.

See language reference for more information.

Quick Start

1. Download complete ballerina tools package from http://ballerinalang.org/downloads/
2. Unzip it on your computer and lets call it <ballerina_home>
e.g.: /WSO2/ballerina/ballerina-tools-<version>
3. Add <ballerina_home>/bin directory to your $PATH environment variable so that you can run ballerina commands from anywhere.
e.g.: on Mac OS X


export BALLERINA_HOME=/WSO2/ballerina/ballerina-tools-0.8.1
export PATH=$BALLERINA_HOME/bin:$PATH

Run HelloWorld - Standalone Mode

Now we are going to run HelloWorld classical example using a main() function, i.e. in standalone mode as follows.

1. Create /WSO2/ballerina/tutorial/helloWorld directory.
2. In this directory, create the file helloWorld.bal with following contents.


import ballerina.lang.system;

function main (string[] args) {
  system:println("Hello, World!");
}

This is how the famous hello world sample looks like in ballerina programming language!

3. Issue the following command to run the main() function in helloWorld.bal file.
$ ballerina run main helloworld.bal

You can observe the following output in command line.
> Hello, World!

After the HelloWorld program is executed, Ballerina will be stopped. This is useful when you want to execute a program once and then stop as soon as it has finished its job. It runs the main() function of the program you specify and then exits

Run HelloWorld - Server Mode

Here Ballerina will deploy one or more services in the ballerina program that wait for requests.
1. Create the file helloWorldService.bal with following contents.

import ballerina.lang.messages;
@http:BasePath ("/hello")
service helloWorld {

    @http:GET
    resource sayHello (message m) {
        message response = {};
        messages:setStringPayload(response, "Hello, World!");
        reply response;

    }

}

3. Issue the following command to deploy the helloWorld service in helloWorldService.bal file.
$ ballerina run service helloWorldService.bal

You can observe the following output in command line that the service is waiting for requests.
> ballerina: deploying service(s) in 'helloWorldService.bal'
> ballerina: started server connector http-9090

The Ballerina server is available at localhost:9090, and helloWorld service is available at context hello

4. Open another command line window and use the curl client to call helloWorld service as follows.
$ curl -v http://localhost:9090/hello

The service receives the request and executes its logic, printing "Hello, World!" on the command line as follows. 
*   Trying 127.0.0.1...
* Connected to localhost (127.0.0.1) port 9090 (#0)
> GET /hello HTTP/1.1
> Host: localhost:9090
> User-Agent: curl/7.49.1
> Accept: */*
< HTTP/1.1 200 OK
< Content-Type: text/plain
< Content-Length: 13
* Connection #0 to host localhost left intact
Hello, World!

Notice that the Ballerina server is still running in the background, waiting for more requests to serve. 

5. Stop the Ballerina server by pressing Ctrl-C (Command-C). 


Reference:
[1] http://ballerinalang.org/
[2] https://github.com/ballerinalang/plugin-intellij/releases
[3] https://github.com/ballerinalang/plugin-vim/releases
[4] https://github.com/ballerinalang/plugin-atom/releases
[5] https://github.com/ballerinalang/plugin-sublimetext3/releases


Tuesday, February 21, 2017

Ballerina is born!

What is ballerina?
What is ballerinalang?

Ballerina - a new open source programming language that lets you 'draw' code to life!

It is a programming language that lets you create integrations with diagrams.

At WSO2, we’ve created a language where diagrams can be directly turned into code. Developers can click and drag the pieces of a diagram together to describe the workings of a program. Cool! isn't it?

We’re not just targeting efficiency, but also a radical new productivity enhancement for any company. By simplifying the entire process, we’re looking at reducing the amount of work that goes into the making of a program. It’s where we believe the world is headed.

As mentioned by Chanaka [4], there is a gap in the integration space where programmers and architects speaks in different languages and sometimes this resulted in huge losses of time and money. Integration has lot to do with diagrams. Top level people always prefer diagrams than code but programmers do the other way around. We thought of filling this gap with a more modernized programming language.

Ballerina features both textual and graphical syntaxes that uniquely offer the exact same expressive capability and are fully reversible. The textual syntax follows the C/Java heritage while also adopting some aspects from Go. The graphical syntax of Ballerina follows a sequence diagram metaphor. There are no weird syntax exceptions, and everything is derived from a few key language concepts. Additionally, Ballerina follows Java and Go to provide a platform-independent programming model that abstracts programmers from machine-specific details.

We are happy to announce the “Flexible, Powerful, Beautiful” programming language “Ballerina”. Here are the main features of the language in a short list [4].
  • Textual, Visual and Swagger representation of your code.
  • Parallel programming made easier with workers and fork-join.
  • XML, JSON and DataTable as built in data types for easier data handling.
  • Packaging and module system to write, share, distribute code in elegant fashion.
  • Composer (editor) makes it easier to write programs in a more visual manner.
  • Built in debugger and test framework (testerina) makes it easier to develop and test.
Ballerina supports high-performance implementations—including the micro-services and micro-integrations increasingly driving digital products—with low latency, low memory and fast start-up. Notably, common integration capabilities are baked into the Ballerina language. These include deep alignment with HTTP, REST, and Swagger; connectors for both web APIs and non-HTTP APIs; and native support for JSON, XML, data tables, and mapping.

Tryout ballerina and let us know your thoughts on medium, twitter, facebook, slack, google and many other channels.

Ask a question in stackoverflow.

Have fun!

Photo credits: http://ballerinalang.org/


You can find the introduction to Ballerina presentation below presented by Sanjiva at WSO2Con 2017 USA.


Reference: