Tomcat 与 Weblogic JNDI 查找 [英] Tomcat vs Weblogic JNDI Lookup

查看:27
本文介绍了Tomcat 与 Weblogic JNDI 查找的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们使用的 Weblogic 服务器已配置为允许使用 JNDI 数据源名称,例如appds".

The Weblogic servers we are using have been configured to allow JNDI datasource names like "appds".

对于开发(本地主机),我们可能正在运行 Tomcat 并且在 <context> 中声明时.server.xml 的部分,Tomcat 会将 JNDI 数据源挂在 JNDI 树中的java:comp/env/jdbc/*"上.

For development (localhost), we might be running Tomcat and when declared in the <context> section of server.xml, Tomcat will hang JNDI datasources on "java:comp/env/jdbc/*" in the JNDI tree.

问题: 在 Weblogic 中,JNDI 查找是appds",而在 Tomcat 中,似乎我必须提供正式的java:comp/env/jdbc/appds".恐怕 Tomcat 版本是一个隐含的标准,但不幸的是,我无法更改 Weblogic 的配置......所以这意味着我们最终会得到两个不同的 spring 配置文件(我们使用的是 spring 2.5)来促进不同的环境.

Problem: in Weblogic, the JNDI lookup is "appds" whilst in Tomcat, it seems that that I must provide the formal "java:comp/env/jdbc/appds". I'm afraid the Tomcat version is an implicit standard but unfortunately, I can't change Weblogic's config ... so that means we end up with two different spring config files (we're using spring 2.5) to facilitate the different environments.

有没有一种优雅的方法来解决这个问题.我可以直接在 Tomcat 中查找 JNDI 名称吗?Spring 可以取一个名字并同时查看两个地方吗?Google 搜索或建议会很棒.

Is there an elegant way to address this. Can I look JNDI names up directly in Tomcat? Can Spring take a name and look in both places? Google searches or suggestions would be great.

推荐答案

JndiLocatorSupport 有一个属性 resourceRef.设置为 true 时,将自动添加java:comp/env/"前缀.所以我相信从Tomcat迁移到Weblogic时区分这个参数是正确的.

JndiLocatorSupport has a property resourceRef. When setting this true, "java:comp/env/" prefix will be prepended automatically. So I believe it would be correct to differentiate this parameter when moving from Tomcat to Weblogic.

这篇关于Tomcat 与 Weblogic JNDI 查找的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆