Announcement Announcement Module
Collapse
No announcement yet.
How to set JNDI object? Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • How to set JNDI object?

    Hi all,

    I got a legacy library that use initialcontext.lookup("java:comp/env/config/Foo") to get an object.

    In tomcat I need to write the following lines in context xml:
    HTML Code:
    <Resource name="config/Foo" type="com.foo.Foo" auth="Container"/>
    <ResourceParams name="config/Foo">
      <parameter>
        <name>factory</name>
        <value>org.apache.naming.factory.BeanFactory</value>
      </parameter>
    </ResourceParams>

    However, I don't want to touch tomcat's xml file. Is it possible to config with spring instead?

  • #2
    Check the reference guide the part about tje jee namespace is the one you want.

    Code:
    <jee:jndi-lookup id="simple" jndi-name="java:comp/env/config/Foo"/>
    The code above is basically what you have to do. Check the guide for more information on the topic also the samples give a brief introduction into this.

    Comment

    Working...
    X