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?
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
.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.