1 Reply Latest reply on Dec 20, 2004 8:19 PM by kenroberts

    multiple versions and multiple use.

    kenroberts

      Hi folks.

      I just got the $99 documentation subscription, and I would like somebody to point me directly at what I need because scanning the categories isn't getting me there.

      I need to know two things:
      - How do I have two versions of the same bean running from the same server? (eg a production version and a trial version of the same application)
      - How do I configure one version of one bean to operate on more than one database?

      I believe the latter is more of a tutorial question but it's one our entire group can't answer.

      Thanks.

        • 1. Re: multiple versions and multiple use.
          kenroberts

          FINALLY, I get to help somebody here!

          I just did that yesterday.

          Here's what you need:

          First thing you need to know is that you need a jboss-app.xml file in your ear's META-INF directory, which will look almost exactly like this, first before version substitution and then after:
          <jboss-app>
          <loader-repository>repository:loader=/hellobean-@version@.ear</loader-repository>
          </jboss-app>

          now after substitution where version was set to "1.2.3":

          <jboss-app>
          <loader-repository>repository:loader=/hellobean-1.2.3.ear</loader-repository>
          </jboss-app>

          The above limits your class loader to those classes which exist in the ear specified and the ones loaded into the JBoss server, not to those loaded by another EAR. The current default behavior for JBoss is to share classes from one ear to the next, so if you load version 1.2.2 of the class org.my.software.MyClass first, that's the only one that gets loaded anywhere until you undeploy the 1.2.2 version. First come, first served. The above jboss-app.xml will fix that with probably a slightly bigger footprint.

          Now, the next thing you need to do is make a separate name for each version as follows in application.xml and everything else too:

          <display-name>HelloBean-@version@</display-name>


          <web-uri>hellobean-@version@.war</web-uri>
          <context-root>/hellobean-@version@</context-root>



          hellobean-@version@.jar



          Here's a jboss.xml:

          <enterprise-beans>

          <ejb-name>HelloBean</ejb-name>
          <jndi-name>ejb/HelloBean-@version@</jndi-name>

          </enterprise-beans>
          <resource-managers>
          </resource-managers>


          I left out the top couple lines on each file, btw, and just gave the main element.

          In your build.xml, you convert @version@ to 1.2.3 (for example) as follows:







          Hope this helps.