Announcement Announcement Module
No announcement yet.
Creating a JNDI context within a Spring application Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • Creating a JNDI context within a Spring application

    Hey all, I just read an old thread on this forum that discussed two options for creating a JNDI context using Spring:
    1. Use SimpleNamingContextBuilder
    2. Create a class that instantiates InitialContext and call its method createSubcontext()
    I need to integrate with legacy components, but I want to move away from container integration. So I'd like to create the context in Spring. I can think of arguments against each:
    • SimpleNamingContextBuilder: The Javadoc says it is "mainly targeted at test environments", but is "also usable for standalone applications". It doesn't mention web apps. Plus, it has "mock" in its package name.
    • InitialContext: This seems like such standard code that I expected Spring to already provide it. It's so irrelevant to my problem domain that (now that I know Spring) I feel strange putting it in our package.
    Is it okay to use SimpleNamingContextBuilder in a production webapp?
    Is there another Spring option that I'm not aware of?

  • #2
    Have a look at org.apache.xbean.spring.jndi.SpringInitialContextF actory

    Id also be interested to see what others had to say about SimpleNamingContextBuilder in a non test environment....

    I trying to get Spring, Jpa and JTA to work together, i need to expose the userTransaction through JNDI....