7 Replies Latest reply on Aug 21, 2003 4:36 AM by Adrian Brock

    strange problem -  NoClassDefFoundError

    surekharao Newbie

      Hi

      I have very strange problem ..

      Well .. I am getting java.lang.NoClassDefFoundError: when my bean is calling other bean classes out side of package , If I packaging the importing interface classes in the same jar as the calling bean then working very fine..

      Is this any bug type?

      Pls suggest me what could be the problem with my bean..

      thanks in advance

      regards
      Surekharao

        • 1. Re: strange problem -  NoClassDefFoundError
          Adrian Brock Master

          You have a problem with class visibilty.

          The class trying to load the other class is in
          a classloader that cannot see the other class.

          You'll need to post more details about your packaging.

          Regards,
          Adrian

          • 2. Re: strange problem -  NoClassDefFoundError
            surekharao Newbie

            Hi Adrian

            Thanks for your reply

            sorry for late reply since I was on vacation
            well .. my package structure is like below:

            UserBean module

            com.sms.user.ejb.*; --> calling bean package
            UserControlBean--> Bean class
            UserControl---> Remote Interface
            UserControlHome--> Home Interface


            MilageBean module

            com.sms.milage.ejb.*; --> other bean package
            MilageControlBean--> Bean class
            MilageControl---> Remote Interface
            MilageControlHome--> Home Interface


            Problem :
            When I call MilageControlHome in my calling bean(UserControlBean) getting exception java.lang.NoClassDefounderErrorException

            The below code is where my bean calling other beans out side of package

            MilageControlHome milageHome = (MilageControlHome) EJBUtility.getEJBHome("com/wizit/milage/ejb/MilageControl");
            MilageControl milageControl = milageHome.create();



            And as I told if I packaged other bean classes in my calling bean package then it didn't give any exception and working very fine


            I doubt some thing wrong in classpath, I have checked already my classpath settings and pretty sure there is nothing wrong.

            So confusing what is the real problem with this..I am using Jboss -2.4.4 + tomcat -4.0.3 both are standard alone.

            Pls refer once this once and help me out.

            Thanks in advance

            regards
            Surekharao

            • 3. Re: strange problem -  NoClassDefFoundError
              surekharao Newbie

              Hi again

              I mistyped the package path in the code where my bean calling other beans out side of package

              Context ctx = EJBUtil.getInitialContext();
              MilageControlHome milageHome = (MilageControlHome) EJBUtility.getEJBHome(ctx,"com/wizit/milage/ejb/MilageControlHome",MilageControlHome.class);
              MilageControl milageControl = milageHome.create();


              thanks
              Surekharao

              • 4. Re: strange problem -  NoClassDefFoundError
                surekharao Newbie

                Hi once again !


                The below code is the correct code for package path in the code where my bean calling other beans.

                Context ctx = EJBUtil.getInitialContext();
                MilageControlHome milageHome = (MilageControlHome) EJBUtility.getEJBHome(ctx,"com/sms/milage/ejb/MilageControlHome",MilageControlHome.class);
                MilageControl milageControl = milageHome.create();

                thanks
                Surekharao

                • 5. Re: strange problem -  NoClassDefFoundError
                  Adrian Brock Master

                  You have to do your workaround in jboss-2.4 unless
                  you deploy the classes statically using the
                  ClassPathExtension mbean.

                  There is no unified classloader.

                  Regards,
                  Adrian

                  • 6. Re: strange problem -  NoClassDefFoundError
                    surekharao Newbie

                    Hi Adrian

                    I am doing work around Jboss-2.4.4, And you said have to deploy the classes statically using the classpath extension .. this i don't understand clearly .. could you plase explain once more..

                    As I am deploying EJBs in .jar files which are storing $JBOSS_HOME/deploy/, Servelt's and Jsp's are in Tomcat(both are standarad alone)
                    I am not creatign any types of .EAR, .WAR files

                    But very strangly in my project some modules are working very fine even that modules beans calls other beans out side of packages and some other modules are not working and getting Exception classDefounderError when the bean calling other beans out side of pakage

                    Don't understand what could be the problem

                    thanks & regards
                    Suree

                    • 7. Re: strange problem -  NoClassDefFoundError
                      Adrian Brock Master

                      The classpath extension mbean adds classes to global
                      classloader space. e.g. all jars in lib/ext are added this
                      way. If I remember correctly it is in jboss.conf

                      Making an ear will solve your problem as well.

                      Regards,
                      Adrian