从 Coldfusion 访问 JRUN jndi 环境变量 (java)

发布于 2024-08-27 14:42:36 字数 1330 浏览 6 评论 0原文

我想在 JNDI 中放入一些实例特定的配置信息。我查看了这里的信息: http://www.adobe.com/support/jrun/working_jrun/ jrun4_jndi_and_j2ee_enc/jrun4_jndi_and_j2ee_enc03.html

我已将此节点添加到 web.xml:

<env-entry>
  <description>Administrator e-mail address</description>
  <env-entry-name>adminemail</env-entry-name>
  <env-entry-value>[email protected]</env-entry-value>
  <env-entry-type>java.lang.String</env-entry-type>
</env-entry>

在 Coldfusion 中,我尝试了几种不同的方法来查询数据:

<cfset ctx = createobject("java","javax.naming.InitialContext") >

<cfset val = ctx.lookup("java:comp/env") >

该查找返回 jrun.naming.JRunNamingContext。如果我在 ctx 上查找我要添加的特定绑定,则会收到错误。

<cfset val = ctx.lookup("java:comp/env/adminemail") >
No such binding: adminemail 

执行 listBindings 返回一个空的 jrun.naming.JRunNamingEnumeration。

<cfset val = ctx.listBindings("java:comp/env") >

我只想将一个字符串值(可能是几个)放入 ENC(或此时的任何 JNDI 目录)中。

I want to put some instance specific configuration information in JNDI. I looked at the information here:
http://www.adobe.com/support/jrun/working_jrun/jrun4_jndi_and_j2ee_enc/jrun4_jndi_and_j2ee_enc03.html

I have added this node to the web.xml:

<env-entry>
  <description>Administrator e-mail address</description>
  <env-entry-name>adminemail</env-entry-name>
  <env-entry-value>[email protected]</env-entry-value>
  <env-entry-type>java.lang.String</env-entry-type>
</env-entry>

In coldfusion I have tried several different approaches to querying the data:

<cfset ctx = createobject("java","javax.naming.InitialContext") >

<cfset val = ctx.lookup("java:comp/env") >

That lookup returns a jrun.naming.JRunNamingContext. If i preform a lookup on ctx for the specific binding I am adding I get an error.

<cfset val = ctx.lookup("java:comp/env/adminemail") >
No such binding: adminemail 

Preforming a listBindings returns an empty jrun.naming.JRunNamingEnumeration.

<cfset val = ctx.listBindings("java:comp/env") >

I only want to put a string value (probably several) into the ENC (or any JNDI directory at this point).

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

柠栀 2024-09-03 14:42:36

从未使用过它,但我很好奇,所以我决定尝试一下……但没有成功。

我发现了这个,希望对你有帮助。

http://www.adobe.com/livedocs/coldfusion/7/htmldocs/wwhelp/wwhimpl/common/html/wwhelp.htm?context=ColdFusion_Documentation&file=00001570.htm

Never used it, but I got curious so I decided to try ... with no success.

I found this though, hopefully it helps you.

http://www.adobe.com/livedocs/coldfusion/7/htmldocs/wwhelp/wwhimpl/common/html/wwhelp.htm?context=ColdFusion_Documentation&file=00001570.htm

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文