6 Replies Latest reply on Jul 31, 2003 12:10 AM by anenwu

    Hosting multiple j2ee apps under the same running JBOSS cont

    anenwu

      Hi,

      Just curious.

      I m planning to host free JBOSS Server , but I hesitate of how to deal with multiple users who are going to upload the JBOSS (J2EE) application into my JBOSS Server.

      Let's say, I m running the default confiuration from JBOSS. Means only once instance of JBOSS is running, and the ds is pointing only to one ds instance which in turn connecting to one database.

      Is it possible for me, to separate all the users to access their own database (A access dbA, B access dbB, and so on) from the same running default jboss container ?

      Because most of the books, most of example only telling you how to set up one ds <--> database <---> jndi, and will be used by all the ejb, either one same jar or different jar.

      For my case, any expert here can help me ?

      I have to do this for security reason, so, user A can not access user B's table and so on.

      Thanks and best regards,

      Anen

        • 1. Re: Hosting multiple j2ee apps under the same running JBOSS

          You can deploy several datasources as long as you make sure they don't conflict in JNDI names or MBean object names. Then each hosted J2EE application needs to provide a mapping to their corresponding datasource.

          For entities, this can be done in jbosscmp-jdbc.xml files. For direct resource lookups (from session beans), you need the correct mappings in ejb-jar.xml and jboss.xml to match the correct JNDI lookup names. There is probably some similar mappings required for servlets.

          And of course, finally separate each DB instance by setting different authorization so applications cannot lookup and use each other's datasources.

          HTH,

          -- Juha

          • 2. Re: Hosting multiple j2ee apps under the same running JBOSS
            manavagiwal

            Hi Juha,

            Was wondering how would you achieve this seperation.

            And of course, finally separate each DB instance by setting different authorization so applications cannot lookup and use each other's datasources.

            • 3. Re: Hosting multiple j2ee apps under the same running JBOSS

              What I said is incorrect. They can still lookup the different datasources. But set up your databases with separate users/passwords so that they're protected from each other. You can do this at the DB level.

              Hope it makes it clearer.

              -- Juha

              • 4. Re: Hosting multiple j2ee apps under the same running JBOSS
                anenwu

                Thanks Juha,

                Do u have any sample of preconfigured jbosscmp-jdbc.xml that I can refer to.
                I tried to look into \jboss-3.0.4\docs\dtd\ to get the jbosscmp-jdbc.dtd, but could not find it as well.

                And can I say, I will let the registered user responsibility to define their own jbosscmp-jdbc.xml ? meanwhile our responsility is to providing them their own database name, user name, and password ?

                As I know, currently, to define db ds, I will only need to copy one of the predefined database-service.xml (for instance : oracle-service.xml, which only pointing to one database) into my jboss/server/host folder.

                My question, is it possible for overwriting this ds by the registered user by including their own ds-service.xml (so can connect to their own db instance) into their own jar file (together with ejb-jar, jbosscmp-jdbc) ?

                rgds,

                Anen Wu

                • 5. Re: Hosting multiple j2ee apps under the same running JBOSS

                  The DTD is in docs/dtd/jbosscmp-jdbc_3_0.dtd.

                  You can require the users supply their applications as SAR packages, they can add their own datasource configuration inside a SAR.

                  -- Juha

                  • 6. Re: Hosting multiple j2ee apps under the same running JBOSS
                    anenwu

                    Ok Juha.

                    I havent ever tried SAR yet. But I got ur point already.

                    Thanks.

                    Anen Wu