2015-10-10 2 views
0

У меня возникают некоторые ошибки при подключении плагина Grails к 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 

ответ

1

Текст ошибки указывает, что ваш webapp/WEB-INF/applicationContext.xml удален. Чтобы восстановить его, создайте новое пустое приложение с той же версией Grails и скопируйте файл оттуда. Также скопируйте sitemesh.xml, если он также отсутствует, и .tld файлы от web-app/WEB-INF/tld.

+0

Спасибо, но все еще получаю ошибки, как показано ниже: –

+0

Это похоже на другую проблему. Опубликуйте информацию в новом вопросе, в этом комментарии недостаточно места для комментариев –

+0

Спасибо за ваш ответ. Я помещал ошибки в новый вопрос с заголовком: «Ошибки Grails при подключении к sms-плагину» –