将自定义对象添加到 Weblogic 10 上的 JNDI

发布于 2024-08-17 15:11:35 字数 104 浏览 3 评论 0原文

是否可以使用 Weblogic Server 管理控制台 (Weblogic 10.0) 或通过编辑服务器的配置文件 (config.xml) 将自定义对象(字符串或 URL)添加到 JNDI?

Is it possible to add a custom object (String or URL) to JNDI using Weblogic Server Administration Console (Weblogic 10.0) or by editing server's configuration file (config.xml)?

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

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

发布评论

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

评论(3

乜一 2024-08-24 15:11:35

我不这么认为。引用 在 JNDI 树中加载对象:

使用管理控制台,您可以在 JNDI 树中加载 WebLogic Server J2EE 服务和组件,例如 RMI、JMS、EJB 和 JDBC 数据源。

事实上,我找不到使用控制台添加 StringURL 的方法。

AFAIK,标准方法是将 env-entry 放入部署描述符(web.xml、ejb-jar.xml)中:

<env-entry>
    <env-entry-name>string/foo</env-entry-name>
    <env-entry-type>java.lang.String</env-entry-type>
    <env-entry-value>foobar</env-entry-value>
</env-entry>

<env-entry>
    <env-entry-name>url/bar</env-entry-name>
    <env-entry-type>java.net.URL</env-entry-type>
    <env-entry-value>http://foobar/</env-entry-value>
</env-entry>

I don't think so. Quoting Load objects in the JNDI tree:

Using the Administration Console, you can load WebLogic Server J2EE services and components, such as RMI, JMS, EJBs, and JDBC Data Sources, in the JNDI tree.

And indeed, I couldn't find a way to add a String or URL using the console.

AFAIK, the standard way is to put an env-entry in your deployment descriptor (web.xml, ejb-jar.xml):

<env-entry>
    <env-entry-name>string/foo</env-entry-name>
    <env-entry-type>java.lang.String</env-entry-type>
    <env-entry-value>foobar</env-entry-value>
</env-entry>

<env-entry>
    <env-entry-name>url/bar</env-entry-name>
    <env-entry-type>java.net.URL</env-entry-type>
    <env-entry-value>http://foobar/</env-entry-value>
</env-entry>
还在原地等你 2024-08-24 15:11:35

我已经遇到了完全相同的问题。例如,在 Websphere 中,我可以向 JNDI 添加任意参数,例如临时目录、密码和其他信息,而无需重新编译/重建 EAR。

我搜索了一段时间,似乎Weblogic缺少这个功能。我所做的是编写一个帮助程序类,它首先在 JNDI 中搜索给定的配置键,如果没有找到,则返回到搜索环境或系统变量。

也许可以对此进行增强,以搜索那些在运行时发现的以应用程序名称或上下文根为前缀的属性,以避免在部署同一 EAR 的多个实例时发生名称冲突。

I have reached this with exactly the same problem. In Websphere, for example, I can add arbitrary parameters such as temporary directories, passwords, and other information to JNDI without having to recompile/rebuild the EAR.

I've searched for a while and seems Weblogic lacks this feature. What I did was write a helper class that first searches JNDI for a given configuration key, and if it doesn't find it then falls back to searching environment or system variables.

Perhaps this could be enhanced to also search for those properties prefixed by the application's name or context root, discovered at runtime, to avoid name clashes when multiple instances of the same EAR are deployed.

白龙吟 2024-08-24 15:11:35

可以,但如果使用集群,您将失去高可用性。请参阅:http://docs.oracle.com/cd/E11035_01 /wls100/jndi/jndi.html#wp475702

You can but you will lose high availability if using cluster. See:http://docs.oracle.com/cd/E11035_01/wls100/jndi/jndi.html#wp475702

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