如何为 JBoss MBean 创建资源引用

发布于 2024-07-16 07:56:12 字数 157 浏览 2 评论 0原文

A 将应用程序部署到 JBoss。 它里面包含我注册的 Quartz MBean,它会触发计划任务。

如何为该 MBean 创建资源引用,以通过任务代码中的 java:/comp/env/* 而不是 java:/* 访问资源?

A have an application deployed to JBoss. It contains inside it I register Quartz MBean which triggers a scheduled task.

How can I create resource ref for that MBean to access resource by java:/comp/env/* and not java:/* in my task code?

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

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

发布评论

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

评论(1

书信已泛黄 2024-07-23 07:56:12

在 Web 应用程序中,将如下内容添加到 web.xml:

<resource-ref>
  <res-ref-name>QuartzObject</res-ref-name>
  <res-type>class.of.quartz.object</res-type>
  <res-auth>Container</res-auth>
</resource-ref>

并将如下内容添加到 jboss-web.xml:

<resource-ref>
  <res-ref-name>QuartzObject</res-ref-name>
  <res-type>class.of.quartz.object</res-type>
  <jndi-name>jndi/name/bound/by/mbean</jndi-name>
</resource-ref>

就位后,您应该能够使用本地资源引用 查找资源java:comp/env/QuartzObject.

In a web app, add something like the following to web.xml:

<resource-ref>
  <res-ref-name>QuartzObject</res-ref-name>
  <res-type>class.of.quartz.object</res-type>
  <res-auth>Container</res-auth>
</resource-ref>

and add something like the following to jboss-web.xml:

<resource-ref>
  <res-ref-name>QuartzObject</res-ref-name>
  <res-type>class.of.quartz.object</res-type>
  <jndi-name>jndi/name/bound/by/mbean</jndi-name>
</resource-ref>

with that in place, you should be able to lookup the resource using the local resource reference, java:comp/env/QuartzObject.

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