jaxb 异常 Class has two properties of the same name及其它
2014-11-10 10:23
441 查看
这种异常主要是因为在属性上使用了@XmlElement注释,
但是在类上没有使用@XmlAccessorType(XmlAccessType.FIELD)注释
@XmlElement(name="MON")
private TemplateDay templateMon;
所以在类上加上就可以了。
还有对于集合的方式
//这个不用再使用注解的话直接使用template名字作为最外层了
private List<TemplateXml> template;
还有就是最外层的类一定要使用@XmlRootElement(name="weekTemplate")
标签,要不会报一个找不到标签的异常。
但是在类上没有使用@XmlAccessorType(XmlAccessType.FIELD)注释
@XmlElement(name="MON")
private TemplateDay templateMon;
所以在类上加上就可以了。
还有对于集合的方式
//这个不用再使用注解的话直接使用template名字作为最外层了
private List<TemplateXml> template;
还有就是最外层的类一定要使用@XmlRootElement(name="weekTemplate")
标签,要不会报一个找不到标签的异常。
相关文章推荐
- 2 counts of IllegalAnnotationExceptions Class has two properties of the same name JAXB异常
- jaxb 异常 Class has two properties of the same name
- JAXB “Class has two properties of the same name” issue
- jaxb异常 Class has two properties of the same name username
- 处理 1 counts of IllegalAnnotationExceptions Class has two properties of the same name "ITEM"
- WebService 报3 counts of IllegalAnnotationExceptionsClass has two properties of the same name "entries"
- Class has two properties of the same name "xxx"
- 异常解决:non-compatible bean definition of same name and class【com.xxx.xxx.XXX】
- Fixing the security exception : "class /"" + packageName + "/" does not match trust level of other classes in the same package"
- Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP
- whether the results are the same of getClass().getName() called in child class and parent class?
- CXF报错[1 counts of IllegalAnnotationExceptions]and[Two classes have the same XML type name]and[Use @XmlType.name and @XmlType.namespace to assign different names to them]
- 【Webservice】2 counts of IllegalAnnotationExceptions Two classes have the same XML type name
- It is not possible to run two different versions of ASP.NET in the same IIS process.问题的解决
- 1721. Two Sides of the Same Coin
- The content of the adapter has changed but ListView did not receive a notification 异常解析
- Double Delete caused by 2 shared library has global object of same name, 1) reproduce
- The Difference of Class.forName()、Class.forName().newInstance() and New in Java
- 异常——JAXB 2.0 API is being loaded from the bootstrap classloader
- Double Delete caused by 2 shared library has global object of same name, 2) 1st glance