From 6c08b3af09e712e43f5e04d4a9666894ac644b3d Mon Sep 17 00:00:00 2001 From: Burt Beckwith Date: Sat, 30 Apr 2016 21:39:19 -0400 Subject: [PATCH] fix for #14 --- .../tomcat/InlineExplodedTomcatServer.groovy | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/src/groovy/org/grails/plugins/tomcat/InlineExplodedTomcatServer.groovy b/src/groovy/org/grails/plugins/tomcat/InlineExplodedTomcatServer.groovy index 656bc0e..e85bf84 100644 --- a/src/groovy/org/grails/plugins/tomcat/InlineExplodedTomcatServer.groovy +++ b/src/groovy/org/grails/plugins/tomcat/InlineExplodedTomcatServer.groovy @@ -27,6 +27,7 @@ import org.apache.catalina.Loader import org.apache.catalina.WebResourceRoot import org.apache.catalina.startup.Tomcat import org.apache.catalina.webresources.StandardRoot +import org.apache.tomcat.util.descriptor.web.ContextResource import org.codehaus.groovy.grails.plugins.GrailsPluginUtils import org.grails.plugins.tomcat.fork.ForkedTomcatServer @@ -128,16 +129,16 @@ class InlineExplodedTomcatServer extends TomcatServer { return } - if (!resCfg["type"]) { + if (!resCfg.type) { throw new IllegalArgumentException("Must supply a resource type for JNDI configuration") } - def res = loadInstance('org.apache.catalina.deploy.ContextResource') - res.name = name - res.type = resCfg.remove("type") - res.auth = resCfg.remove("auth") - res.description = resCfg.remove("description") - res.scope = resCfg.remove("scope") + def res = new ContextResource( + auth: resCfg.remove('auth'), + description: resCfg.remove("description"), + name: name, + scope: resCfg.remove('scope'), + type: resCfg.remove('type')) // now it's only the custom properties left in the Map... resCfg.each { key, value -> res.setProperty key, value }