Tomcat 8 升级后的 JNDI NameNotFoundException [英] JNDI NameNotFoundException after Tomcat 8 upgrade

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

问题描述

我从 Tomcat 8.0.18 升级到 8.0.23,突然间我遇到了 JNDI 问题.我查看了变更日志,Tomcat 8 变更日志,我看到了三个 JNDI改变,虽然没有一个让我觉得会破坏以前工作的配置.

I upgraded from Tomcat 8.0.18 to 8.0.23 and all of the sudden I have a JNDI issue. I looked at the changelogs, Tomcat 8 Changelogs, and I see three JNDI changes, though none strike me as something that would break a previously working configuration.

针对错误 49785、57587 以及 8.0.19 下其他"下的条目进行了与 JNDI 相关的更改.

JNDI related changes were made for bugs 49785, 57587, and an entry under 8.0.19 under "Other".

当我使用 8.0.23 启动 Tomcat 时收到此异常:

I am receiving this exception when I start up Tomcat with 8.0.23:

javax.naming.NameNotFoundException: Name [jdbc/MyCluster] is not bound in this Context. Unable to find [jdbc].

在我的 Web 应用程序中,我定义了一个资源链接:

In my web application I have a resource link defined:

<Context>
   <ResourceLink name="jdbc/MyCluster" global="jdbc/MyCluster" auth="Container" type="javax.sql.DataSource" />
</Context>

我已经配置了 Tomcat:

I have Tomcat configured with:

<Resource name="jdbc/MyCluster" global="jdbc/MyCluster" ......./>

我被难住了......我不知道是什么让我的代码从 18 升级到 23 后中断:(

I am stumped... I cannot figure out what makes my code break after my upgrade from 18 to 23 :(

推荐答案

以防万一有人好奇从 Tomcat 8.0.18 升级到 8.0.24 会如何真正导致 JNDI 搞砸,答案在于 ANT.

Just in case anyone was curious about how upgrading from Tomcat 8.0.18 to 8.0.24 could really cause JNDI to screw up, the answer lies in ANT.

ANT 复制文档

我自己和其他一些工程师不知道如果您尝试覆盖的文件具有更新的时间戳,ANT Copy 什么也不做……谁知道复制有如此复杂的条件!?!我相信这就是为什么我和很多人从未看过文档的原因,这是一种意想不到的行为.

Myself and some other engineers had no idea that ANT Copy does nothing if the file you are trying to overwrite has a newer timestamp... who knew copy had such a complicated condition!?! I believe this is why me and multiple people never looked at the documentation, it is such an unexpected behavior.

无论如何,通过升级到较新版本的 Tomcat,我的包含资源链接 jdbc/MyCluster 的 context.xml 未能覆盖 Tomcat 的默认 context.xml 的较新和最近的时间戳!一旦覆盖标志设置为真,JNDI 再次工作:)

Anyways, by upgrading to the newer version of Tomcat my context.xml that contained the resourcelink jdbc/MyCluster was failing to overwrite the newer and more recent timestamp of Tomcat's default context.xml! Once the overwrite flag is set to true, JNDI works again :)

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

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