2012-11-20 80 views
1

不知道爲什麼會發生這種情況,它在兩週前開始工作。下面是異常日誌:grails spring安全性facebook登錄錯誤

No signature of method: xxxxx.UserInfo.findAllByEmail() is applicable for argument  types:() values: [] 
Possible solutions: findAllByEmail([Ljava.lang.Object;). Stacktrace follows: 
groovy.lang.MissingMethodException: 
No signature of method: xxxxxx.UserInfo.findAllByEmail() is applicable for argument types:() values: [] 
Possible solutions: findAllByEmail([Ljava.lang.Object;) 
       at org.grails.datastore.gorm.GormStaticApi$_methodMissing_closure2.doCall(GormStaticApi.groovy:105) 
       at xxxxxx.FacebookController.checkEmail(FacebookController.groovy:87) 
       at xcompare.FacebookController$_closure2.doCall(FacebookController.groovy:49) 
       at xxxxxxx.OpenIDFilter.doFilter(OpenIDFilter.groovy:64) 
       at java.lang.Thread.run(Thread.java:662) 

這是FacebookController.groovy代碼:

private boolean checkEmail(String email){ 
    def users = UserInfo.findAllByEmail(email) 
    if(users){ 
     // email is not available 
     return false; 
    } 
    return true; 
} 

,這裏是從UserInfo代碼:

class UserInfo extends SecUser { 
Provider provider 
String activationCode 
String firstName 
String lastName 
String email 
Boolean active 
UserType type 
Date dateCreated 
Date lastUpdated 
Category category 

static constraints = { 
    email unique:true, nullable:true, email:true 
    provider nullable:true 
    activationCode nullable:true 
    firstName blank:true, nullable:true 
    lastName blank:true, nullable:true 
    category nullable:true  
} 

String toString() { 
    // normal user 
    if(!openIds){ 
     return username 
    } 
    // openid user 
    String name = ""; 
    if(firstName){ 
     name += firstName; 
     if(lastName){ 
      name += " "+lastName; 
     } 
    }else{ 
     name = email; 
    } 
    return name; 
} 

}

+0

請問ypu請顯示'FacebookController.groovy:87'和'xxxxx.UserInfo'? –

+0

肯定伊戈爾。 '私人布爾checkEmail(字符串email){ \t \t高清用戶= UserInfo.findAllByEmail(電子郵件) \t \t如果(用戶){ \t \t \t //電子郵件不可 \t \t \t返回FALSE; \t \t} // //這是FacebookController.grovvy 87 – user1837312

+0

請問您是否也可以添加它?不僅僅只是評論 –

回答

0

我不知道,但也許這是因爲email是空的。所以請嘗試:

private boolean checkEmail(String email){ 
    if (!email) { 
     //TODO don't think that it's what you want 
     return true 
    } 
    int count = UserInfo.countByEmail(email) 
    return count == 0 
} 
+0

是的。似乎電子郵件是空的..但它過去幾周前用相同的代碼工作。只有'grails.gsp.enable.reload = true'已被添加,所以這會影響? – user1837312

+0

'props = [「mail.smtp.auth」:「true」'已被切換爲false – user1837312