Skip to content

Commit

Permalink
JNDI bug fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Burt Beckwith committed Jun 14, 2012
1 parent 20ea5f4 commit ed5159a
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions src/groovy/org/grails/jetty/JettyServer.groovy
Expand Up @@ -140,6 +140,9 @@ class JettyServer implements EmbeddableServer {

context = new WebAppContext(webappRoot, contextPath)

setSystemProperty 'java.naming.factory.url.pkgs', 'org.eclipse.jetty.jndi'
setSystemProperty 'java.naming.factory.initial', 'org.eclipse.jetty.jndi.InitialContextFactory'

def configurations = [
WebInfConfiguration,
WebXmlConfiguration,
Expand All @@ -153,8 +156,8 @@ class JettyServer implements EmbeddableServer {
def grailsJndi = grailsConfig?.grails?.development?.jetty?.env
if (grailsJndi) {
def res = new FileSystemResource(grailsJndi.toString())
if (res) {
EnvConfiguration jndiConfig = configurations[1]
if (res.exists()) {
EnvConfiguration jndiConfig = configurations[4]
jndiConfig.jettyEnvXml = res.URL
}
}
Expand All @@ -167,6 +170,12 @@ class JettyServer implements EmbeddableServer {
System.setProperty 'TomcatKillSwitch.active', 'true' // workaround to prevent server exiting
}

protected void setSystemProperty(String name, String value) {
if (!System.getProperty(name)) {
System.setProperty name, value
}
}

/**
* Configures a new Jetty Server instance for the given WebAppContext
*/
Expand Down

0 comments on commit ed5159a

Please sign in to comment.