From a standing start on J2EE, never mind JBoss.
We have a web service using a single SLSB to extract information through Hibernate. We want to be able to deploy separate instances of the same app. to JBoss (Live, Training) and potentially different versions (Live, Test next version). The conventional (non J2EE) approach would be to run an application in an environment that set its configuration, i.e. the environment changes, not the application deployment. Point 3 in section 5.2 Java Naming and Directory Interface? (JNDI) Naming Context of the J2EE 1.4 spec referred to in section 3.6. J2EE and JNDI - The Application Component Environment of the jboss4guide would seem to suggest that the ENC (java:comp/env) is the way to achieve this:
?The Deployer uses the tools provided by the container to initialize the environment
entries that are declared in the application component?s deployment descriptor.
The Deployer can set and modify the values of the environment
However, the documentation uses jboss.xml and jboss-web.xml descriptors to set the ENC. As these would appear to have to be in the EAR or WAR, it requires a different EAR or WAR for each application instance, i.e. the application deployment is changed to change the environment. Can the setting of the ENC be moved out of the EAR or WAR?
The other approach I am considering is to use an MBean (again, not something I familiar with) for each application instance. I can envisage setting different Hibernate session factories on application instances using an MBean, but I can?t image how to deploy the required classes, and I can?t conceive of configuring the web application (which is not my area of expertise anyway).
So, which is the more viable approach to configuring application instances without changing the EAR: ENC or MBean, or is the whole approach misconceived and I should accept changing the EAR for different application instances.
I?d be grateful for any advice that can point me in the right direction.