2013-12-17 4 views
1

간단한 응용 프로그램 내에서 스프링 보안을 사용하고 있습니다. 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을" }

+0

이 파일이 war 파일을 만드는 데 문제가 있다고 생각하기 시작했으며 mysql 연결자가 선택되지 않았습니다. 원래는 의존성이었습니다 (작동하지 않았습니다). 플러그인으로 변경했습니다 (여전히 작동하지 않습니다). 탄력있는 beanstalk의 tomcat7 설치에는 mysql jar 파일이 없습니다. – spock99

+0

전체 BootStrap.groovy 파일을 공유 할 수 있습니까? –

+0

전체 부트 스트랩이 추가되었습니다. – spock99

답변

0

이 오류는 대개 hibernate 플러그인이 설치되거나 작동하지 않음을 나타냅니다. 원격 서버에서 확장 된 전쟁을 볼 수 있습니까? 나는 콩나무 자체의 작동에 익숙하지 않아 뭔가가 거기에서 충돌을 일으킬지도 모른다.

+0

BuildConfig.groovy를 나열했습니다. 전쟁 파일에는 내 IDE에 나열된 hibernate-ja-hibernate-jpa-2.0-api-1.0.1.Final의 일부가 있지만 최대 절전 모드 코어는 없습니다. – spock99

+0

어떤 grails 버전을 실행하고 있습니까? 목록에없는 것을 보았습니다. grails 2.x에서 "최대 절전 모드 : $ grailsVersion은 더 이상 받아 들여지지 않습니다. 그것은 2.3.0으로 지정되어야합니다. 예를 들어 최대 절전 모드입니다 : 3.6.10.M6 2.3.4에서는 최대 절전 모드입니다 : 3.6.10.2. tomcat 플러그인과 동일 2.2.34 is 7.0.42 – Robert

0

"runtime 'mysql : mysql-connector-java : 5.1.27'"을 종속성에 추가하고 플러그인에서 제거 하시겠습니까?

+0

원래 문제는 amazon의 tomcat7 설치에 mysql connector jar 파일이 포함되지 않았기 때문에이 옵션으로 제대로 실행되지 않았기 때문입니다 – spock99

+0

그것은 확실히 의존성이 아니라 플러그인이됩니다. 그 항아리는 결국 grails 플러그인이 아닙니다. – Robert

관련 문제