We have an EJB application with a jboss-ejb3.xml which defines resource-refs for JNDI mapped resources. In our use-case not all resources are available in all environments. Since jboss-ejb3.xml cannot be externalized, I was hoping if there was a way the definitions can be somehow marked optional so the deployment does not fail when a mapped resource is not configured?
For example, we have our jboss-ejb3.xml defined as:
<resource-ref>
<res-ref-name>cache/ErrorDataCache</res-ref-name>
<res-type>java.util.Map</res-type>
<jndi-name>java:jboss/infinispan/cache/ejb/ErrorDataCache</jndi-name>
<!-- what to add to make this optional ?? -->
</resource-ref>
In our DEV JBOSS EAP 7.2 server, we are configuring a back-end cache so when server starts up and deploys the application, it registers the JNDI context (java:comp/env/cache/ErrorDataCache) to the mapped resource (java:jboss/infinispan/cache/ejb/ErrorDataCache).
However, in our production servers of same EAP version, we are forbidden to cache these values. Also we are forbidden to change the EAR archive to maintain a separate jboss-ejb3.xml.
I also tried using system properties substitution/placeholder, but there has to be a default fall-back otherwise it still fails with error "unresolved property value of app.module.env.${mappedjndi.errordatacache}"
<resource-ref>
<res-ref-name>cache/ErrorDataCache</res-ref-name>
<res-type>java.util.Map</res-type>
<jndi-name>${mappedjndi.errordatacache:"what default value??"}</jndi-name>
</resource-ref>
I have read that there is an <ignore-dependency/>
tag which I tried, but it fails with error: invalid tag , not defined in the XSD.