3 Replies Latest reply on Dec 13, 2003 10:10 AM by juha

    ClassLoader problem on Jboss 3.0.7

    mickolka

      Hi.
      I'm using Jboss 3.0.7 and have following problem.

      I have two versions of one project in separate EARs, All JNDI names of beans are differnt. Also in both ears I has a static (singleton) class A.
      The problem is that that singleton A loading configuration from the file and the config is different in two versions. But when I deploy that ears to the JBOSS both two ears uses the same instance of the singleton.
      The questions are
      1. Is it right?
      2. Can I use static things at all?
      3. Is this problem fixed in recent versions.

      Regards, Mykola

        • 1. Re: ClassLoader problem on Jboss 3.0.7

          You should not be using statics at all.

          • 2. Re: ClassLoader problem on Jboss 3.0.7
            mickolka

            Hi

            "juha@jboss.org" wrote:
            You should not be using statics at all.



            Ok how then I can configure the application? I need additional configuration because I have to be able to run several versions of application under one Jboss server.

            Do I have to use MBeans or I can read configuration from files in the META-INF directory of the jar with EJB?

            Mykola


            • 3. Re: ClassLoader problem on Jboss 3.0.7

              I think there are several options, depending what fits your needs best:


              Use JNDI to bind values you want to share across components
              Use an MBean to do the same
              Use a custom deployer that reads a config file from META-INF
              Separate the applications using <loader-repository> tag (you're using an older version of JBoss so I don't remember how well this was supported)


              Probably others as well. The main point is how these behave in a clustered environment (using statics would always fail there).

              Hope that gives you some ideas.