Malcolm Sharman
Malcolm Sharman

Reputation: 543

How to reference a websphere Resource Environment Provider in web.xml?

We have custom properties defined in websphere using a Resource Environment provider that was setup using the instructions on

http://www.ibm.com/developerworks/websphere/library/techarticles/0611_totapally/0611_totapally.html

In that article in section 6, it says "For a Web module, open the web.xml file (for an EJB module, open the ejb-jar.xml file ) using the deployment descriptor editor."

I need to edit the web.xml by hand since the IBM development tools are unavailable to me at this time. Is there documentation somewhere that would provide the xml fragments that the GUI creates? Google has failed me on this point

Upvotes: 1

Views: 3428

Answers (1)

Magic Wand
Magic Wand

Reputation: 1760

You can add it manually into web.xml and ibm-web-bnd.xml (this is example that corresponds to the DW article you mentioned, please change it accordingly):

web.xml

<resource-env-ref>
    <description />
    <resource-env-ref-name>MyConstants</resource-env-ref-name>
    <resource-env-ref-type>com.ibm.acme.ree.lib.Config</resource-env-ref-type>
</resource-env-ref>

ibm-web-bnd.xml

<?xml version="1.0" encoding="UTF-8"?>
<web-bnd xmlns="http://websphere.ibm.com/xml/ns/javaee"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://websphere.ibm.com/xml/ns/javaee http://websphere.ibm.com/xml/ns/javaee/ibm-web-bnd_1_0.xsd"  version="1.0">
    <resource-env-ref name="MyConstants" binding-name="rep/dev/app1/MyResourceReference" />
</web-bnd>

After that you can use JNDI to lookup java:comp/env/MyConstants and get Config object.

Upvotes: 4

Related Questions