1

刚刚将我的项目升级到grails 2.3,并根据要求链接了hibernate插件(运行时“:hibernate:3.6.10.1”);

无论如何,在执行时(运行应用程序),我有以下错误:

           2013-09-12 14:35:19,107 INFO  [FilterSecurityInterceptor] - Validated configuration attributes
        Error initializing the application: Error creating bean with name 'hibernateDatastore': Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [org.codehaus.groovy.grails.orm.hibernate.HibernateDatastore]: Constructor threw exception; nested exception is java.lang.IllegalArgumentException: ApplicationContext must be an instanceof ConfigurableApplicationContext Object of class [null] must be an instance of interface org.springframework.context.ConfigurableApplicationContext
        org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'hibernateDatastore': Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [org.codehaus.groovy.grails.orm.hibernate.HibernateDatastore]: Constructor threw exception; nested exception is java.lang.IllegalArgumentException: ApplicationContext must be an instanceof ConfigurableApplicationContext Object of class [null] must be an instance of interface org.springframework.context.ConfigurableApplicationContext
                at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
                at java.util.concurrent.FutureTask.run(FutureTask.java:138)
                at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:895)
                at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:918)
                at java.lang.Thread.run(Thread.java:680)
        Caused by: org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [org.codehaus.groovy.grails.orm.hibernate.HibernateDatastore]: Constructor threw exception; nested exception is java.lang.IllegalArgumentException: ApplicationContext must be an instanceof ConfigurableApplicationContext Object of class [null] must be an instance of interface org.springframework.context.ConfigurableApplicationContext
                ... 5 more
        Caused by: java.lang.IllegalArgumentException: ApplicationContext must be an instanceof ConfigurableApplicationContext Object of class [null] must be an instance of interface org.springframework.context.ConfigurableApplicationContext
                at org.grails.datastore.mapping.core.AbstractDatastore.<init>(AbstractDatastore.java:70)
                at org.grails.datastore.mapping.core.AbstractDatastore.<init>(AbstractDatastore.java:63)
                at org.grails.datastore.mapping.core.AbstractDatastore.<init>(AbstractDatastore.java:58)
                ... 5 more
        2013-09-12 14:35:28,830 ERROR [GrailsContextLoader] - Error initializing the application: Error creating bean with name 'hibernateDatastore': Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [org.codehaus.groovy.grails.orm.hibernate.HibernateDatastore]: Constructor threw exception; nested exception is java.lang.IllegalArgumentException: ApplicationContext must be an instanceof ConfigurableApplicationContext Object of class [null] must be an instance of interface org.springframework.context.ConfigurableApplicationContext
        org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'hibernateDatastore': Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [org.codehaus.groovy.grails.orm.hibernate.HibernateDatastore]: Constructor threw exception; nested exception is java.lang.IllegalArgumentException: ApplicationContext must be an instanceof ConfigurableApplicationContext Object of class [null] must be an instance of interface org.springframework.context.ConfigurableApplicationContext
                at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
                at java.util.concurrent.FutureTask.run(FutureTask.java:138)
                at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:895)
                at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:918)
                at java.lang.Thread.run(Thread.java:680)
        Caused by: org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [org.codehaus.groovy.grails.orm.hibernate.HibernateDatastore]: Constructor threw exception; nested exception is java.lang.IllegalArgumentException: ApplicationContext must be an instanceof ConfigurableApplicationContext Object of class [null] must be an instance of interface org.springframework.context.ConfigurableApplicationContext
                ... 5 more
        Caused by: java.lang.IllegalArgumentException: ApplicationContext must be an instanceof ConfigurableApplicationContext Object of class [null] must be an instance of interface org.springframework.context.ConfigurableApplicationContext
                at org.grails.datastore.mapping.core.AbstractDatastore.<init>(AbstractDatastore.java:70)
                at org.grails.datastore.mapping.core.AbstractDatastore.<init>(AbstractDatastore.java:63)
                at org.grails.datastore.mapping.core.AbstractDatastore.<init>(AbstractDatastore.java:58)


     ... 5 more
    Error initializing Grails: Error creating bean with name 'hibernateDatastore': Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [org.codehaus.groovy.grails.orm.hibernate.HibernateDatastore]: Constructor threw exception; nested exception is java.lang.IllegalArgumentException: ApplicationContext must be an instanceof ConfigurableApplicationContext Object of class [null] must be an instance of interface org.springframework.context.ConfigurableApplicationContext
    org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'hibernateDatastore': Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [org.codehaus.groovy.grails.orm.hibernate.HibernateDatastore]: Constructor threw exception; nested exception is java.lang.IllegalArgumentException: ApplicationContext must be an instanceof ConfigurableApplicationContext Object of class [null] must be an instance of interface org.springframework.context.ConfigurableApplicationContext
            at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
            at java.util.concurrent.FutureTask.run(FutureTask.java:138)
            at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:895)
            at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:918)
            at java.lang.Thread.run(Thread.java:680)
    Caused by: org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [org.codehaus.groovy.grails.orm.hibernate.HibernateDatastore]: Constructor threw exception; nested exception is java.lang.IllegalArgumentException: ApplicationContext must be an instanceof ConfigurableApplicationContext Object of class [null] must be an instance of interface org.springframework.context.ConfigurableApplicationContext
            ... 5 more
    Caused by: java.lang.IllegalArgumentException: ApplicationContext must be an instanceof ConfigurableApplicationContext Object of class [null] must be an instance of interface org.springframework.context.ConfigurableApplicationContext
            at org.grails.datastore.mapping.core.AbstractDatastore.<init>(AbstractDatastore.java:70)
            at org.grails.datastore.mapping.core.AbstractDatastore.<init>(AbstractDatastore.java:63)
            at org.grails.datastore.mapping.core.AbstractDatastore.<init>(AbstractDatastore.java:58)
            ... 5 more
    2013-09-12 14:35:28,834 ERROR [GrailsContextLoader] - Error initializing Grails: Error creating bean with name 'hibernateDatastore': Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [org.codehaus.groovy.grails.orm.hibernate.HibernateDatastore]: Constructor threw exception; nested exception is java.lang.IllegalArgumentException: ApplicationContext must be an instanceof 
[...]ConfigurableApplicationContext Object of class [null] must be an instance of interface org.springframework.context.ConfigurableApplicationContext
    org.springframework.beans.factory.BeanCreationException: Error creating bean with namee an instance of interface org.springframework.context.ConfigurableApplicationContext
            at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
            at java.util.concurrent.FutureTask.run(FutureTask.java:138)
            at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:895)
            at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:918)
            at java.lang.Thread.run(Thread.java:680)
    Caused by: org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [org.codehaus.groovy.grails.orm.hibernate.HibernateDatastore]: Constructor threw exception; nested exception is java.lang.IllegalArgumentException: ApplicationContext must be an instanceof ConfigurableApplicationContext Object of class [null] must be an instance of interface org.springframework.context.ConfigurableApplicationContext
            ... 5 more
    Caused by: java.lang.IllegalArgumentException: ApplicationContext must be an instanceof ConfigurableApplicationContext Object of class [null] must be an instance of interface org.springframework.context.ConfigurableApplicationContext
            at org.grails.datastore.mapping.core.AbstractDatastore.<init>(AbstractDatastore.java:70)
            at org.grails.datastore.mapping.core.AbstractDatastore.<init>(AbstractDatastore.java:63)
            at org.grails.datastore.mapping.core.AbstractDatastore.<init>(AbstractDatastore.java:58)
            ... 5 more
    Error listenerStart

我在 2.3 的 grails 配置中使用 maven 解析器:

grails.project.dependency.resolver = "maven"

插件/依赖项:

dependencies {
        def tomcatVersion = "7.0.42"
        build ("org.apache.tomcat:tomcat-catalina-ant:${tomcatVersion}") { transitive = false }
        build "org.apache.tomcat.embed:tomcat-embed-core:${tomcatVersion}"
        build "org.apache.tomcat.embed:tomcat-embed-jasper:${tomcatVersion}"
        build "org.apache.tomcat.embed:tomcat-embed-logging-log4j:${tomcatVersion}"
        build "org.apache.httpcomponents:httpcore:4.2"
        build "org.apache.httpcomponents:httpclient:4.2"
        runtime "org.apache.httpcomponents:httpcore:4.2"
        runtime "org.apache.httpcomponents:httpclient:4.2"
        runtime "mysql:mysql-connector-java:5.1.22"
        runtime "org.apache.tomcat:com.springsource.org.apache.tomcat.jdbc:1.0.9.3"
        compile ("com.lowagie:itext:2.1.7") {excludes "bcmail-jdk14", "wbcprov-jdk14", "bctsp-jdk14"}
        compile "org.jrobin:jrobin:1.5.9"
        compile "org.grails:grails-webflow:2.2.4" // $grailsVersion not compatible with grails 2.3.0
        compile "com.amazonaws:aws-java-sdk:1.5.6"
        // add s3 component to camel routing
        runtime "org.apache.camel:camel-aws:2.10.3"
        runtime "org.imgscalr:imgscalr-lib:4.2"
        //runtime 'org.springframework:spring-test:3.1.4.RELEASE'
        //test "org.spockframework:spock-grails-support:0.7-groovy-2.0"
    }

    plugins {
        build   ":tomcat:7.0.42"
        compile ":hibernate:3.6.10.1" // :hibernate4:4.1.11.1
        runtime ":database-migration:1.3.5"
        runtime ":resources:1.2"
        runtime ":jquery:1.8.3"
        compile ":cache:1.1.1"
        compile ":bean-fields:1.0"
        compile ":csv:0.3.1"
        compile ":famfamfam:1.0.1"
        compile ":form-helper:0.2.8"
        compile ":google-chart:0.5.2"
        compile ":google-visualization:0.6.2"
        compile ":jcaptcha:1.2.1"
        compile ":jdbc-pool:7.0.37"
        compile ":jquery-ui:1.8.24"
        compile ":lang-selector:0.3"
        compile ":navigation:1.3.2"
        compile ":quartz:1.0-RC9"
        compile ":quartz-monitor:0.3-RC2"
        compile ":richui:0.8"
        compile ":spring-security-core:1.2.7.3"
        compile ":spring-security-ui:0.2"
        compile ":webflow:2.0.8.1"
        compile ":rendering:0.4.4"
        // added 20/11/2012
        compile ":modernizr:2.6.2"
        compile ":spring-security-acl:1.1.1"
        // added 29/01/2013
        compile ":pdf-viewer:0.1"
        compile ":routing:1.2.3"
        compile ":taggable:1.0.1"
        // added 08/03/2013
        compile ":executor:0.3"
        compile ":gmetrics:0.3.1"
        compile ":kickstart-with-bootstrap:0.9.6"
        compile ":lesscss-resources:1.3.3"
        // added 20/08/2013
        compile ":pretty-size:0.2"
        compile ":mysql-connectorj:5.1.22.1"
        compile ":font-awesome-resources:3.2.1.2"
        compile ":aws-sdk:1.5.6"
        runtime ":cached-resources:1.1"

    }
4

1 回答 1

0

我遇到了同样的问题,并且能够通过删除该行来解决它:

compile "org.grails:grails-webflow:2.2.4"

这在 Grails 2.3 中不再需要。请参阅此处的文档。

于 2013-11-12T22:09:41.430 回答