【问题标题】:How to get working Grails 2.2.4 with Oracle 12c?如何让 Grails 2.2.4 与 Oracle 12c 一起工作?
【发布时间】:2016-04-06 05:03:30
【问题描述】:

Debian 8.2 Java 7 + jre 圣杯 2.2.4 甲骨文 12c 雄猫 7

安装 Oracle 12c 后无法启动 grails。 在 Debian 8.2 + Oracle 10XE 上一切正常。 求帮助

app.log:

        2016-01-01 20:57:43,245 [localhost-startStop-1] ERROR resource.ResourceMeta  - While processing /bundle-bundle_applications_head.css, /styles/dist/gui/core/main.css, /styles/dist/gui/core/top-panel.css, /styles/dist/gui/core/footer.css, /styles/dist/gui/core/general/modal-window.css, /styles/dist/gui/core/general/metro-tiles.css, /styles/dist/gui/core/general/buttons.css, /styles/src/libs/jquery.mCustomScrollbar.css, a resource was required but not found: /styles/src/libs/mCSB_buttons.png
    2016-01-01 20:57:46,005 [localhost-startStop-1] ERROR context.GrailsContextLoader  - Error initializing the application: groovy.lang.MissingMethodException: No signature of method: cz.test.dto.system.Client.findAll() is applicable for argument types: () values: []
    Possible solutions: findAll(), findAll(), findAll(groovy.lang.Closure), findAll(java.lang.Object), findAll(java.lang.String), findAll(groovy.lang.Closure)
    org.codehaus.groovy.runtime.InvokerInvocationException: groovy.lang.MissingMethodException: No signature of method: cz.test.dto.system.Client.findAll() is applicable for argument types: () values: []
    Possible solutions: findAll(), findAll(), findAll(groovy.lang.Closure), findAll(java.lang.Object), findAll(java.lang.String), findAll(groovy.lang.Closure)
        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.run(FutureTask.java:262)
        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:745)
    Caused by: groovy.lang.MissingMethodException: No signature of method: cz.test.dto.system.Client.findAll() is applicable for argument types: () values: []
    Possible solutions: findAll(), findAll(), findAll(groovy.lang.Closure), findAll(java.lang.Object), findAll(java.lang.String), findAll(groovy.lang.Closure)
        at cz.test.libs.core.privileges.PrivilegeApiService.generateAccessRules(PrivilegeApiService.groovy:45)
        at BootStrap$_closure1.doCall(BootStrap.groovy:259)
        ... 8 more
    2016-01-01 20:57:46,012 [localhost-startStop-1] ERROR context.GrailsContextLoader  - Error initializing Grails: groovy.lang.MissingMethodException: No signature of method: cz.test.dto.system.Client.findAll() is applicable for argument types: () values: []
    Possible solutions: findAll(), findAll(), findAll(groovy.lang.Closure), findAll(java.lang.Object), findAll(java.lang.String), findAll(groovy.lang.Closure)
    org.codehaus.groovy.runtime.InvokerInvocationException: groovy.lang.MissingMethodException: No signature of method: cz.test.dto.system.Client.findAll() is applicable for argument types: () values: []
    Possible solutions: findAll(), findAll(), findAll(groovy.lang.Closure), findAll(java.lang.Object), findAll(java.lang.String), findAll(groovy.lang.Closure)
        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.run(FutureTask.java:262)
        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:745)
    Caused by: groovy.lang.MissingMethodException: No signature of method: cz.test.dto.system.Client.findAll() is applicable for argument types: () values: []
    Possible solutions: findAll(), findAll(), findAll(groovy.lang.Closure), findAll(java.lang.Object), findAll(java.lang.String), findAll(groovy.lang.Closure)
        at cz.test.libs.core.privileges.PrivilegeApiService.generateAccessRules(PrivilegeApiService.groovy:45)
        at BootStrap$_closure1.doCall(BootStrap.groovy:259)
        ... 8 more

DataSource.Groovy:

    dataSource {
    pooled = true
    driverClassName = "org.h2.Driver"
    username = "sa"
    password = ""
}

hibernate {
    cache.use_second_level_cache = true
    cache.use_query_cache = false
    cache.region.factory_class = 'net.sf.ehcache.hibernate.EhCacheRegionFactory'
}


// environment specific settings
environments {
    development {
        dataSource_system {
            dbCreate = "update"
            pooled = true
            url = "jdbc:oracle:thin:@localhost:1521:xe"
            driverClassName = 'oracle.jdbc.OracleDriver'
            username = "user"
            password = "pass"
        }

        dataSource_usersettings {
            dbCreate = "update"
            pooled = true
            url = "jdbc:oracle:thin:@localhost:1521:xe"
            driverClassName = 'oracle.jdbc.OracleDriver'
            username = "user"
            password = "pass"
        }
    }

    production {
        dataSource_system {
            dbCreate = "update"
            pooled = true
            url = "jdbc:oracle:thin:@localhost:1521:xe"
            driverClassName = 'oracle.jdbc.OracleDriver'
            username = "user"
            password = "pass"
        }

        dataSource_usersettings {
            dbCreate = "update"
            pooled = true
            url = "jdbc:oracle:thin:@localhost:1521:xe"
            driverClassName = 'oracle.jdbc.OracleDriver'
            username = "user"
            password = "pass"
        }
    }
}

Build.Config.groovy

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"

// uncomment (and adjust settings) to fork the JVM to isolate classpaths
//grails.project.fork = [
//   run: [maxMemory:1024, minMemory:64, debug:false, maxPerm:256]
//]

grails.project.dependency.resolution = {
    // inherit Grails' default dependencies
    inherits("global") {
        // specify dependency exclusions here; for example, uncomment this to disable ehcache:
        // excludes 'ehcache'
    }
    log "error" // log level of Ivy resolver, either 'error', 'warn', 'info', 'debug' or 'verbose'
    checksums true // Whether to verify checksums on resolve
    legacyResolve false // whether to do a secondary resolve on plugin installation, not advised and here for backwards compatibility

    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 e.g.

        // runtime 'mysql:mysql-connector-java:5.1.22'
    }

    plugins {
        runtime ":hibernate:$grailsVersion"
        runtime ":jquery:1.8.3"
        runtime ":resources:1.2"

        // 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"

        runtime ":database-migration:1.3.2"

        compile ':cache:1.0.1'
    }
}

【问题讨论】:

  • 可能是休眠问题。 AFAIK,休眠尚未使用 12c 进行测试。您能否发布更多详细信息 - 您的 datasource.groovy?
  • 编辑了第一篇文章,如果需要更多信息,请告诉。)
  • 我看不到您连接到 oracle - 只有 h2...您使用的是哪个休眠版本 (buildconfig.groovy)?
  • grails-hibernate-2.2.4-sources.jar
  • 我没有看到您已经在数据源中配置了与 Oracle 数据库的连接...只有 h2。这是正确的吗?

标签: grails oracle12c oracle-xe


【解决方案1】:

无论如何通过链接 JAVA_HOME 解决了这个问题 export JAVA_HOME= 没有工作,所以我使用 /tomcat/bin/patchclas.sh / env.sh 并做了一些 export JAVA_HOME= 最后得到了这个工作:)

【讨论】:

    【解决方案2】:

    对于任何偶然发现这个问题并试图让旧的 grails 应用程序与 Oracle 12c 一起运行的人,我必须做的是在 DataSource.groovy 文件中明确指定方言:

    dataSource_system {
                dbCreate = "update"
                pooled = true
                url = "jdbc:oracle:thin:@localhost:1521:xe"
                driverClassName = 'oracle.jdbc.OracleDriver'
                username = "user"
                password = "pass"
                dialect = SequencePerTableOracleDialect
    }
    

    【讨论】:

      猜你喜欢
      • 2015-08-10
      • 1970-01-01
      • 2018-07-16
      • 2023-02-02
      • 2011-06-07
      • 2017-06-25
      • 2020-12-13
      • 2012-02-02
      • 2011-02-22
      相关资源
      最近更新 更多