Spring bean类的无效属性bean属性不可读或具有无效的getter方法

Spring bean类的无效属性bean属性不可读或具有无效的getter方法,spring,jsp,Spring,Jsp,我是春天的新手,我有个例外 我有一个jsp,有很多选择。所有这些都可以正常工作,但有一个例外: org.apache.jasper.JasperException: Ha sucedido una excepción al procesar la página JSP /WEB-INF/pages/nuevo-expediente.jsp en línea 45 42: <td> 43: <

我是春天的新手,我有个例外

我有一个jsp,有很多选择。所有这些都可以正常工作,但有一个例外:

org.apache.jasper.JasperException: Ha sucedido una excepción al procesar la página JSP /WEB-INF/pages/nuevo-expediente.jsp en línea 45

42:                     <td>
43:                         <form:select path="expedientePadre.codExpediente">
44:                             <form:option value="-" label="Seleccione un     expediente"/>
45:                             <form:options items="${expedientes}"    itemLabel="codExpediente" itemValue="codExpediente"/>
46:                         </form:select>
47:                         <form:errors path="expedientePadre" element="span"/>
48:                     </td>

org.springframework.beans.NotReadablePropertyException: Invalid property 'codExpediente' of bean class [com.atlantis.atecliente.model.TipoExpediente]: Bean property 'codExpediente' is not readable or has an invalid getter method: Does the return type of the getter match the parameter type of the setter?
最后是TipoExpedinte实体

package com.atlantis.atecliente.model;

import java.io.Serializable;
import javax.persistence.*;

@Entity
@Table
public class TipoExpediente implements Serializable {
@Id
@Column(length = 40)
private String tipo;

public String getTipo() {
    return tipo;
}

public void setTipo(String tipo) {
    this.tipo = tipo;
}
}
我认为这可能发生,因为PharmantePadre属性是同一实体Pharmante的外键,但我不知道如何解决它


要帮忙吗?谢谢

我认为问题在于您的类TipExpedient类没有用于属性CodeExpedient的getter或setter方法。Spring正在查看您的TipoExpediente类,并希望它具有JSP中概述的属性。

显示您的
TipoExpediente
类。我已经添加了该类。谢谢
@RequestMapping(value = "nuevo-expediente")
public String createExpedienteGet(Model model) {
    model.addAttribute("expediente", new Expediente());
    model.addAttribute("expedienteP", new Expediente());
    List<TipoResolucion> resoluciones = service.getResoluciones();
    List<TipoExpediente> listaTipos = service.getTipos();
    List<EstadoExpediente> listaEstados = service.getEstados();
    List<Expediente> listaExpedientes = service.getExpedientes();
    List<TipoRelacion> listaRelaciones = service.getRelaciones();
    List<CanalExpediente> listaCanales = service.getCanales();
    List<IdiomaExpediente> listaIdiomas = service.getIdiomas();
    model.addAttribute("resoluciones", resoluciones);
    model.addAttribute("tipos", listaTipos);
    model.addAttribute("estados", listaEstados);
    model.addAttribute("expedientes", listaExpedientes);
    model.addAttribute("tiposRelacion", listaRelaciones);
    model.addAttribute("canales", listaCanales);
    model.addAttribute("idiomas", listaIdiomas);
    return "nuevo-expediente";
}

@RequestMapping(value = "nuevo-expediente", method = RequestMethod.POST)
public String createExpedientePost(@ModelAttribute("expediente") Expediente expediente, BindingResult result) {
    service.createExpediente(expediente);
    return "redirect:expedientes";
}
@Entity
@Table(name="Expediente")
public class Expediente implements Serializable {
@Id
@Column(length = 15)
private String codExpediente;

@ManyToOne(cascade={CascadeType.ALL})
@JoinColumn(name = "tipoExpediente")
private TipoExpediente tipoExpediente;

@ManyToOne(cascade={CascadeType.ALL})
@JoinColumn(name = "estadoExpediente")
private EstadoExpediente estadoExpediente;

@ManyToOne(cascade={CascadeType.ALL})
@JoinColumn(name = "expedientePadre")
private Expediente expedientePadre;

@ManyToOne(cascade={CascadeType.ALL})
@JoinColumn(name = "tipoRelacion")
private TipoRelacion tipoRelacion;

@ManyToOne(cascade={CascadeType.ALL})
@JoinColumn(name = "canalEntrada")
private CanalExpediente canalEntrada;

@ManyToOne(cascade={CascadeType.ALL})
@JoinColumn(name = "idiomaEntrada")
private IdiomaExpediente idiomaEntrada;

@ManyToOne(cascade={CascadeType.ALL})
@JoinColumn(name = "idiomaSalida")
private IdiomaExpediente idiomaSalida;

@ManyToOne(cascade={CascadeType.ALL})
@JoinColumn(name = "tipoResolucion")
private TipoResolucion tipoResolucion;

@ManyToOne(cascade={CascadeType.ALL})
@JoinColumn(name = "canalSalida")
private CanalExpediente canalSalida;

@Column(length = 10)
private String numeroSerie;

@Column(length = 10)
private String numeroHoja;

@Temporal(javax.persistence.TemporalType.TIMESTAMP)
private Date fechaRedaccion;

@Temporal(javax.persistence.TemporalType.TIMESTAMP)
private Date fechaRecepcion;

@Column(length = 200)
private String asunto;

@Column (length = 1000)
private String descripcion;

@Column(length = 20)
private String usuarioRegistro;

@Temporal(javax.persistence.TemporalType.TIMESTAMP)
private Date fechaRegistro;

@Column (length = 20)
private String usuarioModificacion;

@Temporal(javax.persistence.TemporalType.TIMESTAMP)
private Date fechaModificacion;

@Column (length = 20)
private String usuarioCierre;

@Temporal(javax.persistence.TemporalType.TIMESTAMP)
private Date fechaCierre;

public String getCodExpediente() {
    return codExpediente;
}

public void setCodExpediente(String codExpediente) {
    this.codExpediente = codExpediente;
}

............................
............................
package com.atlantis.atecliente.model;

import java.io.Serializable;
import javax.persistence.*;

@Entity
@Table
public class TipoExpediente implements Serializable {
@Id
@Column(length = 40)
private String tipo;

public String getTipo() {
    return tipo;
}

public void setTipo(String tipo) {
    this.tipo = tipo;
}
}