I'm getting some errors when connecting Grails to Nexmo plugin. Why is it getting errors like below? Can anyone please solve the issues?
'BuildConfig.groovy' below:
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' below:
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");
}
}
}
Errors below:
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
The error text indicates that your webapp/WEB-INF/applicationContext.xml
was deleted. To restore it create a new empty app with the same version of Grails and copy the file from there. Also copy sitemesh.xml
if it's also missing, and the .tld files from web-app/WEB-INF/tld
.