grails - 将Grails连接到Nexmo插件时出错

标签 grails plugins nexmo

将Grails连接到Nexmo插件时出现一些错误。为什么会出现如下所示的错误?谁能解决这个问题?

下面的“BuildConfig.groovy”:

grails.project.class.dir = "target/classes"
grails.project.test.class.dir = "target/test-classes"
grails.project.test.reports.dir = "target/test-reports"

grails.project.fork = [
// configure settings for compilation JVM, note that if you alter the Groovy version forked compilation is required
//  compile: [maxMemory: 256, minMemory: 64, debug: false, maxPerm: 256, daemon:true],

// configure settings for the test-app JVM, uses the daemon by default
test   : [maxMemory: 768, minMemory: 64, debug: false, maxPerm: 256, daemon: true],
// configure settings for the run-app JVM
run    : [maxMemory: 768, minMemory: 64, debug: false, maxPerm: 256, forkReserve: false],
// configure settings for the run-war JVM
war    : [maxMemory: 768, minMemory: 64, debug: false, maxPerm: 256, forkReserve: false],
// configure settings for the Console UI JVM
console: [maxMemory: 768, minMemory: 64, debug: false, maxPerm: 256]
]

grails.project.dependency.resolver = "maven" // or ivy
grails.project.dependency.resolution = {
// inherit Grails' default dependencies
inherits("global") {
// uncomment to disable ehcache
// excludes 'ehcache'
}
log "warn" // log level of Ivy resolver, either 'error', 'warn', 'info', 'debug' or 'verbose'
repositories {
grailsCentral()
mavenLocal()
mavenCentral()
// uncomment the below to enable remote dependency resolution
// from public Maven repositories
//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.27'
}

plugins {
  build ':tomcat:7.0.52.1'
  runtime ':hibernate:3.6.10.10' // ':hibernate4:4.3.4.1' for Hibernate 4
  compile ":rest:0.8"

}
}

下面的“SmsController.groovy”:
package nexmo

class SmsControllerController {

// Inject the service
def nexmoService

def index() {
    def smsResult
    def callResult

    try {
        // Send the message "What's up?" to 1-500-123-4567
        smsResult = nexmoService.sendSms("61451062006", "What's up?")

        System.out.println("Try block message");

    }

        catch (Exception e) {
            // Handle error if failure
            System.out.println("Error: Don't divide a number by zero");
        }
    }
}

以下错误:
context.ContextLoader Context initialization failed
org.springframework.beans.factory.BeanDefinitionStoreException: IOException parsing XML document from ServletContext resource [/WEB-INF/applicationContext.xml]; nested exception is java.io.FileNotFoundException: C
ould not open ServletContext resource [/WEB-INF/applicationContext.xml]
    at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    at java.lang.Thread.run(Thread.java:745)
Caused by: java.io.FileNotFoundException: Could not open ServletContext resource [/WEB-INF/applicationContext.xml]
    ... 4 more
context.GrailsContextLoaderListener Error initializing the application: IOException parsing XML document from ServletContext resource [/WEB-INF/applicationContext.xml]; nested exception is java.io.FileNotFoundExce
ption: Could not open ServletContext resource [/WEB-INF/applicationContext.xml]
org.springframework.beans.factory.BeanDefinitionStoreException: IOException parsing XML document from ServletContext resource [/WEB-INF/applicationContext.xml]; nested exception is java.io.FileNotFoundException: C
ould not open ServletContext resource [/WEB-INF/applicationContext.xml]
    at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    at java.lang.Thread.run(Thread.java:745)
Caused by: java.io.FileNotFoundException: Could not open ServletContext resource [/WEB-INF/applicationContext.xml]
    ... 4 more
| Error Forked Grails VM exited with error

最佳答案

错误文本表明您的webapp/WEB-INF/applicationContext.xml已删除。要还原它,请使用相同版本的Grails创建一个新的空应用程序,然后从那里复制文件。如果还丢失了sitemesh.xml,还应复制web-app/WEB-INF/tld的.tld文件。

关于grails - 将Grails连接到Nexmo插件时出错,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33049377/

相关文章:

c++ - 插件类未包含在 UE4 构建中

grails - Grails用于插入Nexmo插件的错误

node.js - 将音频文件转换为 16 位线性 PCM

Grails hasOne vs.belongsTo

hibernate - 如果用withNewSession包装,grails创建条件非唯一对象错误

grails - Grails 3应用程序-使用Turo的pushy插件的Apple Push通知

mysql - Grails:如何在加密列中搜索关键字并获取行

plugins - 如何检查和访问 Maven Artifacts 的 javadoc/source

java.lang.AbstractMethodError : I get this exception when I am trying to initiate an outbound voice call using nexmo(vonage) API

java - 将项目添加到插件