Hi Martin,

You need to make sure when adding a new property to a Autoscale policy in
autoscaling component whether following locations got updated:

- Autoscaler component needs to be updated in order to have the policy with
new properties
- Rest endpoint bean classes need to be updated in order to do the
conversion when you deploy the policy
- cli bean classes need to updated in order to view the correct policy via
cli

Hope this helps you to update the relevant places.

Thanks,
Reks




On Thu, Apr 10, 2014 at 4:36 PM, Martin Eppel (meppel) <[email protected]>wrote:

>  One more thing, I noticed there is an extra AutoscalePolicy.java file:
>
>
>
>
> ./components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/beans/autoscaler/policy/autoscale/AutoscalePolicy.java
>
>
>
> Does the new property have to be added there as well ?
>
>
>
> *From:* Martin Eppel (meppel)
> *Sent:* Thursday, April 10, 2014 11:11 AM
> *To:* [email protected]
> *Subject:* RE: Issue with stratos manager / JAXB exception
>
>
>
> Hi Isuru,
>
>
>
> Yes, I did.
>
>
>
> Actually, my property is of complex type, similar to LoadThresholds. One
> thing I don't understand is that the methods in LoadThresholds class don't
> have any body defined (just looks like an interface but is defined as
> class), is there another configuration required ? In my case I had to
> define the getters/ setters to compile the class ? Is there any other
> configuration required for the RestAPI ?
>
>
>
> I also changed
> ./org.apache.stratos.autoscaler.service.stub/target/classes/AutoScalerService.wsdl
> (see below)
>
>
>
>
>
> My bean class:
>
>
>
> (in
> ../org.apache.stratos.rest.endpoint/target/classes/org/apache/stratos/rest/endpoint/bean/autoscaler/policy/autoscale$)
>
>
>
> package org.apache.stratos.rest.endpoint.bean.autoscaler.policy.autoscale;
>
> import javax.xml.bind.annotation.XmlRootElement;
>
>
>
> @XmlRootElement
>
> public class ServiceGroup {
>
>
>
>                 private String id;
>
>                 public String bootDependencies;
>
>
>
>                 public String getId() {
>
>                                 return id;
>
>                 }
>
>                 public void setId(String id) {
>
>                                 this.id = id;
>
>                 }
>
>                 public String getBootDependencies() {
>
>                                 return bootDependencies;
>
>                 }
>
>                 public void setBootDependencies(String bootDependencies) {
>
>                                 this.bootDependencies = bootDependencies;
>
>                 }
>
>
>
> }
>
>
>
> // comparable bean class:
>
> package org.apache.stratos.rest.endpoint.bean.autoscaler.policy.autoscale;
>
>
>
> import javax.xml.bind.annotation.XmlRootElement;
>
>
>
> @XmlRootElement
>
> public class LoadThresholds {
>
>
>
>     public RequestsInFlight requestsInFlight;
>
>
>
>     public MemoryConsumption memoryConsumption;
>
>
>
>     public LoadAverage loadAverage;
>
> }
>
>
>
>
>
> // changes in
> org.apache.stratos.autoscaler.service.stub/target/classes/AutoScalerService.wsdl
>
>
>
> ...
>
>            <xs:complexType name="AutoscalePolicy">
>
>                 <xs:sequence>
>
>                     <xs:element minOccurs="0" name="description"
> nillable="true" type="xs:string"></xs:element>
>
>                     <xs:element minOccurs="0" name="displayName"
> nillable="true" type="xs:string"></xs:element>
>
>                     <xs:element minOccurs="0" name="id" nillable="true"
> type="xs:string"></xs:element>
>
>                     <xs:element minOccurs="0" name="loadThresholds"
> nillable="true" type="ax214:LoadThresholds"></xs:element>
>
>                     <xs:element minOccurs="0" name="serviceGroup"
> nillable="true" type="ax214:ServiceGroup"></xs:element>
>
>                 </xs:sequence>
>
>             </xs:complexType>
>
>             <xs:complexType name="ServiceGroup">
>
>                 <xs:sequence>
>
>                     <xs:element minOccurs="0" name="id" nillable="true"
> type="xs:string"></xs:element>
>
>                     <xs:element minOccurs="0" name="bootDependencies"
> nillable="true" type="xs:string"></xs:element>
>
>                 </xs:sequence>
>
>             </xs:complexType>
>
> ...
>
>
>
> *From:* Isuru Haththotuwa [mailto:[email protected]]
> *Sent:* Wednesday, April 09, 2014 10:35 PM
> *To:* [email protected]
> *Subject:* Re: Issue with stratos manager / JAXB exception
>
>
>
> Hi Martin,
>
>
>
> Did you do the required modifications for the autoscaler policy bean class
> as well? The relevant bean is
> org.apache.stratos.rest.endpoint.bean.autoscaler.policy.autoscale.AutoscalePolicy.
> You will need to add your property to this as well.
>
>
> On Thu, Apr 10, 2014 at 10:42 AM, Martin Eppel (meppel) <[email protected]>
> wrote:
>
> Hi,
>
>
>
> I made some experimental code modification (added a new property to the
> autoscaler policy) which might cause the exception below, any pointers on
> how to best debug this or what I might have missed to add  ?
>
>
>
> Thanks
>
>
>
> Martin
>
>
>
>
>
> TID: [0] [SCC] [2014-04-09 14:09:36,355]  WARN
> {org.apache.cxf.jaxrs.provider.AbstractJAXBProvider} -
> javax.xml.bind.UnmarshalException
>
> - with linked exception:
>
> [com.sun.istack.SAXParseException2; columnNumber: 0; unexpected element
> (uri:"", local:"admin"). Expected elements are <{}tenantInfoBean>]
>
>         at
> com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallerImpl.handleStreamException(UnmarshallerImpl.java:425)
>
>         at
> com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallerImpl.unmarshal0(UnmarshallerImpl.java:362)
>
>         at
> com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallerImpl.unmarshal(UnmarshallerImpl.java:332)
>
>         at
> org.apache.cxf.jaxrs.provider.json.JSONProvider.readFrom(JSONProvider.java:234)
>
>         at
> org.apache.cxf.jaxrs.utils.JAXRSUtils.readFromMessageBodyReader(JAXRSUtils.java:1288)
>
>         at
> org.apache.cxf.jaxrs.utils.JAXRSUtils.readFromMessageBody(JAXRSUtils.java:1239)
>
>         at
> org.apache.cxf.jaxrs.utils.JAXRSUtils.processParameter(JAXRSUtils.java:790)
>
>         at
> org.apache.cxf.jaxrs.utils.JAXRSUtils.processParameters(JAXRSUtils.java:749)
>
>         at
> org.apache.cxf.jaxrs.interceptor.JAXRSInInterceptor.processRequest(JAXRSInInterceptor.java:236)
>
>         at
> org.apache.cxf.jaxrs.interceptor.JAXRSInInterceptor.handleMessage(JAXRSInInterceptor.java:101)
>
>         at
> org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:271)
>
>         at
> org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:121)
>
>         at
> org.apache.cxf.transport.http.AbstractHTTPDestination.invoke(AbstractHTTPDestination.java:239)
>
>         at
> org.apache.cxf.transport.servlet.ServletController.invokeDestination(ServletController.java:223)
>
>         at
> org.apache.cxf.transport.servlet.ServletController.invoke(ServletController.java:203)
>
>         at
> org.apache.cxf.transport.servlet.ServletController.invoke(ServletController.java:137)
>
>         at
> org.apache.cxf.transport.servlet.CXFNonSpringServlet.invoke(CXFNonSpringServlet.java:159)
>
>         at
> org.apache.cxf.transport.servlet.AbstractHTTPServlet.handleRequest(AbstractHTTPServlet.java:286)
>
>         at
> org.apache.cxf.transport.servlet.AbstractHTTPServlet.doPost(AbstractHTTPServlet.java:206)
>
>         at javax.servlet.http.HttpServlet.service(HttpServlet.java:755)
>
>         at
> org.apache.cxf.transport.servlet.AbstractHTTPServlet.service(AbstractHTTPServlet.java:262)
>
>         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.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.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.runWorker(ThreadPoolExecutor.java:1145)
>
>         at
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
>
>         at java.lang.Thread.run(Thread.java:744)
>
> Caused by: com.sun.istack.SAXParseException2; columnNumber: 0; unexpected
> element (uri:"", local:"admin"). Expected elements are <{}tenantInfoBean>
>
>         at
> com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallingContext.handleEvent(UnmarshallingContext.java:642)
>
>         at
> com.sun.xml.bind.v2.runtime.unmarshaller.Loader.reportError(Loader.java:254)
>
>         at
> com.sun.xml.bind.v2.runtime.unmarshaller.Loader.reportError(Loader.java:249)
>
>         at
> com.sun.xml.bind.v2.runtime.unmarshaller.Loader.reportUnexpectedChildElement(Loader.java:116)
>
>         at
> com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallingContext$DefaultRootLoader.childElement(UnmarshallingContext.java:1049)
>
>         at
> com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallingContext._startElement(UnmarshallingContext.java:478)
>
>         at
> com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallingContext.startElement(UnmarshallingContext.java:459)
>
>         at
> com.sun.xml.bind.v2.runtime.unmarshaller.InterningXmlVisitor.startElement(InterningXmlVisitor.java:71)
>
>         at
> com.sun.xml.bind.v2.runtime.unmarshaller.StAXStreamConnector.handleStartElement(StAXStreamConnector.java:242)
>
>         at
> com.sun.xml.bind.v2.runtime.unmarshaller.StAXStreamConnector.bridge(StAXStreamConnector.java:176)
>
>         at
> com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallerImpl.unmarshal0(UnmarshallerImpl.java:360)
>
>         ... 42 more
>
> Caused by: javax.xml.bind.UnmarshalException: unexpected element (uri:"",
> local:"admin"). Expected elements are <{}tenantInfoBean>
>
>         ... 53 more
>
> {org.apache.cxf.jaxrs.provider.AbstractJAXBProvider}
>
>
>
>
> --
>
> Thanks and Regards,
>
> Isuru H.
>
> +94 716 358 048
>



-- 
Reka Thirunavukkarasu
Software Engineer,
WSO2, Inc.:http://wso2.com,
Mobile: +94776442007

Reply via email to