Issue Details (XML | Word | Printable)

Key: GRAILS-1557
Type: Improvement Improvement
Status: Resolved Resolved
Resolution: Fixed
Priority: Major Major
Assignee: Graeme Rocher
Reporter: Brian Guan
Votes: 1
Watchers: 1
Operations

If you were logged in you would be able to see more operations.
Grails

add JNDI support to grails run-app

Created: 29/Aug/07 04:06 PM   Updated: 20/Sep/07 09:16 AM   Resolved: 20/Sep/07 09:16 AM
Return to search
Component/s: Project infrastructure
Affects Version/s: 0.6-RC1
Fix Version/s: 1.0-RC1

Time Tracking:
Not Specified

File Attachments: 1. Text File grails-jndi.patch (4 kB)
2. Java Archive File jetty-naming-6.1.4.jar (27 kB)
3. Java Archive File jetty-plus-6.1.4.jar (56 kB)



 Description  « Hide

(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


Brian Guan added a comment - 30/Aug/07 12:50 PM

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.


Graeme Rocher added a comment - 08/Sep/07 02:46 AM

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