facebook

Spring / Hibernate M2 – Apache LogFactory

  1. MyEclipse Archived
  2.  > 
  3. UML Development
Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #233831 Reply

    Thomas Trostel
    Participant

    When using a project constructed with both Hibernate and Spring integration I am finding that the following code produces an error

    NoClassDefFoundError: org/apache/commons/logging/LogFactory

    Here is the code

    
    import java.io.FileInputStream;
    import java.io.FileNotFoundException;
    import java.io.InputStream;
    
    import org.apache.log4j.Logger;
    import org.apache.log4j.PropertyConfigurator;
    import org.springframework.beans.factory.xml.XmlBeanFactory;
    import org.springframework.core.io.InputStreamResource;
    
    public class RecPayable {
        
        // Log4J entity
        static Logger logger = Logger.getLogger(RecPayable.class);
    
        /**
         * @param args
         */
        public static void main(String[] args) {
    
            // Set up the log4j configuration from the properties file.
            String directory = System.getProperty("user.dir");
            PropertyConfigurator.configure(directory + "/RecPayable.properties");
            
            // Initialize the bean factory with the worlds simplest bean
            InputStream is = null;
    
            logger.info("This is a test");
    
            try {
                is = new FileInputStream(directory + "/beans.xml");
            } catch (FileNotFoundException e) {
                logger.error(e.getMessage());
                return;
            }
    
            InputStreamResource ris = new InputStreamResource(is);
            
            
            XmlBeanFactory factory = new XmlBeanFactory(ris);
    
        }
    
    }
    

    Note that the Apache Commons library is available to the project as well as the Log4J library. Any clues?

    Thanks

    #233834 Reply

    snpe
    Member

    Hi ttrostel,
    LogFactory is from commons-logging libraries.Have you commons-logging.jar in classpath ?

    #233836 Reply

    Thomas Trostel
    Participant

    Yes … I mentioned in the original message that the commons-logging library was available (by that I meant in the classpath)

    #233840 Reply

    Thomas Trostel
    Participant

    Hmmm … I dropped the pre-packaged Spring-All library included with M4 and replaced it with a user library I constructed using Spring 1.2.3 and everything works fine. Bug?

    #233890 Reply

    Thomas Trostel
    Participant

    This probably needs to be entered as a bug for the next build. Is there somewhere I can do this?

    #234012 Reply

    support-michael
    Keymaster

    Bug has been entered. FYI: M3 will include the latest Spring framework (1.2.3) and Spring IDE (1.2.2).

Viewing 6 posts - 1 through 6 (of 6 total)
Reply To: Spring / Hibernate M2 – Apache LogFactory

You must be logged in to post in the forum log in