2012-11-30 25 views
5

Khi tôi cố gắng chạy grails tôi ứng dụng tôi đã nhận lỗi sau:Không thể chạy ứng dụng Grails?

Error 2012-11-30 15:35:57,948 [localhost-startStop-1] ERROR context.ContextLoader - Context initialization failed 
Message: Error creating bean with name 'pluginManager' defined in ServletContext resource [/WEB-INF/applicationContext.xml]: Invocation of init method failed; nested exception is java.lang.RuntimeException: Unable to locate constructor with Class parameter for class org.codehaus.groovy.grails.commons.DefaultGrailsServiceClass 
    Line | Method 
->> 303 | innerRun in java.util.concurrent.FutureTask$Sync 
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
| 138 | run  in java.util.concurrent.FutureTask 
| 886 | runTask in java.util.concurrent.ThreadPoolExecutor$Worker 
| 908 | run  in  '' 
^ 680 | run . . in java.lang.Thread 
Caused by RuntimeException: Unable to locate constructor with Class parameter for class org.codehaus.groovy.grails.commons.DefaultGrailsServiceClass 
->> 303 | innerRun in java.util.concurrent.FutureTask$Sync 
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
| 138 | run  in java.util.concurrent.FutureTask 
| 886 | runTask in java.util.concurrent.ThreadPoolExecutor$Worker 
| 908 | run  in  '' 
^ 680 | run . . in java.lang.Thread 
Caused by InvocationTargetException: null 
->> 303 | innerRun in java.util.concurrent.FutureTask$Sync 
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
| 138 | run  in java.util.concurrent.FutureTask 
| 886 | runTask in java.util.concurrent.ThreadPoolExecutor$Worker 
| 908 | run  in  '' 
^ 680 | run . . in java.lang.Thread 
Caused by NoClassDefFoundError: com/lp/labs/scconnector/GitConnector 
->> 2427 | privateGetDeclaredMethods in java.lang.Class 
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
| 1791 | getDeclaredMethods in  '' 
| 303 | innerRun in java.util.concurrent.FutureTask$Sync 
| 138 | run  in java.util.concurrent.FutureTask 
| 886 | runTask in java.util.concurrent.ThreadPoolExecutor$Worker 
| 908 | run  in  '' 
^ 680 | run . . in java.lang.Thread 
Caused by ClassNotFoundException: com.lp.labs.scconnector.GitConnector 
->> 202 | run  in java.net.URLClassLoader$1 
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
| 190 | findClass in java.net.URLClassLoader 
| 306 | loadClass in java.lang.ClassLoader 
| 247 | loadClass in  '' 
| 2427 | privateGetDeclaredMethods in java.lang.Class 
| 1791 | getDeclaredMethods in  '' 
| 303 | innerRun in java.util.concurrent.FutureTask$Sync 
| 138 | run  in java.util.concurrent.FutureTask 
| 886 | runTask in java.util.concurrent.ThreadPoolExecutor$Worker 
| 908 | run  in  '' 
^ 680 | run . . in java.lang.Thread 
| Error 2012-11-30 15:35:58,068 [localhost-startStop-1] ERROR context.GrailsContextLoader - Error executing bootstraps: Error creating bean with name 'pluginManager' defined in ServletContext resource [/WEB-INF/applicationContext.xml]: Invocation of init method failed; nested exception is java.lang.RuntimeException: Unable to locate constructor with Class parameter for class org.codehaus.groovy.grails.commons.DefaultGrailsServiceClass 
Message: Error creating bean with name 'pluginManager' defined in ServletContext resource [/WEB-INF/applicationContext.xml]: Invocation of init method failed; nested exception is java.lang.RuntimeException: Unable to locate constructor with Class parameter for class org.codehaus.groovy.grails.commons.DefaultGrailsServiceClass 
    Line | Method 
->> 303 | innerRun in java.util.concurrent.FutureTask$Sync 
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
| 138 | run  in java.util.concurrent.FutureTask 
| 886 | runTask in java.util.concurrent.ThreadPoolExecutor$Worker 
| 908 | run  in  '' 
^ 680 | run . . in java.lang.Thread 
Caused by RuntimeException: Unable to locate constructor with Class parameter for class org.codehaus.groovy.grails.commons.DefaultGrailsServiceClass 
->> 303 | innerRun in java.util.concurrent.FutureTask$Sync 
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
| 138 | run  in java.util.concurrent.FutureTask 
| 886 | runTask in java.util.concurrent.ThreadPoolExecutor$Worker 
| 908 | run  in  '' 
^ 680 | run . . in java.lang.Thread 
Caused by InvocationTargetException: null 
->> 303 | innerRun in java.util.concurrent.FutureTask$Sync 
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
| 138 | run  in java.util.concurrent.FutureTask 
| 886 | runTask in java.util.concurrent.ThreadPoolExecutor$Worker 
| 908 | run  in  '' 
^ 680 | run . . in java.lang.Thread 
Caused by NoClassDefFoundError: com/lp/labs/scconnector/GitConnector 
->> 2427 | privateGetDeclaredMethods in java.lang.Class 
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
| 1791 | getDeclaredMethods in  '' 
| 303 | innerRun in java.util.concurrent.FutureTask$Sync 
| 138 | run  in java.util.concurrent.FutureTask 
| 886 | runTask in java.util.concurrent.ThreadPoolExecutor$Worker 
| 908 | run  in  '' 
^ 680 | run . . in java.lang.Thread 
Caused by ClassNotFoundException: com.lp.labs.scconnector.GitConnector 
    ->> 202 | run  in java.net.URLClassLoader$1 
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
    | 190 | findClass in java.net.URLClassLoader 
    | 306 | loadClass in java.lang.ClassLoader 
    | 247 | loadClass in  '' 
    | 2427 | privateGetDeclaredMethods in java.lang.Class 
    | 1791 | getDeclaredMethods in  '' 
    | 303 | innerRun in java.util.concurrent.FutureTask$Sync 
    | 138 | run  in java.util.concurrent.FutureTask 
    | 886 | runTask in java.util.concurrent.ThreadPoolExecutor$Worker 
    | 908 | run  in  '' 

^ 680 | run . . in java.lang.Thread 

và đây là tập tin build.config tôi:

grails.servlet.version = "2.5" // Change depending on target container compliance (2.5 or 3.0) 
grails.project.class.dir = "target/classes" 
grails.project.test.class.dir = "target/test-classes" 
grails.project.test.reports.dir = "target/test-reports" 
grails.project.target.level = 1.6 
grails.project.source.level = 1.6 
//grails.project.war.file = "target/${appName}-${appVersion}.war" 

grails.project.dependency.resolution = { 
    // inherit Grails' default dependencies 
    inherits("global") { 
     // specify dependency exclusions here; for example, uncomment this to disable ehcache: 
     // excludes 'ehcache' 
    } 
    log "warn" // log level of Ivy resolver, either 'error', 'warn', 'info', 'debug' or 'verbose' 
    checksums true // Whether to verify checksums on resolve 

    repositories { 
     inherits true // Whether to inherit repository definitions from plugins 

     grailsPlugins() 
     grailsHome() 
     grailsCentral() 

     mavenLocal() 
     mavenCentral() 

     // uncomment these (or add new ones) to enable remote dependency resolution from public Maven repositories 
     //mavenRepo "http://snapshots.repository.codehaus.org" 
     //mavenRepo "http://repository.codehaus.org" 
     //mavenRepo "http://download.java.net/maven/2/" 
     //mavenRepo "http://repository.jboss.com/maven2/" 
    } 
    dependencies { 
     // specify dependencies here under either 'build', 'compile', 'runtime', 'test' or 'provided' scopes eg. 

     // runtime 'mysql:mysql-connector-java:5.1.20' 
     compile 'org.eclipse.jgit:org.eclipse.jgit:2.0.0.201206130900-r' 
     compile 'SC-Connector:SC-Connector:1.0' 
     compile 'AccountConnector:AccountConnector:1.0' 


     // runtime 
     runtime 'org.springframework.ws:spring-xml:2.0.4.RELEASE' 
     runtime 'org.springframework.ws:spring-ws-core:2.0.4.RELEASE' 
     runtime 'com.thoughtworks.xstream:xstream:1.4.2' 
     runtime 'org.springframework.ws:spring-oxm:3.1.0.RELEASE' 
     runtime 'org.springframework.ws:spring-oxm-tiger:1.5.10' 
     runtime 'com.sun.xml.bind:jaxb-impl:2.1.12' 
     runtime 'javax.xml.bind:jaxb-api:2.1' 
     runtime 'com.google.guava:guava:13.0.1' 
     runtime 'xmlpull:xmlpull:1.1.3.1' 

    } 

    plugins { 
     runtime ":hibernate:$grailsVersion" 
     runtime ":jquery:1.7.2" 
     runtime ":resources:1.1.6" 

     build ":tomcat:$grailsVersion" 

     runtime ":database-migration:1.1" 

     compile ':cache:1.0.0' 
    } 
} 

Tôi nghĩ rằng các lớp học đang trên đường dẫn lớp của tôi vì vậy tôi không nghĩ rằng đó là một vấn đề đường dẫn lớp. Có ai có ý tưởng làm thế nào để giải quyết nó?

Cảm ơn,

+2

Vui lòng cung cấp thêm thông tin. Phiên bản grails là gì? Đây là một dự án mới? Bạn đã thử 'grails clean' và' grails compile' chưa? –

+0

phiên bản grails là 2.1.1. Tôi đã sao chép dự án này sang một máy khác và nó đã hoạt động. Tôi đã thử làm sạch và chạy lại dự án nhưng nó vẫn hiển thị cùng một lỗi. –

+0

Bạn có thể đăng buildConfig của mình không? 'com.lp.labs.scconnector.GitConnector' là một số lớp riêng? Tôi không tìm thấy gì về điều đó. –

Trả lời

7

com.lp.labs.scconnector.GitConnector trong tệp jar trong thư mục lib? Nếu vậy, hãy chạy grails compile --refresh-dependencies để Grails thêm nó vào đường dẫn lớp

+0

Có trong tệp jar trong thư mục lib. Tôi chạy lệnh này và không có gì thay đổi –

+0

Bạn có chạy từ dòng lệnh hoặc IDE của bạn không? Để nó được nhận diện trong STS, bạn cần chạy Grails Tools | Refresh Dependencies để STS tự đồng bộ với classpath Grails. –

+0

Tôi chạy phụ thuộc làm mới từ STS nhưng không hoạt động. –

1

có thể là do các lý do khác, tôi đã gặp lỗi tương tự và sau khi tham khảo ý kiến ​​ở khắp mọi nơi tôi đề nghị tạo một Grails-CLEAN và mọi thứ đã được giải quyết.

Các vấn đề liên quan