3 Replies Latest reply on Oct 14, 2003 1:22 AM by frito

    Help deploying same application multiple times

    keenan

      I'd like to deploy the same J2EE application (in an ear file) twice with different datasources and running at different URLs (web context roots). I've run into two types of things that must be changed: the references to the DSN and the JNDI names associated with the EJBs. This requires editing the deployment descriptors that are embedded in the ear file. Is there a better way?

      I'm running JBoss 3.2.2RC3 on Windows 2000 with J2SDK 1.4.2.

      In particular, the DSN is present in the jbosscmp-jdbc.xml file for the CMP beans and in the jboss.xml for each BMP bean. Similarly, the JNDI names for the ejb's need to be changed in the jboss.xml files and in references in jboss-web.xml. That is a lot of places that must be edited. Is there some single place where I can specify the DSN and JNDI names rather than having to edit multiple files?

      Further, after I edit the deployment descriptors, I have two copies of the code, one in each ear file, which worries me from a maintenance standpoint. (I use the loader-repository setting in the jboss-app.xml file to prevent class conflicts.) Is there a way to cleanly separate the code from its deployment descriptors so that they can be changed independently?

      I'd appreciate hearing any tips or techniques people use when deploying the same application multiple times.

        • 1. Re: Help deploying same application multiple times

          You should not have to change any code to deploy twice, editing the deployment descriptors is enough, also datasources can be shared between applications.

          There's no way around changing JNDI names though, if you want to only keep one copy in development you need to write yourself a script that changes the JNDI context as part of the build for each application.

          -- Juha

          • 2. Re: Help deploying same application multiple times
            wramirez

            juha,

            I am deploying two different applications that have the same EJB name and Servlet name. The only different is that I they connect to two different DB. I have two different db-sevice.xml for each application. This work when I run then individually. But when I try to deploy both I got a error saying that the EJB is not unique eventhough I have deployed separetly in two different folders in the server/default/deploy.

            Any idea or tips how I can accompish this?

            By the way I just got a copy of the JMX Manahing J2EE with java Mang. Extension and JBOSS adminstration and development books and I don't see any information in how settup partitions? Any Idea where I can find information.

            Thanks in advance.

            • 3. Re: Help deploying same application multiple times
              frito

              Just like above:
              Change the JNDI names before deploying. If you are using comp/env namespace in your code, you will never have to change something when deploying under different JNDi names. Use the jboss.xml and the resource tags for mapping the global (or java:) namespace to the comp/env namespace.
              One difference: use two datasources and map the one for the first app, the second to the second app... that's all.
              ... or just use two servers... ;-) (not really...)

              Greetings,
              Frito