간단한 응용 프로그램 내에서 스프링 보안을 사용하고 있습니다. amazon RDS 인스턴스에 연결할 때 응용 프로그램이 로컬에서 올바르게 실행됩니다. 내가 역할의 창조 콩나무 탄성을 내 응용 프로그램을 업로드 할 때 부트 스트랩에 실패grails mysql에 대한 부트 스트랩 오류
def init = { servletContext ->
println log.name
log.debug("hello 1")
def adminRole = new Role(authority: 'ROLE_ADMIN')
log.debug("hello 2")
if (!adminRole.save(flush: true, failOnError: true)) {
log.debug("hello 3")
adminRole.errors.each {
println it
log.error(it)
}
}
2013-12-17 23:25:33,311 [localhost-startStop-1] ERROR context.GrailsContextLoader - Error initializing the application: groovy.lang.MissingMethodException: No signature of method: com.nrfa.Role.save() is applicable for argument types:() values: []
Possible solutions: save(), save(boolean), save(java.util.Map), wait(), last(), any()
org.codehaus.groovy.runtime.InvokerInvocationException: groovy.lang.MissingMethodException: No signature of method: com.nrfa.Role.save() is applicable for argument types:() values: []
Possible solutions: save(), save(boolean), save(java.util.Map), wait(), last(), any()
at grails.util.Environment.evaluateEnvironmentSpecificBlock(Environment.java:308)
at grails.util.Environment.executeForEnvironment(Environment.java:301)
at grails.util.Environment.executeForCurrentEnvironment(Environment.java:277)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
at java.util.concurrent.FutureTask.run(FutureTask.java:166)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:724)
Caused by: groovy.lang.MissingMethodException: No signature of method: com.nrfa.Role.save() is applicable for argument types:() values: []
Possible solutions: save(), save(boolean), save(java.util.Map), wait(), last(), any()
at BootStrap$_closure1.doCall(BootStrap.groovy:15)
... 9 more
는 데이터베이스 연결 문제라면 -이 될 수있다 - 나는 오류가 헤이 '되었을 것이라고 생각했을 것이다, 할 수있다 데이터베이스에 연결하지 마십시오. ' Role의 설명이 불가능한 오류는 Role.save()를 찾을 수 없습니다.
편집 : 전체 부트 스트랩 :
import com.nrfa.Role
import com.nrfa.User
import com.nrfa.UserRole
class BootStrap {
def springSecurityService
def init = { servletContext ->
println log.name
log.debug("hello 1")
def adminRole = new Role(authority: 'ROLE_ADMIN')
log.debug("hello 2")
if (!adminRole.save(flush: true, failOnError: true)) {
log.debug("hello 3")
adminRole.errors.each {
println it
log.error(it)
}
}
log.debug("hello 4")
def userRole = new Role(authority: 'ROLE_USER').save(flush: true, failOnError: true)
def testUser = new User(username: 'me', password: 'password')
testUser.save(flush: true, failOnError: true)
UserRole.create testUser, userRole, true
assert User.count() == 1
assert Role.count() == 2
assert UserRole.count() == 1
}
def destroy = {
}
}
이 편집 :
dependencies {
// specify dependencies here under either 'build', 'compile', 'runtime', 'test' or 'provided' scopes e.g.
//runtime 'mysql:mysql-connector-java:5.1.27'
runtime 'org.slf4j:slf4j-api:1.7.5'
}
plugins {
build ":hibernate:$grailsVersion"
runtime ":jquery:1.8.3"
runtime ":resources:1.2"
runtime ":mysql-connectorj:5.1.22.1"
compile ':spring-security-core:2.0-RC2'
// Uncomment these (or add new ones) to enable additional resources capabilities
//runtime ":zipped-resources:1.0"
//runtime ":cached-resources:1.0"
//runtime ":yui-minify-resources:0.1.5"
build ":tomcat:$grailsVersion"
build ":database-migration:1.3.2"
compile ':cache:1.0.1'
// 런타임 : BuildConfig.Groovy 포함 "한다 : mysql-connectorj : 5.1.22.1을" }
이 파일이 war 파일을 만드는 데 문제가 있다고 생각하기 시작했으며 mysql 연결자가 선택되지 않았습니다. 원래는 의존성이었습니다 (작동하지 않았습니다). 플러그인으로 변경했습니다 (여전히 작동하지 않습니다). 탄력있는 beanstalk의 tomcat7 설치에는 mysql jar 파일이 없습니다. – spock99
전체 BootStrap.groovy 파일을 공유 할 수 있습니까? –
전체 부트 스트랩이 추가되었습니다. – spock99