Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/spring/11.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 添加JPA注释后的JAXB IllegalAnnotationExceptions_Java_Spring_Soap_Spring Data Jpa_Jaxb - Fatal编程技术网

Java 添加JPA注释后的JAXB IllegalAnnotationExceptions

Java 添加JPA注释后的JAXB IllegalAnnotationExceptions,java,spring,soap,spring-data-jpa,jaxb,Java,Spring,Soap,Spring Data Jpa,Jaxb,我在这里读了几个帖子,但仍然不明白为什么会出现这种异常。一切都很好,我能够通过Spring从SOAP web服务获得正确的响应。但后来我添加了Spring数据JPA和一些注释来将数据持久化到我的数据库中,异常开始出现在响应XML中 @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "number", propOrder = { "code", "fileNames", "error" }) @Entity publ

我在这里读了几个帖子,但仍然不明白为什么会出现这种异常。一切都很好,我能够通过Spring从SOAP web服务获得正确的响应。但后来我添加了Spring数据JPA和一些注释来将数据持久化到我的数据库中,异常开始出现在响应XML中

@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "number", propOrder = {
    "code",
    "fileNames",
    "error"
})
@Entity
public class Number {

    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private long id;

    @Column(name = "number")
    private int number;

    @XmlElement(required = true)
    @Column(name = "code")
    protected String code;

    @Column(name = "filenames")
    @Convert(converter = ListConverter.class)
    //@Transient
    protected List<String> fileNames;

    @XmlElement(required = true)
    @Column(name = "error")
    private String error;

    public int getNumber() {
        return number;
    }

    public void setNumber(int number) {
        this.number = number;
    }

    public String getCode() {
        return code;
    }

    public void setCode(String value) {
        this.code = value;
    }

    public List<String> getFileNames() {
        if (fileNames == null) {
            fileNames = new ArrayList<String>();
        }
        return this.fileNames;
    }

    public String getError() {
        return error;
    }

    public void setError(String value) {
        this.error = value;
    }

}
@xmlacessortype(xmlacesstype.FIELD)
@XmlType(name=“number”,比例器={
“代码”,
“文件名”,
“错误”
})
@实体
公共课号{
@身份证
@GeneratedValue(策略=GenerationType.IDENTITY)
私人长id;
@列(name=“number”)
私有整数;
@XmlElement(必需=true)
@列(name=“code”)
受保护的字符串代码;
@列(name=“filenames”)
@Convert(converter=ListConverter.class)
//@短暂的
受保护的列表文件名;
@XmlElement(必需=true)
@列(name=“error”)
私有字符串错误;
public int getNumber(){
返回号码;
}
公共无效集合号(整数){
这个数字=数字;
}
公共字符串getCode(){
返回码;
}
公共无效设置码(字符串值){
此代码=值;
}
公共列表getFileNames(){
如果(文件名==null){
fileNames=newarraylist();
}
返回此文件名;
}
公共字符串getError(){
返回误差;
}
public void setError(字符串值){
这个错误=值;
}
}
以下是我得到的回应:

<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
<SOAP-ENV:Header/><SOAP-ENV:Body><SOAP-ENV:Fault><faultcode>SOAP-ENV:Server</faultcode>
<faultstring xml:lang="en">2 counts of IllegalAnnotationExceptions</faultstring>
</SOAP-ENV:Fault></SOAP-ENV:Body></SOAP-ENV:Envelope>

SOAP-ENV:服务器
2项IllegalAnnotationException指控

我为“id”和“number”字段添加了@xmltransive注释,现在一切都正常了。

这个版本看起来如何?您应该在控制台上看到一个完整的异常。它说什么?@Jenschauder我在控制台上没有看到任何异常,服务工作正常。在这个响应之后,我可以发送另一个请求,该请求将被处理。版本:在Number class-id和Number中没有JPA注释和其他字段。当我删除数字字段时,响应是“IllegalAnnotationExceptions的1个计数”,所以我立即删除了id,它就开始工作了。有没有办法让他们留在课堂上,让这一切顺利进行?