org.springframework.orm.hibernate3.HibernateSystemException:调用getter时出现IllegalArgumentException

时间:2011-10-14 13:54:47

标签: hibernate spring-security

我遇到下面显示的问题

 
IllegalArgumentException occurred calling getter of org.springframework.security.oauth.examples.sparklr.models.Authority.user; 
nested exception is org.hibernate.PropertyAccessException: 
IllegalArgumentException occurred calling getter of org.springframework.security.oauth.examples.sparklr.models.Authority.user

我的hibernate依赖项是:

  • hibernate-core 3.3.2.GA
  • hibernate-annotations 3.4.0.GA
  • hibernate-commons-annotations 3.3.0.ga
  • hibernate-entitymanager 3.4.0.GA
 
public class User implements UserDetails,Serializable {

    /** Serial Version UID. */
    private static final long serialVersionUID = -558892839L;

    /** Use a WeakHashMap so entries will be garbage collected once all entities 
        referring to a saved hash are garbage collected themselves. */
    private static final Map<Serializable, String> SAVED_HASHES =
        Collections.synchronizedMap(new WeakHashMap<Serializable, String>());

    /** hashCode temporary storage. */
    private volatile String hashCode;


    /** Field mapping. */
    private Boolean accountnonexpired;
    /** Field mapping. */
    private Boolean accountnonlocked;
    /** Field mapping. */
    private List<Authority> authorities = new ArrayList<Authority>();

    /** Field mapping. */
    private Boolean credentialsnonexpired;
    /** Field mapping. */
    private Boolean enabled;
    /** Field mapping. */
    private String id;
    /** Field mapping. */
    private String password;


       public class Authority implements Serializable ,GrantedAuthority {


    /** Serial Version UID. */
    private static final long serialVersionUID = -558892840L;

    /** Use a WeakHashMap so entries will be garbage collected once all entities 
        referring to a saved hash are garbage collected themselves. */
    private static final Map<Serializable, Serializable> SAVED_HASHES =
        Collections.synchronizedMap(new WeakHashMap<Serializable, Serializable>());

    /** hashCode temporary storage. */
    private volatile Serializable hashCode;


    /** Field mapping. */
    private String authority;
    /** Field mapping. */
    private User user;

我怎么能解决这么多谢谢

1 个答案:

答案 0 :(得分:0)

从您显示的代码中,您没有user Authority属性的getter。

尝试添加

public User getUser(){
    return this.user;
}