7 Replies Latest reply on Apr 7, 2012 3:17 AM by vairam S

    ClassNotFoundException

    vairam S Newbie

      Hi,

       

      We are using  predefined class for compressing and decompressing  client object and its working fine in JBOSS 4.2.2 but when we deploy it in JBoss 6.1.0 we are getting ClassNotFoundException while decompressing client object

       

      Kindly find the attached log file.

       

      Decompression Code

       

      public class CompressVO

        implements Serializable

      {

        public Object rawObject = null;

      }

       

      public final Object decompress(Object compressedObject)

        {

          Object obj = null;

          try {

            Vector CMPObject = (Vector)compressedObject;

            byte[] decompress = (byte[])(byte[])CMPObject.get(0);

            int length = ((Integer)CMPObject.get(1)).intValue();

            byte[] RawBytes = new byte[length];

            Inflater inf = new Inflater();

            inf.setInput(decompress);

            int len = inf.inflate(RawBytes, 0, length);

            inf.end();

            ByteArrayInputStream bis = new ByteArrayInputStream(RawBytes);

            ObjectInputStream os = new ObjectInputStream(bis);

            CompressVO vocmp = (CompressVO)os.readObject();

            obj = vocmp.rawObject;

          } catch (Exception e) {

            System.out.println("Exception raised in decompress() :" + e);

            e.printStackTrace();

          }

          return obj;

        }

       

       

      when i try to decompress my client object(lrp.settings.control.Vo.NotificationAliasVo) in server side i'm the ClassNotFoundException.

      Kindly help in this case.

        • 1. Re: ClassNotFoundException
          Peter Johnson Master

          Where is the missing class located?

          • 2. Re: ClassNotFoundException
            vairam S Newbie

            The missing class is inside the bean jar file.  May i know the reason why in jboss 6.1.0, its checking for the specific class while dealing with object class level compression and decomprsssion.

             

            This case is not occuring in jboss 4.2.2. the same file is working fine in jboss 4.2.2.

             

            • 3. Re: ClassNotFoundException
              Márton Steierlein Newbie

              It is possible that you have two jars (or classes) in your classpath which implement the same class. I encountered the same problem when I put an slf4j.jar into my eclipse project and ivy pulled in an slf4j-api.jar as a dependency of Hibernate. When I started the application I got a class not found exception even though I had them twice.

               

              Make sure you have only one .class in your classpath.

               

              Best regards,

              Márton

              • 4. Re: ClassNotFoundException
                vairam S Newbie

                Your right, but in my case i have deployed my ear file in jboss 6.1.0 deploy folder, which contains the class(lrp.settings.control.Vo.NotificationAliasVo). When i try to decompress my client  "NotificationAliasVo" object in server side,  i'm getting ClassNotFoundException in server side, eventhough the "NotificationAliasVo" class present in below path.

                 

                File : E:\servers\jboss-6.1.0.Final\server\default\deploy\NotificationAliasEar.ear

                lrp/settings/control/Vo/NotificationAliasVo.class

                 

                File : E:\servers\jboss-6.1.0.Final\server\default\tmp\vfs\automountdb7a572aa381488c\NotificationAlias-ejb.jar-78336969b24a45a9\NotificationAlias-ejb.jar

                lrp/settings/control/Vo/NotificationAliasVo.class

                 

                File : E:\servers\jboss-6.1.0.Final\server\default\tmp\vfs\automountdb7a572aa381488c\NotificationAliasEar.ear-434e8b4b52652219\NotificationAliasEar.ear

                lrp/settings/control/Vo/NotificationAliasVo.class

                • 5. Re: ClassNotFoundException
                  vairam S Newbie

                  Hi,

                   

                  I have placed the class (Class which compress and decompress the object) inside the ejb jar. in this case ClassNotFoundException found exception is not occuring.  So there is some security restriction which is not allowing to load the class from other jar. Is there any security, which restrict the access of class from other jar. If so, kindly provide the detail to diable it.

                  • 6. Re: ClassNotFoundException
                    Márton Steierlein Newbie

                    Hi,

                     

                    I encountered the same thing with jBPM when I tried to upload a POJO model jar and jbpm-console couldn't found my class, even if I placed it inside the deployment folder. I had to explode that war and put my jar into the WEB-INF/lib directory. I think you've just experienced the very same thing.

                     

                    Best regards,
                    Márton

                    • 7. Re: ClassNotFoundException
                      vairam S Newbie

                      Hi

                      I hvae found solution for my JBoss 6.1.0 ClassNotFoundException issue, its due to the below isolated flag true status.

                       

                      File name:  %JBOSS_HOME%/server/default/deployers/ear-deployer-jboss-beans.xml

                       

                          <bean name="EARClassLoaderDeployer" class="org.jboss.deployment.EarClassLoaderDeployer">

                             <!-- A flag indicating if ear deployments should have their own scoped

                                class loader to isolate their classes from other deployments.

                             -->     

                             <property name="isolated">true</property> // i have changed it to false. now its working fine.

                          </bean>