通过 WebApp 进行 Java 数据源管理

发布于 2024-09-10 16:35:39 字数 460 浏览 1 评论 0原文

目前,我们将数据源定义存储在 Tomcat 容器中的 server.xml 中,并通过 context.xml 公开环境变量。

每当我们更改环境变量或数据源时,都需要重新启动服务器才能使这些更改生效。

有没有一种方法可以让我们创建一个 Web 应用程序来管理这些事情?我们可以将它们存储在另一个文件中,并通过 web 应用程序对其进行修改,而不是将它们存储在服务器 context.xml 和 server.xml 文件中。当应用程序需要数据源时,它可以从 Web 应用程序请求它(可能通过消息传递)。我曾考虑过在运行时修改 jndi 元素并将更改保存在文件中,但发现 Tomcat 不允许这样做。

如果不明显,我对所涉及的技术只有一点经验,但想要一个前进的方向。我不想做任何黑客的事情,并且想遵循标准。

如果有一个处理全局数据源和全局变量管理的 Web 应用程序,要求您通过消息传递请求这些对象,这是否正确?如果没有,有哪些更好的替代方案?

Currently, we store datasource definitions in the Tomcat container inside server.xml and expose environment variables through context.xml.

Any time we change an environment variable or datasource, it requires a server restart for those changes to be live.

Is there a way that we could create a web application to manage these things? Instead of storing them in the server context.xml and server.xml files, we could store them in another file and have them be modifiable through the webapp. When an application wants a datasource, it could request it from the webapp (maybe through messaging). I had thought about modifying the jndi elements at runtime and saving the changes in a file, but found that Tomcat does not allow that.

If it's not obvious, I have only a little experience with the technologies involved, but would like a direction to head in. I don't want to do anything hackish and would like to follow standards.

Would it be correct to have a webapp that handles global datasource and global variable management, requiring you to request these objects through messaging? If not, what are some preferable alternatives?

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

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

发布评论

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

评论(2

说好的呢 2024-09-17 16:35:39

好吧,您可以使用 Tomcat“admin”包(如果存在的话)。但是,由于各种原因,它从未从版本5移植到版本6。该帖子本身说明了如何纠正管理工具的正确方法。

同时,您可以使用 Tomcat 公开的 MBean,尽管我不能保证存在任何有用的东西。

Well, you could have used the Tomcat "admin" package, if it existed. But then, it was never ported from version 5 to 6 for various reasons. The post itself states the right way on how one must right the admin tool.

In the meantime, you could possibly use the MBeans exposed by Tomcat, although I can't vouch for anything useful being present.

自由如风 2024-09-17 16:35:39

考虑迁移到不同的应用程序服务器。

例如 Glassfish 可能适合您的要求。

http://blogs.oracle.com/alexismp/entry/glassfish_ose_3_0_1

http://glassfish.java.net/

Look at migrating to a different application server.

For instance Glassfish might suit your requirements.

http://blogs.oracle.com/alexismp/entry/glassfish_ose_3_0_1

http://glassfish.java.net/

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