3 Replies Latest reply on May 29, 2007 8:27 AM by Stephen Schwenker

    Stupid Class loading problem

    Stephen Schwenker Newbie

      Hello,

      I'm having a really stupid class loading problem. I have a bunch of common classes that I use in different SAR files. These common classes are used to load mbeans and then process files based on a schedule. Using the org.jboss.varia.scheduler.Scheduler.

      I'm having a major problem when I re-package one of the project Sar files and redeploy it. I end up getting errors saying that the classes are incorrect.

      So, I tried putting a classloader into my META-INF/jboss-service.xml but when I pass my objects to other mbeans in the app server, I get errors saying that the classes can not be found and that mbean fails.

      So, the next thing I tried was to make one sar Directory with all the jars and then put all my other sars inside it so I can at least deploy my separate mbeans individually but they all use the same jar files. At that point JBoss complained that I was not allowed to use a sar directory in the farm because It can't copy sub-directory files.

      And now the last thing I've tried was to create a jar file with every possible class and put that into the farm directory. I then deploy my sars and they all deploy properly and function properly. That is until I restart the server. When I restart the servers, all the mbeans complain that they can not find the classes.

      Can anyone help? I've been working on this problem for 3 days.

      Thank you,


      Steve

        • 1. Re: Stupid Class loading problem
          jwcone Newbie

          I'd put everything in an EAR.

          Deploy your common classes as jar files inside the EAR, and reference them in the application.xml file (). Deploy your SARs in the EAR, and reference them in the jboss-app.xml file ().

          • 2. Re: Stupid Class loading problem
            Dennis Natad Newbie

            I am having the same problem. The only difference I am loading my custom libraries from within a WAR. On investigations I would say the problem occurs when I deploy updated classes on my library structure.

            Were you able to resolve this error?

            • 3. Re: Stupid Class loading problem
              Stephen Schwenker Newbie

              Well,

              I kinda resolved it but it wasn't pretty. Needless to say, I don't like the way Java and JBoss handle their class loading. The whole thing needs to be revamped.

              Anyway, I ended up fixing it by putting all my jars in the deploy directory and then putting my sar files without jars into the farm directory. The reason this works is because the deploy directory is loaded first and all the classes in the jars are loaded globaly into the app server. Then the farm directory loads and the sees the classes.

              The only down side is the when you have to update you're code, you have to copy it to all the servers and then restart them to have the code update. So you basically loose the functionallity of runtime deploying.... But lets face it, Dynamic deployment just complicates things. On the other hand, I can easily deploy the configuration/instance mbeans easliy.

              I've recently switched to .NET and at first glance, it's quite nice.

              I hope this helps. Again, It's not that pretty.

              Thank you,


              Steve.