6 Replies Latest reply on Jun 24, 2002 11:30 AM by strayalien

    ClassNotFoundException

    strayalien

      I am deploying a service which has all its files in a sar file, and during the deployment I get a ClassNotFound exception even though the sar file contains the class that it is being reported as not found. Why is JBoss not looking in that sar file for the files necessary to deploy this service, where else could it look?

      Thanks,
      Gregory

        • 1. Re: ClassNotFoundException

          Can you give some more information.
          e.g. How it is packaged.
          Are you sure you have spelt the classname correctly?

          Regards,
          Adrian

          • 2. Re: ClassNotFoundException
            strayalien

            > Can you give some more information.
            > e.g. How it is packaged.
            > Are you sure you have spelt the classname correctly?
            >
            > Regards,
            > Adrian

            Well, I have a sar file that contains com.sun.jini.start.ClassLoaderUtil class, when I actually start JBoss it starts to deploy this sar file, and during deployment I get "ERROR [STDERR] java.lang.RuntimeException: java.lang.ClassNotFoundException: com.sun.jini.start.ClassLoaderUtil$ActivateClass".

            But, that class is in the sar file of that service, so I don't know why it is causing this problem. Just for a sake, I have also put that class file in jar file and put it in the lib directory and it did not work either.

            I am sorry that I can not provide you with more information. Any comments and suggestions would be helpfully.

            Thanks.

            • 3. Re: ClassNotFoundException

              > file, and during deployment I get "ERROR [STDERR]
              > java.lang.RuntimeException:
              > java.lang.ClassNotFoundException:
              > com.sun.jini.start.ClassLoaderUtil$ActivateClass".

              "ERROR [STDERR]" suggests some error that is being
              reported either by your code or something you using.

              I'm not familiar with jini, do you know where the
              class is being loaded?

              Regards,
              Adrian

              • 4. Re: ClassNotFoundException
                strayalien

                > > file, and during deployment I get "ERROR [STDERR]
                > > java.lang.RuntimeException:
                > > java.lang.ClassNotFoundException:
                > > com.sun.jini.start.ClassLoaderUtil$ActivateClass".
                >
                >
                > "ERROR [STDERR]" suggests some error that is being
                > reported either by your code or something you using.
                >
                > I'm not familiar with jini, do you know where the
                > class is being loaded?
                >
                > Regards,
                > Adrian

                Well, that was my suspicion as well, that it has something to do with Jini, and remote classloading. But if the class is in the local classpath, it should never try to load it remotely. And if the class is in the sar file, it should be in the local classpath.

                My question is, where can I put this class file to make sure that is in the classpath of JBoss and service, if not in the sar file?

                Greg

                • 5. Re: ClassNotFoundException

                  It depends upon how Jini loads the class.

                  If it loads the class using the context classloader
                  (which is the preferred behaviour from Java 1.2+)
                  it should find the class in your sar.

                  If it is using the old Class.forName() method, this is
                  incorrect. Class.forName() will only look at the
                  classpath passed to vm at startup.

                  You could try to verify this by adding the class(es)
                  to the classpath in the run.sh/.bat script.
                  But I think you will run into other class visibility
                  problems doing this.

                  Regards,
                  Adrian

                  • 6. Re: ClassNotFoundException
                    strayalien

                    I just did try that and same happend. I guess I will have to keep playing with the classpath. Thanks for all your suggestions, they were very helpful in steering me in the right direction.

                    Greg