4 Replies Latest reply on Oct 9, 2009 8:37 AM by Tonio Caputo

    ClassLoader and application isolation

    Tonio Caputo Newbie

      Hi,

      I'm using JBoss 4.2.3, already have a running application, and need
      to deploy another application to the same appl. server.

      The problem is that both applications use the same Oracle DB server,
      but they need a different jdbc implementation.

      So my first approach is just be sure we can isolate each application,
      so we won't get jar clash, and lets try to configure a per application
      DataSource (all seems possible).

      1st step (and here comes the problem)
      1 - Configure ear-deployer.xml to isolate ears.
      (Isolated/CallByValue set to true)
      2 - Delete jdbc jar from jboss lib directory
      3 - Put jdbc jar in the ear file
      4 - Deploy the application and test expecting and error

      But: the first call fails when I try to obtain a Connection
      from this DataSource (an Exception is thrown), for the 2nd
      and on the application is ABLE TO GET A CONNECTION and works normally.

      If the jbdc jar is in jboss libs, the first connection failure won't happen, I made myself sure that no other jdbc jar were present in jboss libs.

      If ear-deployer is not configured to isolate deployments, all works
      normally.

      Any ideas what might be happening
      thanks in advance
      tonio

        • 1. Re: ClassLoader and application isolation
          Vicky Kak Master

          You have not mentioned where is your -ds.xml file, is it also in the scoped EAR?
          I think you are trying something new in JBoss5 which you have not done in earlier version of JBoss distribution, check this
          http://www.jboss.org/community/wiki/IWantToDeployMyOwnJdbcDriverInAScopedClassloader

          • 2. Re: ClassLoader and application isolation
            Tonio Caputo Newbie

            Thanks VickyK,

            Yes I forgot to tell you, my -ds.xml file is in default/deploy directory, just
            as an XML not in my application ear.

            The final solution will be to something related to the link you mentioned.

            But for now, I'm just trying to verify isolation works :), jars are just
            seen where they should be.

            I'm using 4.2.3.GA, not 5, and what I can't understand is how it works,
            as much as I understand it shouldn't, the DataSource is deployed at
            Jboss-level, and this DataSource should not be able to see the
            jdbc jar in the EAR file.

            After taking a look at the JMX Console I've noticed that a couple of
            jars related to DataBase are deployed automatically as part of the
            jars deployed with my EAR, so might have to do with it.

            So still trying to understand :(
            Thanks a lot
            tonio

            • 3. Re: ClassLoader and application isolation
              Vicky Kak Master

               

              "toniocus" wrote:

              Yes I forgot to tell you, my -ds.xml file is in default/deploy directory, just
              as an XML not in my application ear.


              If you have -ds.xml in deploy and the driver specific jars in seperate isolated deployments then things won't work.

              "toniocus" wrote:

              I'm using 4.2.3.GA, not 5, and what I can't understand is how it works,
              as much as I understand it shouldn't, the DataSource is deployed at
              Jboss-level, and this DataSource should not be able to see the
              jdbc jar in the EAR file.


              Yes the datasource will not be able to see the jars in scoped EAR, so the oracle specific jars would not be visible to the MBean's generated from datasource configurations.
              Hence there is a failure.
              If you are more interested in knowing Jboss CL working model for Jboss4.x then you must read this
              http://www.jboss.org/community/wiki/JBossClassLoadingUseCases



              • 4. Re: ClassLoader and application isolation
                Tonio Caputo Newbie

                Thanks for your response.

                Try to work on it a bit more, and find out why it is working.

                Wonderful document the link you send me, while searching the
                web for documents about this issue I wasn't able to find it.

                thanks again
                tonio