0

Bellow I am giving my xml which i want to consume using spring requestBody

<?xml version="1.0" encoding="UTF-8"?>
<UTILITYTYPE CODE="1">
<ALERT_INFORMATION>
<ALERT_SRC>MODEM</ALERT_SRC>
<MODEM_SERIAL_NUMBER>B00101</MODEM_SERIAL_NUMBER>
<G1>GET06253</G1>
<METER_MFR_NAME>SECURE</METER_MFR_NAME>
<METER_TYPE>FEEDER</METER_TYPE>
<DISCOM>MGVCL</DISCOM>
<ALERT_CODE>73</ALERT_CODE>
<ALERT_STATUS>0</ALERT_STATUS>
<ALERT_DESCRIPTION>11KV RAIYOLIFEEDER Power Failed</ALERT_DESCRIPTION>
<ALERT_GENERATED_DATE_TIME>06-07-2016 15:16:06</ALERT_GENERATED_DATE_TIME>
</ALERT_INFORMATION>
</UTILITYTYPE> 

My main issue is i want to mapped the XML parameter to a java bean. i have created the bean as given bellow

@XmlRootElement(name="UTILITYTYPE")
public class UtilityType implements Serializable{

    /**
     * 
     */
    private static final long serialVersionUID = 1L;
    @XmlAttribute(name="ALERT_INFORMATION")
    private List<AlertInformation> alertInformationBean;
    public List<AlertInformation> getAlertInformationBean() {
        return alertInformationBean;
    }
    public void setAlertInformationBean(List<AlertInformation> alertInformationBean) {
        this.alertInformationBean = alertInformationBean;
    }


}

and another bean is

@XmlRootElement
public class AlertInformation implements Serializable{

    /**
     * 
     */
    private static final long serialVersionUID = 1L;

    @XmlAttribute(name="MODEM_SERIAL_NUMBER")
    private String modelSerialNo;
    @XmlAttribute(name="G1")
    private String generate;
    @XmlAttribute(name="METER_MFR_NAME")
    private String meterName;
    @XmlAttribute(name="METER_TYPE")
    private String meterType;
    @XmlAttribute(name="DISCOM")
    private String disCom;
    @XmlAttribute(name="ALERT_CODE")
    private int alertCode;
    @XmlAttribute(name="ALERT_STATUS")
    private int alertStatus;
    @XmlAttribute(name="ALERT_DESCRIPTION")
    private String alertDesc;
    @XmlAttribute(name="ALERT_GENERATED_DATE_TIME")
    private String alertDatetime;
    @XmlAttribute(name="ALERT_SRC")
    private String alertSrc;

The spring controller which is consuming the response are given as bellow

    @RequestMapping(value="/getMdasInformation" ,method=RequestMethod.POST, consumes = MediaType.APPLICATION_XML_VALUE)
        public @ResponseBody List<ResponseBean> getMdasDetails(@RequestBody UtilityType mdasUBean){
 }

Following are the Exception i am getting

@XmlAttribute/@XmlValue need to reference a Java type that maps to text in XML.
    this problem is related to the following location:
        at private java.util.List com.cnetinfotech.rec.beans.UtilityType.alertInformationBean
        at com.cnetinfotech.rec.beans.UtilityType
Class has two properties of the same name "alertInformationBean"
    this problem is related to the following location:
        at public java.util.List com.cnetinfotech.rec.beans.UtilityType.getAlertInformationBean()
        at com.cnetinfotech.rec.beans.UtilityType
    this problem is related to the following location:
        at private java.util.List com.cnetinfotech.rec.beans.UtilityType.alertInformationBean
        at com.cnetinfotech.rec.beans.UtilityType
Class has two properties of the same name "alertCode"
    this problem is related to the following location:
        at public int com.cnetinfotech.rec.beans.AlertInformation.getAlertCode()
        at com.cnetinfotech.rec.beans.AlertInformation
        at private java.util.List com.cnetinfotech.rec.beans.UtilityType.alertInformationBean
        at com.cnetinfotech.rec.beans.UtilityType
    this problem is related to the following location:
        at private int com.cnetinfotech.rec.beans.AlertInformation.alertCode
        at com.cnetinfotech.rec.beans.AlertInformation
        at private java.util.List com.cnetinfotech.rec.beans.UtilityType.alertInformationBean
        at com.cnetinfotech.rec.beans.UtilityType
Class has two properties of the same name "alertDatetime"
    this problem is related to the following location:
        at public java.lang.String com.cnetinfotech.rec.beans.AlertInformation.getAlertDatetime()
        at com.cnetinfotech.rec.beans.AlertInformation
        at private java.util.List com.cnetinfotech.rec.beans.UtilityType.alertInformationBean
        at com.cnetinfotech.rec.beans.UtilityType
    this problem is related to the following location:
        at private java.lang.String com.cnetinfotech.rec.beans.AlertInformation.alertDatetime
        at com.cnetinfotech.rec.beans.AlertInformation
        at private java.util.List com.cnetinfotech.rec.beans.UtilityType.alertInformationBean
        at com.cnetinfotech.rec.beans.UtilityType
Class has two properties of the same name "alertDesc"
    this problem is related to the following location:
        at public java.lang.String com.cnetinfotech.rec.beans.AlertInformation.getAlertDesc()
        at com.cnetinfotech.rec.beans.AlertInformation
        at private java.util.List com.cnetinfotech.rec.beans.UtilityType.alertInformationBean
        at com.cnetinfotech.rec.beans.UtilityType
    this problem is related to the following location:
        at private java.lang.String com.cnetinfotech.rec.beans.AlertInformation.alertDesc
        at com.cnetinfotech.rec.beans.AlertInformation
        at private java.util.List com.cnetinfotech.rec.beans.UtilityType.alertInformationBean
        at com.cnetinfotech.rec.beans.UtilityType
Class has two properties of the same name "alertSrc"
    this problem is related to the following location:
        at public java.lang.String com.cnetinfotech.rec.beans.AlertInformation.getAlertSrc()
        at com.cnetinfotech.rec.beans.AlertInformation
        at private java.util.List com.cnetinfotech.rec.beans.UtilityType.alertInformationBean
        at com.cnetinfotech.rec.beans.UtilityType
    this problem is related to the following location:
        at private java.lang.String com.cnetinfotech.rec.beans.AlertInformation.alertSrc
        at com.cnetinfotech.rec.beans.AlertInformation
        at private java.util.List com.cnetinfotech.rec.beans.UtilityType.alertInformationBean
        at com.cnetinfotech.rec.beans.UtilityType
Class has two properties of the same name "alertStatus"
    this problem is related to the following location:
        at public int com.cnetinfotech.rec.beans.AlertInformation.getAlertStatus()
        at com.cnetinfotech.rec.beans.AlertInformation
        at private java.util.List com.cnetinfotech.rec.beans.UtilityType.alertInformationBean
        at com.cnetinfotech.rec.beans.UtilityType
    this problem is related to the following location:
        at private int com.cnetinfotech.rec.beans.AlertInformation.alertStatus
        at com.cnetinfotech.rec.beans.AlertInformation
        at private java.util.List com.cnetinfotech.rec.beans.UtilityType.alertInformationBean
        at com.cnetinfotech.rec.beans.UtilityType
Class has two properties of the same name "disCom"
    this problem is related to the following location:
        at public java.lang.String com.cnetinfotech.rec.beans.AlertInformation.getDisCom()
        at com.cnetinfotech.rec.beans.AlertInformation
        at private java.util.List com.cnetinfotech.rec.beans.UtilityType.alertInformationBean
        at com.cnetinfotech.rec.beans.UtilityType
    this problem is related to the following location:
        at private java.lang.String com.cnetinfotech.rec.beans.AlertInformation.disCom
        at com.cnetinfotech.rec.beans.AlertInformation
        at private java.util.List com.cnetinfotech.rec.beans.UtilityType.alertInformationBean
        at com.cnetinfotech.rec.beans.UtilityType
Class has two properties of the same name "generate"
    this problem is related to the following location:
        at public java.lang.String com.cnetinfotech.rec.beans.AlertInformation.getGenerate()
        at com.cnetinfotech.rec.beans.AlertInformation
        at private java.util.List com.cnetinfotech.rec.beans.UtilityType.alertInformationBean
        at com.cnetinfotech.rec.beans.UtilityType
    this problem is related to the following location:
        at private java.lang.String com.cnetinfotech.rec.beans.AlertInformation.generate
        at com.cnetinfotech.rec.beans.AlertInformation
        at private java.util.List com.cnetinfotech.rec.beans.UtilityType.alertInformationBean
        at com.cnetinfotech.rec.beans.UtilityType
Class has two properties of the same name "meterName"
    this problem is related to the following location:
        at public java.lang.String com.cnetinfotech.rec.beans.AlertInformation.getMeterName()
        at com.cnetinfotech.rec.beans.AlertInformation
        at private java.util.List com.cnetinfotech.rec.beans.UtilityType.alertInformationBean
        at com.cnetinfotech.rec.beans.UtilityType
    this problem is related to the following location:
        at private java.lang.String 

com.cnetinfotech.rec.beans.AlertInformation.meterName
        at com.cnetinfotech.rec.beans.AlertInformation
        at private java.util.List com.cnetinfotech.rec.beans.UtilityType.alertInformationBean
        at com.cnetinfotech.rec.beans.UtilityType
Class has two properties of the same name "meterType"
    this problem is related to the following location:
        at public java.lang.String com.cnetinfotech.rec.beans.AlertInformation.getMeterType()
        at com.cnetinfotech.rec.beans.AlertInformation
        at private java.util.List com.cnetinfotech.rec.beans.UtilityType.alertInformationBean
        at com.cnetinfotech.rec.beans.UtilityType
    this problem is related to the following location:
        at private java.lang.String com.cnetinfotech.rec.beans.AlertInformation.meterType
        at com.cnetinfotech.rec.beans.AlertInformation
        at private java.util.List com.cnetinfotech.rec.beans.UtilityType.alertInformationBean
        at com.cnetinfotech.rec.beans.UtilityType
Class has two properties of the same name "modelSerialNo"
    this problem is related to the following location:
        at public java.lang.String com.cnetinfotech.rec.beans.AlertInformation.getModelSerialNo()
        at com.cnetinfotech.rec.beans.AlertInformation
        at private java.util.List com.cnetinfotech.rec.beans.UtilityType.alertInformationBean
        at com.cnetinfotech.rec.beans.UtilityType
    this problem is related to the following location:
        at private java.lang.String com.cnetinfotech.rec.beans.AlertInformation.modelSerialNo
        at com.cnetinfotech.rec.beans.AlertInformation
        at private java.util.List com.cnetinfotech.rec.beans.UtilityType.alertInformationBean
        at com.cnetinfotech.rec.beans.UtilityType
] with root cause
com.sun.xml.internal.bind.v2.runtime.IllegalAnnotationsException: 12 counts of IllegalAnnotationExceptions
@XmlAttribute/@XmlValue need to reference a Java type that maps to text in XML.
    this problem is related to the following location:
        at private java.util.List com.cnetinfotech.rec.beans.UtilityType.alertInformationBean
        at com.cnetinfotech.rec.beans.UtilityType
Class has two properties of the same name "alertInformationBean"
    this problem is related to the following location:
        at public java.util.List com.cnetinfotech.rec.beans.UtilityType.getAlertInformationBean()
        at com.cnetinfotech.rec.beans.UtilityType
    this problem is related to the following location:
        at private java.util.List com.cnetinfotech.rec.beans.UtilityType.alertInformationBean
        at com.cnetinfotech.rec.beans.UtilityType
Class has two properties of the same name "alertCode"
    this problem is related to the following location:
        at public int com.cnetinfotech.rec.beans.AlertInformation.getAlertCode()
        at com.cnetinfotech.rec.beans.AlertInformation
        at private java.util.List com.cnetinfotech.rec.beans.UtilityType.alertInformationBean
        at com.cnetinfotech.rec.beans.UtilityType
    this problem is related to the following location:
        at private int com.cnetinfotech.rec.beans.AlertInformation.alertCode
        at com.cnetinfotech.rec.beans.AlertInformation
        at private java.util.List com.cnetinfotech.rec.beans.UtilityType.alertInformationBean
        at com.cnetinfotech.rec.beans.UtilityType
Class has two properties of the same name "alertDatetime"
    this problem is related to the following location:
        at public java.lang.String com.cnetinfotech.rec.beans.AlertInformation.getAlertDatetime()
        at com.cnetinfotech.rec.beans.AlertInformation
        at private java.util.List com.cnetinfotech.rec.beans.UtilityType.alertInformationBean
        at com.cnetinfotech.rec.beans.UtilityType
    this problem is related to the following location:
        at private java.lang.String com.cnetinfotech.rec.beans.AlertInformation.alertDatetime
        at com.cnetinfotech.rec.beans.AlertInformation
        at private java.util.List com.cnetinfotech.rec.beans.UtilityType.alertInformationBean
        at com.cnetinfotech.rec.beans.UtilityType
Class has two properties of the same name "alertDesc"
    this problem is related to the following location:
        at public java.lang.String com.cnetinfotech.rec.beans.AlertInformation.getAlertDesc()
        at com.cnetinfotech.rec.beans.AlertInformation
        at private java.util.List com.cnetinfotech.rec.beans.UtilityType.alertInformationBean
        at com.cnetinfotech.rec.beans.UtilityType
    this problem is related to the following location:
        at private java.lang.String com.cnetinfotech.rec.beans.AlertInformation.alertDesc
        at com.cnetinfotech.rec.beans.AlertInformation
        at private java.util.List com.cnetinfotech.rec.beans.UtilityType.alertInformationBean
        at com.cnetinfotech.rec.beans.UtilityType
Class has two properties of the same name "alertSrc"
    this problem is related to the following location:
        at public java.lang.String com.cnetinfotech.rec.beans.AlertInformation.getAlertSrc()
        at com.cnetinfotech.rec.beans.AlertInformation
        at private java.util.List com.cnetinfotech.rec.beans.UtilityType.alertInformationBean
        at com.cnetinfotech.rec.beans.UtilityType
    this problem is related to the following location:
        at private java.lang.String com.cnetinfotech.rec.beans.AlertInformation.alertSrc
        at com.cnetinfotech.rec.beans.AlertInformation
        at private java.util.List com.cnetinfotech.rec.beans.UtilityType.alertInformationBean
        at com.cnetinfotech.rec.beans.UtilityType
Class has two properties of the same name "alertStatus"
    this problem is related to the following location:
        at public int com.cnetinfotech.rec.beans.AlertInformation.getAlertStatus()
        at com.cnetinfotech.rec.beans.AlertInformation
        at private java.util.List com.cnetinfotech.rec.beans.UtilityType.alertInformationBean
        at com.cnetinfotech.rec.beans.UtilityType
    this problem is related to the following location:
        at private int com.cnetinfotech.rec.beans.AlertInformation.alertStatus
        at com.cnetinfotech.rec.beans.AlertInformation
        at private java.util.List com.cnetinfotech.rec.beans.UtilityType.alertInformationBean
        at com.cnetinfotech.rec.beans.UtilityType
Class has two properties of the same name "disCom"
    this problem is related to the following location:
        at public java.lang.String com.cnetinfotech.rec.beans.AlertInformation.getDisCom()
        at com.cnetinfotech.rec.beans.AlertInformation
        at private java.util.List com.cnetinfotech.rec.beans.UtilityType.alertInformationBean
        at com.cnetinfotech.rec.beans.UtilityType
    this problem is related to the following location:
        at private java.lang.String com.cnetinfotech.rec.beans.AlertInformation.disCom
        at com.cnetinfotech.rec.beans.AlertInformation
        at private java.util.List com.cnetinfotech.rec.beans.UtilityType.alertInformationBean
        at com.cnetinfotech.rec.beans.UtilityType
Class has two properties of the same name "generate"
    this problem is related to the following location:
        at public java.lang.String com.cnetinfotech.rec.beans.AlertInformation.getGenerate()
        at com.cnetinfotech.rec.beans.AlertInformation
        at private java.util.List com.cnetinfotech.rec.beans.UtilityType.alertInformationBean
        at com.cnetinfotech.rec.beans.UtilityType
    this problem is related to the following location:
        at private java.lang.String com.cnetinfotech.rec.beans.AlertInformation.generate
        at com.cnetinfotech.rec.beans.AlertInformation
        at private java.util.List com.cnetinfotech.rec.beans.UtilityType.alertInformationBean
        at com.cnetinfotech.rec.beans.UtilityType
Class has two properties of the same name "meterName"
    this problem is related to the following location:
        at public java.lang.String com.cnetinfotech.rec.beans.AlertInformation.getMeterName()
        at com.cnetinfotech.rec.beans.AlertInformation
        at private java.util.List com.cnetinfotech.rec.beans.UtilityType.alertInformationBean
        at com.cnetinfotech.rec.beans.UtilityType
    this problem is related to the following location:
        at private java.lang.String com.cnetinfotech.rec.beans.AlertInformation.meterName
        at com.cnetinfotech.rec.beans.AlertInformation
        at private java.util.List com.cnetinfotech.rec.beans.UtilityType.alertInformationBean
        at com.cnetinfotech.rec.beans.UtilityType
Class has two properties of the same name "meterType"
    this problem is related to the following location:
        at public java.lang.String com.cnetinfotech.rec.beans.AlertInformation.getMeterType()
        at com.cnetinfotech.rec.beans.AlertInformation
        at private java.util.List com.cnetinfotech.rec.beans.UtilityType.alertInformationBean
        at com.cnetinfotech.rec.beans.UtilityType
    this problem is related to the following location:
        at private java.lang.String com.cnetinfotech.rec.beans.AlertInformation.meterType
        at com.cnetinfotech.rec.beans.AlertInformation
        at private java.util.List com.cnetinfotech.rec.beans.UtilityType.alertInformationBean
        at com.cnetinfotech.rec.beans.UtilityType
Class has two properties of the same name "modelSerialNo"
    this problem is related to the following location:
        at public java.lang.String com.cnetinfotech.rec.beans.AlertInformation.getModelSerialNo()
        at com.cnetinfotech.rec.beans.AlertInformation
        at private java.util.List com.cnetinfotech.rec.beans.UtilityType.alertInformationBean
        at com.cnetinfotech.rec.beans.UtilityType
    this problem is related to the following location:
        at private java.lang.String com.cnetinfotech.rec.beans.AlertInformation.modelSerialNo
        at com.cnetinfotech.rec.beans.AlertInformation
        at private java.util.List com.cnetinfotech.rec.beans.UtilityType.alertInformationBean
        at com.cnetinfotech.rec.beans.UtilityType

    at com.sun.xml.internal.bind.v2.runtime.IllegalAnnotationsException$Builder.check(Unknown Source)
    at com.sun.xml.internal.bind.v2.runtime.JAXBContextImpl.getTypeInfoSet(Unknown Source)
    at com.sun.xml.internal.bind.v2.runtime.JAXBContextImpl.<init>(Unknown Source)
    at com.sun.xml.internal.bind.v2.runtime.JAXBContextImpl.<init>(Unknown Source)
    at com.sun.xml.internal.bind.v2.runtime.JAXBContextImpl$JAXBContextBuilder.build(Unknown Source)
    at com.sun.xml.internal.bind.v2.ContextFactory.createContext(Unknown Source)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at javax.xml.bind.ContextFinder.newInstance(Unknown Source)
    at javax.xml.bind.ContextFinder.newInstance(Unknown Source)
    at javax.xml.bind.ContextFinder.find(Unknown Source)
    at javax.xml.bind.JAXBContext.newInstance(Unknown Source)
    at javax.xml.bind.JAXBContext.newInstance(Unknown Source)
    at org.springframework.http.converter.xml.AbstractJaxb2HttpMessageConverter.getJaxbContext(AbstractJaxb2HttpMessageConverter.java:111)
    at org.springframework.http.converter.xml.AbstractJaxb2HttpMessageConverter.createUnmarshaller(AbstractJaxb2HttpMessageConverter.java:79)
    at org.springframework.http.converter.xml.Jaxb2RootElementHttpMessageConverter.readFromSource(Jaxb2RootElementHttpMessageConverter.java:103)
    at org.springframework.http.converter.xml.AbstractXmlHttpMessageConverter.readInternal(AbstractXmlHttpMessageConverter.java:61)
    at org.springframework.http.converter.AbstractHttpMessageConverter.read(AbstractHttpMessageConverter.java:159)
    at org.springframework.web.servlet.mvc.method.annotation.AbstractMessageConverterMethodArgumentResolver.readWithMessageConverters(AbstractMessageConverterMethodArgumentResolver.java:154)
    at org.springframework.web.servlet.mvc.method.annotation.RequestResponseBodyMethodProcessor.readWithMessageConverters(RequestResponseBodyMethodProcessor.java:149)
    at org.springframework.web.servlet.mvc.method.annotation.RequestResponseBodyMethodProcessor.resolveArgument(RequestResponseBodyMethodProcessor.java:100)
    at org.springframework.web.method.support.HandlerMethodArgumentResolverComposite.resolveArgument(HandlerMethodArgumentResolverComposite.java:77)
    at org.springframework.web.method.support.InvocableHandlerMethod.getMethodArgumentValues(InvocableHandlerMethod.java:162)
    at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:129)
    at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:110)
    at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandleMethod(RequestMappingHandlerAdapter.java:776)
    at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:705)
    at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:85)
    at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:959)
    at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:893)
    at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:966)
    at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:868)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:641)
    at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:842)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
    at com.thetransactioncompany.cors.CORSFilter.doFilter(CORSFilter.java:174)
    at com.thetransactioncompany.cors.CORSFilter.doFilter(CORSFilter.java:237)
    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:224)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:169)
    at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:168)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:98)
    at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:927)
    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:987)
    at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:579)
    at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:307)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
    at java.lang.Thread.run(Unknown Source)

but i am not able to consume it and its giving 404 error. Please help me to solve it. Big thanks in advance.

Chandan Sarma
  • 308
  • 2
  • 5
  • 19
  • Do you see any exception in the console? Could you please add it to the post? – Arar Jul 08 '16 at 16:05
  • No its giving 404 error and not consuming actually – Chandan Sarma Jul 08 '16 at 16:06
  • Alright ? Could you please add the Controller code and the URL you use to consume the API ? – Arar Jul 08 '16 at 16:08
  • Actually the code is in my local machine and i have also added the sping controller code with . please check you will find the url – Chandan Sarma Jul 08 '16 at 16:19
  • I need to see the Controller class code, not the getMdasDetails() only. And I don't see the URL that returns 404 page in your post. – Arar Jul 08 '16 at 16:25
  • There are lots of method inside my controller so it will be difficult to add over here , one more thing i am using rest client of google and for response its been send 404 exception – Chandan Sarma Jul 08 '16 at 16:44
  • Alright, Could you add the class definition part and the annotations you use to define the controller ? – Arar Jul 08 '16 at 16:49
  • @Controller @RequestMapping("/xxxx/yyyy") – Chandan Sarma Jul 08 '16 at 16:51
  • The error message says, 'Class has two properties of the same name...', and it says it once per property. Can you confirm that you only have the one @XmlAnnotation per attribute (and that you've not duplicated them anywhere at all?) – Software Engineer Jul 08 '16 at 17:07
  • And, check out: http://stackoverflow.com/questions/6768544/jaxb-class-has-two-properties-of-the-same-name and this: http://stackoverflow.com/a/24367779/2051454 – Software Engineer Jul 08 '16 at 17:08
  • @Engineer Dollery yes. I have only one xmlAnnonationProperty and there is no duplicate. I will try using the link given by you – Chandan Sarma Jul 08 '16 at 17:10
  • Your xml doesn't have `@XmlAttributes` it has `@XmlElement`s. `` here the `@XmlElement(name="foo")` and of that `@XmlAttribute(name="bar")`. You are using the wrong annotations. The only element that has an attribute is the `UTILITYTYPE` which does have a `code` attribute. – M. Deinum Jul 09 '16 at 06:43
  • @M. Deinum You are right . I have changed it and now its working – Chandan Sarma Jul 09 '16 at 06:56

1 Answers1

0

I have solved it . my bean should be like given bellow

@XmlAccessorType(XmlAccessType.FIELD)
public class AlertInformation implements Serializable{

    /**
     * 
     */
    private static final long serialVersionUID = 1L;

    @XmlElement(name="MODEM_SERIAL_NUMBER")
    private String modelSerialNo;
    @XmlElement(name="G1")
    private String generate;
    @XmlElement(name="METER_MFR_NAME")
    private String meterName;
    @XmlElement(name="METER_TYPE")
    private String meterType;
    @XmlElement(name="DISCOM")
    private String disCom;
    @XmlElement(name="ALERT_CODE")
    private int alertCode;
    @XmlElement(name="ALERT_STATUS")
    private int alertStatus;
    @XmlElement(name="ALERT_DESCRIPTION")
    private String alertDesc;
    @XmlElement(name="ALERT_GENERATED_DATE_TIME")
    private String alertDatetime;
    @XmlElement(name="ALERT_SRC")
    private String alertSrc;

After doing some brain storming i have solved it . thanks for the response given and it help me to solve it

Chandan Sarma
  • 308
  • 2
  • 5
  • 19