Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 364946

Summary: Request: direct configuration of JNDI resources
Product: [RT] Jetty Reporter: Bear Giles <bgiles>
Component: serverAssignee: Jan Bartel <janb>
Status: CLOSED INVALID QA Contact:
Severity: enhancement    
Priority: P3 CC: janb, jetty-inbox
Version: unspecified   
Target Milestone: 7.5.x   
Hardware: PC   
OS: Linux   
Whiteboard:

Description Bear Giles CLA 2011-11-28 08:04:59 EST
Build Identifier: 

Enhancement request: support direct configuration of JNDI Resources (e.g., programmatically or via spring beans containing references, etc.) or clear documentation of why this isn't possible.

Rationale: I'm using Jetty + H2 for testng integration testing and following the convention that all of my working files are in a unique directory. The directory is nuked if all tests are successful but left in place for a post-mortem if there's a failure. This approach doesn't work if values are hardcoded, e.g., the location of the H2 backing file.

There's one work-around of creating the jetty.xml or jetty-env.xml file on the fly but that's ugly. (More precisely I would be putting it into a string and then using creating an InputStream for it but that's a detail.)  I believe there's also a workaround in setting system properties and using property placeholders in my spring configuration file - I already need this to specify the location of the database but the "don't repeat yourself" philosophy says it would be better to have a bean reference than repeating the exact connection information.

Why it may not work: I don't know the details of how well the JNDI resources (e.g., data sources) play with the threading model used by the jetty server. Maybe the server has to open the resources itself. If so it would be nice to have this clearly documented so people won't waste time trying to figure out how to do it.

BTW I am using version 8.0.

Reproducible: Always

Steps to Reproduce:
N/A - enhancement request.
Comment 1 Jan Bartel CLA 2011-12-05 01:18:15 EST
Bear,

I don't quite understand what you would like to do, can you give an example or explain a little more? BTW, anything that you can do in any jetty xml configuration file can be done in code. This is also true of setting up the JNDI resources.

regards
Jan
Comment 2 Jan Bartel CLA 2012-01-12 01:20:51 EST
Any response to my question?

thanks
Jan
Comment 3 Jan Bartel CLA 2012-08-05 23:30:27 EDT
I'm closing this issue for now, as there's been no further clarifying input from the original reporter. To reiterate, configuration of jndi resources can be accomplished programmatically in jetty as well as via xml.

If you have an example of what you want to achieve, but cannot do now, then please reopen and provide the information.

Jan