本文介绍了如何在web.xml中引用websphere资源环境提供程序?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们使用资源环境提供程序在websphere中定义了自定义属性,该提供程序是使用

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

在第6节的那篇文章中,它说对于Web模块,使用部署描述符编辑器打开web.xml文件(对于EJB模块,打开ejb-jar.xml文件)。

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."

我需要手动编辑 web.xml ,因为此时我无法使用IBM开发工具。是否存在可以提供GUI创建的xml片段的文档? Google在这一点上让我失望

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

推荐答案

您可以手动将其添加到web.xml和ibm-web-bnd.xml(这是与您提到的DW文章相对应的示例,请相应更改):

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

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>

之后,您可以使用JNDI查找java:comp / env / MyConstants并获取Config对象。

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

这篇关于如何在web.xml中引用websphere资源环境提供程序?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-25 09:52