Grails

add JNDI support to grails run-app

Details

  • Type: Improvement Improvement
  • Status: Closed Closed
  • Priority: Major Major
  • Resolution: Fixed
  • Affects Version/s: 0.6-RC1
  • Fix Version/s: 1.0-RC1
  • Component/s: Project infrastructure
  • Labels:
    None

Description

(From my email to grails dev mailing list...)

Hi Grails Devs,

For a project I am working on, I am using Grails 0.6-RC1, and
embedding components (jars, configs etc) from another pre-existing
project, unfortunately these components expects JNDI support from the
app server. I posted an email last week to Grails-User for help but
receives no advice, so I took the matter into my own hands

I made the following modification to Grails to enable JNDI in run-app:

== mod to GRAILS_HOME/scripts/Init.groovy ==

Line 41: enableJndi = System.getProperty('enable.jndi') == "true" ?
true : false

== mod to GRAILS_HOME/scripts/RunApp.groovy ==

/* within the import section */
import org.mortbay.jetty.plus.naming.*
import javax.naming.*
...
/*
within task configureHttpServer section right after:
webContext = new WebAppContext("${basedir}/web-app", "/${grailsAppName}")
*/

if (enableJndi) { def confClassList = ["org.mortbay.jetty.webapp.WebInfConfiguration", "org.mortbay.jetty.plus.webapp.EnvConfiguration", "org.mortbay.jetty.plus.webapp.Configuration", "org.mortbay.jetty.webapp.JettyWebXmlConfiguration", "org.mortbay.jetty.webapp.TagLibConfiguration"] webContext.setConfigurationClasses((String[])confClassList ) }

== additons to GRAILS_HOME/lib ==

jetty-naming-6.1.4.jar
jetty-plus-6.1.4.jar

With the above modifications, when I do this from command line:

MyProjectRoot/ > grails -Denable.jndi=true run-app

the embedded jetty instance will have JNDI support built-in.

If you like this, I can send a patch...

  • Brian
  1. grails-jndi.patch
    30/Aug/07 12:50 PM
    4 kB
    Brian Guan

Activity

Hide
Brian Guan added a comment -

Attached patch file generated from Eclipse/subclipse.

However, since I am adding 2 additional jar files, patch file does not include them, and Ivy doesn't seem to be completely integrated into the env, so I am attaching the jar files explicitly.

Show
Brian Guan added a comment - Attached patch file generated from Eclipse/subclipse. However, since I am adding 2 additional jar files, patch file does not include them, and Ivy doesn't seem to be completely integrated into the env, so I am attaching the jar files explicitly.
Hide
Graeme Rocher added a comment -

Thanks Brian, we'll try include your patch in the next release. Good job

Show
Graeme Rocher added a comment - Thanks Brian, we'll try include your patch in the next release. Good job

People

Vote (1)
Watch (1)

Dates

  • Created:
    Updated:
    Resolved: