Discussions

EJB programming & troubleshooting: Strange: java.lang.NoClassDefFoundError: At deployment

  1. Hi,

    I am having a strange problem. I have developed a simple statelessessionbean. I'm passing an object called MYCLASS as an argument to one of the business methods. I have created jar file and did ejbc on the jar file. Now when i try to deploy the bean i get this strange error "java.lang.NoClassDefFoundError: MYCLASS" and deployment fails. Beeing curious, i have changed the argument to the business method (passed another class) my bean gets deployed. I'm curious

    here is the code for my class

    import java.io.*;
    public class MYCLASS implements Serializable
    {
        
        public String bankID;
        public MYCLASS() { }
        
        
         public MYCLASS(String bid)
         {
            bankID = bid;
         }
        
        
    }

    here is the manifest info from the jar
    Manifest-Version: 1.0

    Name: CNDPYEJB_DepositAccountActivateProcessBeanEOImpl_Descriptor.ser

    Name: META-INF/ejb-jar.xml

    Name: CNDPYEJB_DepositAccountActivateProcessBeanHomeImpl_WLSkel.class

    Name: CNDPYAPI_UpdatedDepositAccountStatus.class

    Name: CNDPYEJB_DepositAccountActivateProcessHome.class

    Name: CNDPYEJB_DepositAccountActivateProcessBean.class

    Name: CNDPYEJB_DepositAccountActivateProcessBeanEOImpl_WLSkel.class

    Name: CNDPYEJB_DepositAccountActivateProcess.class

    Name: CNDPYEJB_DepositAccountActivateProcessBeanHomeImplAD.ser

    Name: CNDPYEJB_DepositAccountActivateProcessBeanHomeImpl_Descriptor.ser

    Name: CNDAPI_Exception.class

    Name: CNDUTL_Time.class

    Name: CNDPYEJB_DepositAccountActivateProcessBeanEOImpl.class

    Name: CNDUTL_IllegalOperationException.class

    Name: MYCLASS.class

    Name: CNDPYEJB_DepositAccountActivateProcessBeanHomeImpl.class

    Name: CNDPYEJB_DepositAccountActivateProcessBeanHomeImpl_WLStub.class

    Name: META-INF/weblogic-ejb-jar.xml

    Name: CNDPYEJB_DepositAccountActivateProcessBeanEOImpl_WLStub.class

    Name: CNDPYEJB_DepositAccountActivateProcessBeanHomeImpl_ServiceStub.class

    Name: CNDPYEJB_DepositAccountActivateProcessBeanEOImpl_ServiceStub.class

    ANY CLUES???


  2. I am not sure what could be the problem, but you might want to try and include the path of the class you are using in the WEBLOGIC_CLASSPATH.

    Bhavesh
  3. Yep, i shall try that. But having packaged all the helper classes in the bean it must find it. I looked at serialization issue as well my clss is serializable and has default constructor and contains only strings as attributes.
    any other suggestions??
  4. Yes, you must put all helper classes in a directory which is on weblogic_classpath before deployment.

    As you may know, NoClassDefoundError occurs when MYClASS can be found at compile time but can't at runtime. In this case, 'runtime' means deployment time. classes on weblogic_classpath are to be used when weblogic server is operating.
     so now, we suppose that weblogic server is operating without MYCLASS on the weblogic_classpath and someone is trying to deploy a bean needed MYCLASS. Then it just causes
    NoClassDefoudError
  5. ok,you mena all the helperclasses need to be in the weblogic class path. This sound strange to me, my understanding was i need to pacakge all my helperclasses inside the .jar file. other wise deploying lots of bean could create lots of problems.

    I did put MYCLASS in weblogic class path and my bean got deployed. But my bean uses lots of other helper classes which are not in the weblogic class path but in the .jar

    any suggestions??? hints ????