Problem:
Our EJBs and WARs (in an EAR) have references to an URL.
I want to deploy this URL in JNDI one time and resolve all references by linking on the deployed URL.
This is the same concept as websphere default URL provider, but how do I do that in
jboss?
Which mbean can I use?
Do I have to define a special service?
Right now, I resolved the link using the jboss.xml file and it works. But I do not want to repeat this in each
EJB.
Thank you.
My code uses a URL like this:
...
public static final
String AUDITLOG_PATH = "java:comp/env/AuditLogPath";
...
Object rep = new InitialContext().lookup(InternalJNDIRefererences.AUDITLOG_PATH);
In ejb-jar.xml:
...
<resource-ref>
<description></description>
<res-ref-name>AuditLogPath</res-ref-name>
<res-type>java.net.URL</res-type>
<res-auth>Container</res-auth>
<res-sharing-scope>Shareable</res-sharing-scope>
</resource-ref>
In jboss.xml:
<enterprise-beans>
<session>
<ejb-name>xyz</ejb-name>
<resource-ref>
<res-ref-name>AuditLogPath</res-ref-name>
<resource-name>AuditLogPath</resource-name>
</resource-ref>
</session>
...
...
<resource-managers>
<resource-manager>
<res-name>AuditLogPath</res-name>
<res-url>
file:///c:/audit/audit.log</res-url>
</resource-manager>
</resource-managers>
This works:
UserTransaction (class: javax.transaction.UserTransaction)
+- env (class: org.jnp.interfaces.NamingContext)
| +- ejb (class: org.jnp.interfaces.NamingContext)
| | +- ConfigurationManager[link -> ConfigurationManager] (class: javax.naming.LinkRef)
| +- AuditLogPath (class: java.net.URL)
But I don't want to duplicate the URL definition in all WARs and EJBs jboss xml config.
How can I define something I can deploy in server/default/deploy ?
Which mbean can I reuse to deploy URLs like in websphere URL provider?