Weblogic 10.3、JDBC、Oracle、SQL - 表或视图不存在

发布于 2024-08-28 04:39:07 字数 585 浏览 10 评论 0原文

我有一个非常奇怪的问题,我没有成功地通过谷歌搜索。

它开始发生时没有对数据库、连接设置、代码等进行任何更改。

问题是,当访问 servlet 时,其中一个 EJB 正在执行直接 SQL 调用,非常简单

“选择\n”+
“值,\n”+
“ 其他值 \n” +
“来自\n”+
“ some_table \n” +
“其中 some_condition = ?”

这显然不是直接的 SQL,但非常接近。由于某种原因,这开始返回一个错误,指出“ORA-00942:表或视图不存在”。

该表存在,最重要的是,如果我挂接调试器,在查询中更改空格或较小的内容(不更改查询本身),然后热部署更改,它就可以正常工作。这不是我第一次遇到这种情况。它似乎只发生在开发环境中(还没有在问答、沙盒或生产中看到它),并不总是可复制的,这让我严重发疯。

我所说的并不总是可复制的,是指偶尔会有一个干净的构建和复制。重新部署有时可以解决问题,但并非总是如此。它并不总是同一个表(尽管如果发生错误,它会继续使用相同的查询)。

只是试探一下,看看是否有人以前遇到过这样的问题,以及他们可能发现了什么来解决它。

I've got a really odd issue that I've not had any success googling for.

It started happening with no changes to the DB, connection settings, code etc.

Problem is, when accessing a servlet, one of the EJB's is doing a direct SQL call, very simple


"select \n" +
" value, \n" +
" other_value \n" +
" from \n" +
" some_table \n" +
" where some_condition = ? "

That's obviously not the direct SQL, but pretty close. For some reason, this started returning an error stating "ORA-00942: table or view does not exist".

The table exists, and the kicker is if I hook in a debugger, change a space or something minor (not changing the query itself) in the query, and hot-deploy the change, it works fine. This isn't the first time I've run across this. It only seems to happen in dev environments (haven't seen it in q/a, sandbox, or production yet), is not always replicable, and driving me seriously insane.

By not always replicable I mean that occasionally a clean build & redeploy will sometimes fix the problem, but not always. It's not always the same table (although if the error occurs it continues with the same query).

Just throwing a feeler out there to see if anybody has run into issues like this before, and what they may have discovered to fix it.

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

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

发布评论

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

评论(1

謌踐踏愛綪 2024-09-04 04:39:07

听起来您的 JDBC 池中的一个连接可能有问题,这可以解释间歇性的性质,并且重新部署有时只能修复它,因为您最终可能仍然使用相同的连接。也许您可以尝试重置连接池而不是重新部署。 (java weblogic.Admin -url t3://RESET_POOL,我认为)

您说过只有一种模式,但这是否意味着只有一种模式存在或者所有的表都在一个模式下吗?是否有可能您正在某处执行 ALTER SESSION SET CURRENT_SCHEMA ,并且当针对哪个连接发出时返回到池中,然后随机用于稍后的查询时,它看不到任何内容主要模式还有吗?这可能发生在包或触发器中以及 Java 端,并且可能是“临时”更改,在异常后不会恢复。听起来也像是只存在于开发环境中的东西......

Sounds like maybe one connection in your JDBC pool has a problem, which could explain the intermittent nature and that redeploy only sometimes fixes it, as you could end up still using the same connection afterwards. You could try resetting the connection pool instead of redeploying, perhaps. (java weblogic.Admin -url t3://<server_url> RESET_POOL <pool_name>, I think)

You've said there's only one schema, but does that mean only one schema exists or that all the tables are under one schema? Is it possible that you're doing an ALTER SESSION SET CURRENT_SCHEMA somewhere, and when whichever connection that's issued against is returned to the pool and then randomly used for the query later it can't see anything in the main schema any more? That could happen in a package or trigger as well as from the Java side, and could be a 'temporary' change that doesn't get reverted after an exception. Sounds like something that might only exist in a dev environment, too...

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