To add to what Amal has explained, in java, the compiler will create a default(with no arguments) constructor if you have not specified any constructor. However if you have created a parameterized constructor it will not create any default constructor. Combine that with the java beans convention, you have the answer. :)
Thanks. /Gayashan On Fri, Feb 20, 2015 at 3:01 AM, Thusitha Thilina Dayaratne < [email protected]> wrote: > Hi Amal, > > Thanks for the explanation. That really helped. > > Regards > /Thusitha > > On Fri, Feb 20, 2015 at 4:07 AM, Amal Gunatilake <[email protected]> wrote: > >> Hi Thusitha, >> >> First of all Axis2 supports JavaBeans and therefore you need to adhere to >> JavaBeans standards when using it. Please have a look at JavaBeans >> Conventions in [1] >> <http://en.wikipedia.org/wiki/JavaBeans#JavaBean_conventions>. There it >> states "The class must have a public default constructor >> <http://en.wikipedia.org/wiki/Default_constructor> (with no arguments). >> This allows easy instantiation within editing and activation frameworks." >> >> I hope this answers your both questions. :) >> >> [1] http://en.wikipedia.org/wiki/JavaBeans#JavaBean_conventions >> >> Thank you, >> Amal. >> >> On Fri, Feb 20, 2015 at 1:54 AM, Thusitha Thilina Dayaratne < >> [email protected]> wrote: >> >>> Hi, >>> >>> I tried to invoke the add method using the SoapUI. But I got a Soap >>> fault. >>> In my Item class constructor is in *public Item(int id, String name, >>> float price)* I didn't had a default no arg constructor in the class. >>> When I put the default constructor to the item class everything works fine. >>> >>> I have few points that I like to get clarify >>> >>> *1. *When I didn't had the default constructor and trying to create an >>> Item from the jsp with custom constructor as Item item2 = new Item(12, >>> "Custom >>> Item", 125.30); >>> I got following compilation error. >>> >>>> >>>> *PWC6199: Generated servlet error:**The constructor Item(int, String, >>>> double) is undefined* >>> >>> >>> But I'm able to create Item instance as Item item2 = new Item(); and >>> then set the values using setters. >>> Is this the expected outcome when generating the stub from WSDL2Java ? >>> >>> *2. *Should we always specify the default no args constructor, if we >>> overload the constructor? >>> >>> Best Regards >>> /Thusitha >>> >>> >>> On Thu, Feb 19, 2015 at 4:52 PM, Thusitha Thilina Dayaratne < >>> [email protected]> wrote: >>> >>>> Hi Amal, Gayashan, >>>> >>>> Thanks for your responses. I will try out your suggestions and see if I >>>> will be able to get it solve. >>>> >>>> >>>> Regards >>>> /Thusitha >>>> >>>> On Thu, Feb 19, 2015 at 3:42 PM, Gayashan Amarasinghe < >>>> [email protected]> wrote: >>>> >>>>> Hi Thusitha, >>>>> >>>>> Here you are calling the service via client who calls the service >>>>> stub. In that case the item pojo you are trying to insert should be the >>>>> same object as the one in the WSDL contract. Can you check if it's the >>>>> same >>>>> object? >>>>> >>>>> Thanks. >>>>> /Gayashan >>>>> >>>>> On Thu, Feb 19, 2015 at 9:45 AM, Thusitha Thilina Dayaratne < >>>>> [email protected]> wrote: >>>>> >>>>>> Hi, >>>>>> >>>>>> I'm trying to create a Carbon component based on the [1]. I was able >>>>>> to get the list of orders successfully. But when I'm trying to add a new >>>>>> Order, I'm getting an Exception >>>>>> Here is the stack-trace. >>>>>> >>>>>> >>>>>>> org.apache.axis2.AxisFault: >>>>>>> org.wso2.training.carbon.order.mgt.data.Item >>>>>>> at >>>>>>> org.apache.axis2.util.Utils.getInboundFaultFromMessageContext(Utils.java:531) >>>>>>> at >>>>>>> org.apache.axis2.description.OutInAxisOperationClient.handleResponse(OutInAxisOperation.java:370) >>>>>>> at >>>>>>> org.apache.axis2.description.OutInAxisOperationClient.send(OutInAxisOperation.java:445) >>>>>>> at >>>>>>> org.apache.axis2.description.OutInAxisOperationClient.executeImpl(OutInAxisOperation.java:225) >>>>>>> at >>>>>>> org.apache.axis2.client.OperationClient.execute(OperationClient.java:149) >>>>>>> at >>>>>>> org.wso2.training.carbon.order.mgt.stub.OrderManagerStub.addOrder(OrderManagerStub.java:736) >>>>>>> at >>>>>>> org.wso2.training.carbon.order.mgt.ui.OrderManagerClient.addOrder(OrderManagerClient.java:67) >>>>>>> at >>>>>>> org.apache.jsp.order_002dmgt.index_jsp._jspService(org.apache.jsp.order_002dmgt.index_jsp:100) >>>>>>> at >>>>>>> org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:111) >>>>>>> at javax.servlet.http.HttpServlet.service(HttpServlet.java:848) >>>>>>> at >>>>>>> org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:403) >>>>>>> at >>>>>>> org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:492) >>>>>>> at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:378) >>>>>>> at javax.servlet.http.HttpServlet.service(HttpServlet.java:848) >>>>>>> at org.wso2.carbon.ui.JspServlet.service(JspServlet.java:155) >>>>>>> at >>>>>>> org.wso2.carbon.ui.TilesJspServlet.service(TilesJspServlet.java:80) >>>>>>> at javax.servlet.http.HttpServlet.service(HttpServlet.java:848) >>>>>>> at >>>>>>> org.eclipse.equinox.http.helper.ContextPathServletAdaptor.service(ContextPathServletAdaptor.java:37) >>>>>>> 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.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:749) >>>>>>> at >>>>>>> org.apache.catalina.core.ApplicationDispatcher.doInclude(ApplicationDispatcher.java:605) >>>>>>> at >>>>>>> org.apache.catalina.core.ApplicationDispatcher.include(ApplicationDispatcher.java:544) >>>>>>> at >>>>>>> org.eclipse.equinox.http.servlet.internal.RequestDispatcherAdaptor.include(RequestDispatcherAdaptor.java:37) >>>>>>> at >>>>>>> org.eclipse.equinox.http.helper.ContextPathServletAdaptor$RequestDispatcherAdaptor.include(ContextPathServletAdaptor.java:369) >>>>>>> at >>>>>>> org.apache.jasper.runtime.JspRuntimeLibrary.include(JspRuntimeLibrary.java:1015) >>>>>>> at >>>>>>> org.apache.jasper.runtime.PageContextImpl.include(PageContextImpl.java:700) >>>>>>> at sun.reflect.GeneratedMethodAccessor42.invoke(Unknown Source) >>>>>>> at >>>>>>> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) >>>>>>> at java.lang.reflect.Method.invoke(Method.java:597) >>>>>>> at org.apache.tiles.jsp.context.JspUtil.doInclude(JspUtil.java:87) >>>>>>> at >>>>>>> org.apache.tiles.jsp.context.JspTilesRequestContext.include(JspTilesRequestContext.java:88) >>>>>>> at >>>>>>> org.apache.tiles.jsp.context.JspTilesRequestContext.dispatch(JspTilesRequestContext.java:82) >>>>>>> at >>>>>>> org.apache.tiles.impl.BasicTilesContainer.render(BasicTilesContainer.java:465) >>>>>>> at >>>>>>> org.apache.tiles.jsp.taglib.InsertAttributeTag.render(InsertAttributeTag.java:140) >>>>>>> at >>>>>>> org.apache.tiles.jsp.taglib.InsertAttributeTag.render(InsertAttributeTag.java:117) >>>>>>> at >>>>>>> org.apache.tiles.jsp.taglib.RenderTagSupport.execute(RenderTagSupport.java:171) >>>>>>> at >>>>>>> org.apache.tiles.jsp.taglib.RoleSecurityTagSupport.doEndTag(RoleSecurityTagSupport.java:75) >>>>>>> at >>>>>>> org.apache.tiles.jsp.taglib.ContainerTagSupport.doEndTag(ContainerTagSupport.java:80) >>>>>>> at >>>>>>> org.apache.jsp.admin.layout.template_jsp._jspx_meth_tiles_insertAttribute_7(org.apache.jsp.admin.layout.template_jsp:603) >>>>>>> at >>>>>>> org.apache.jsp.admin.layout.template_jsp._jspService(org.apache.jsp.admin.layout.template_jsp:335) >>>>>>> at >>>>>>> org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:111) >>>>>>> at javax.servlet.http.HttpServlet.service(HttpServlet.java:848) >>>>>>> at >>>>>>> org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:403) >>>>>>> at >>>>>>> org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:492) >>>>>>> at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:378) >>>>>>> at javax.servlet.http.HttpServlet.service(HttpServlet.java:848) >>>>>>> at org.wso2.carbon.ui.JspServlet.service(JspServlet.java:155) >>>>>>> at >>>>>>> org.wso2.carbon.ui.TilesJspServlet.service(TilesJspServlet.java:80) >>>>>>> at javax.servlet.http.HttpServlet.service(HttpServlet.java:848) >>>>>>> at >>>>>>> org.eclipse.equinox.http.helper.ContextPathServletAdaptor.service(ContextPathServletAdaptor.java:37) >>>>>>> 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.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:749) >>>>>>> at >>>>>>> org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:487) >>>>>>> at >>>>>>> org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:412) >>>>>>> at >>>>>>> org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:339) >>>>>>> at >>>>>>> org.eclipse.equinox.http.servlet.internal.RequestDispatcherAdaptor.forward(RequestDispatcherAdaptor.java:30) >>>>>>> at >>>>>>> org.eclipse.equinox.http.helper.ContextPathServletAdaptor$RequestDispatcherAdaptor.forward(ContextPathServletAdaptor.java:362) >>>>>>> at >>>>>>> org.apache.tiles.servlet.context.ServletTilesRequestContext.forward(ServletTilesRequestContext.java:198) >>>>>>> at >>>>>>> org.apache.tiles.servlet.context.ServletTilesRequestContext.dispatch(ServletTilesRequestContext.java:185) >>>>>>> at >>>>>>> org.apache.tiles.impl.BasicTilesContainer.render(BasicTilesContainer.java:419) >>>>>>> at >>>>>>> org.apache.tiles.impl.BasicTilesContainer.render(BasicTilesContainer.java:370) >>>>>>> at >>>>>>> org.wso2.carbon.ui.action.ActionHelper.render(ActionHelper.java:52) >>>>>>> at >>>>>>> org.wso2.carbon.ui.TilesJspServlet.service(TilesJspServlet.java:101) >>>>>>> at javax.servlet.http.HttpServlet.service(HttpServlet.java:848) >>>>>>> at >>>>>>> org.eclipse.equinox.http.helper.ContextPathServletAdaptor.service(ContextPathServletAdaptor.java:37) >>>>>>> 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.statistics.webapp.RequestIntercepterValve.invoke(RequestIntercepterValve.java:43) >>>>>>> at >>>>>>> org.wso2.carbon.bam.webapp.stat.publisher.WebAppStatisticPublisherValve.invoke(WebAppStatisticPublisherValve.java:104) >>>>>>> at >>>>>>> org.wso2.carbon.tomcat.ext.valves.CompositeValve.continueInvocation(CompositeValve.java:178) >>>>>>> at >>>>>>> org.wso2.carbon.tomcat.ext.valves.CarbonTomcatValve$1.invoke(CarbonTomcatValve.java:47) >>>>>>> at >>>>>>> org.wso2.carbon.webapp.mgt.TenantLazyLoaderValve.invoke(TenantLazyLoaderValve.java:56) >>>>>>> at >>>>>>> org.wso2.carbon.tomcat.ext.valves.TomcatValveContainer.invokeValves(TomcatValveContainer.java:47) >>>>>>> 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) >>>>>> >>>>>> >>>>>> What could be the possible reason for getting this sort of Exception? >>>>>> >>>>>> [1] - >>>>>> http://wso2.com/library/tutorials/2014/03/how-to-write-a-wso2-carbon-component/ >>>>>> >>>>>> Thanks >>>>>> -- >>>>>> Thusitha Dayaratne >>>>>> Software Engineer | WSO2 Inc >>>>>> >>>>>> Email [email protected] >>>>>> Mobile +94712756809 >>>>>> Blog alokayasoya.blogspot.com >>>>>> >>>>>> >>>>>> _______________________________________________ >>>>>> Dev mailing list >>>>>> [email protected] >>>>>> http://wso2.org/cgi-bin/mailman/listinfo/dev >>>>>> >>>>>> >>>>> >>>>> >>>>> -- >>>>> *Gayashan Amarasinghe* >>>>> Software Engineer | Platform TG >>>>> WSO2, Inc. | http://wso2.com >>>>> lean. enterprise. middleware >>>>> >>>>> Mobile : +94718314517 >>>>> Blog : gayashan-a.blogspot.com >>>>> >>>> >>>> >>>> >>>> -- >>>> Thusitha Dayaratne >>>> Software Engineer | WSO2 Inc >>>> >>>> Email [email protected] >>>> Mobile +94712756809 >>>> Blog alokayasoya.blogspot.com >>>> >>>> >>> >>> >>> -- >>> Thusitha Dayaratne >>> Software Engineer | WSO2 Inc >>> >>> Email [email protected] >>> Mobile +94712756809 >>> Blog alokayasoya.blogspot.com >>> >>> >> >> >> -- >> Kind regards, >> >> *Amal Gunatilake* >> Software Engineer >> WSO2 Inc.; http://wso2.com >> lean.enterprise.middleware >> > > > > -- > Thusitha Dayaratne > Software Engineer | WSO2 Inc > > Email [email protected] > Mobile +94712756809 > Blog alokayasoya.blogspot.com > > -- *Gayashan Amarasinghe* Software Engineer | Platform TG WSO2, Inc. | http://wso2.com lean. enterprise. middleware Mobile : +94718314517 Blog : gayashan-a.blogspot.com
_______________________________________________ Dev mailing list [email protected] http://wso2.org/cgi-bin/mailman/listinfo/dev
