나는 이상한 문제가있다. 나는 사용자 도메인 클래스를 Grails app에 가지고 있습니다.Grails 애플리케이션에서 mysql의 테이블을 업데이트 할 수 없다.
class User {
transient springSecurityService
String username
String name
String password
String email
String company
Date activationDate
String contactPhone
boolean enabled
boolean passwordExpired = false
boolean accountExpired
boolean accountLocked
boolean isDeleted=false
boolean isPrimary
String jobTitle
String jobFunction
String deskPhone
String mobile
String profilePicURL
boolean isLinkExpired=false
UserType userType
Date dateCreated
Date lastUpdated
static constraints = {
password nullable: true
company nullable: true
email blank: false, unique: true
name nullable: true
activationDate nullable:true
username nullable: true
enabled nullable: false
isDeleted nullable: false
passwordExpired nullable: false
jobFunction nullable:true
jobTitle nullable:true
contactPhone nullable:true
mobile nullable:true
profilePicURL nullable:true
deskPhone nullable:true
userType nullable:true
}
static auditable = true
static mapping = {
password column: '`password`'
tablePerHierarchy false
cache true
}
Set<Role> getAuthorities() {
UserRole.findAllByUser(this).collect { it.role } as Set
}
을 다음과 같이 일부 기능에 대한 사용자 인증을 활성화/비활성화 할 수있는 방법 activeDeactiveUser이 : 클래스는 다음과 같다
def activeDeactiveUser(String username) {
def user = User.findByUsername(username)
if (user.enabled == false)
user.enabled = true
else
user.enabled = false
if (user.validate()) {
user.save(flush: true, failOnError: true)
} else {
user.errors.allErrors.each {
print it
}
}
def userJson = new JSONObject()
userJson.put("isEnabled", user.enabled)
return userJson
}
앱이 로컬 호스트
에서 실행되고있는 경우는, 테이블이 잘 업데이트되고 있습니다. 그러나 동일한 코드가
서버에서 실행되고 있으면 테이블을 업데이트 할 수 없습니다. 나는 왜 이런 행동을하는지 모르겠다. 응용 프로그램이 localhost의 save 메소드에 대한 예외를 발생시키지 않습니다. 문제는 다른 버전의
mysql 내 컴퓨터와 서버에있을 수 있습니다. 서버에서 실행되는 동안 앱을 디버그 할 수 있습니까?
응용 프로그램은 우분투 14.04 및 Grails 버전 2.4.3을 실행하는 AWS EC2 인스턴스에서 호스팅됩니다. 데이터베이스는 mysql 5.5.40을 실행하는 AWS RDS 인스턴스에 저장됩니다.
당신이 사용하는 명령은 무엇입니까 war 파일 @theleancoder를 만드시겠습니까? –
이전 낡은 war 파일을 서버에 배포하는 것. –
전쟁을 만들기 전에 "grails clean"과 "grails create war"명령을 실행하십시오. –