Announcement Announcement Module
Collapse
No announcement yet.
dependency problems? Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • dependency problems?

    Dear,

    I am having problems using mandatory features of spring framework.
    When I run this code:

    import java.io.FileInputStream;

    import org.springframework.beans.factory.xml.XmlBeanFacto ry;
    import org.springframework.core.io.ClassPathResource;
    import org.springframework.core.io.FileSystemResource;
    import org.springframework.core.io.Resource;

    public class cMain {

    /**
    * @param args
    */
    public static void main(String[] args) {
    try{
    //XmlBeanFactory bf = new XmlBeanFactory(new
    ClassPathResource("myFile.xml"));
    Resource res = new FileSystemResource("myFile.xml");
    XmlBeanFactory bf = new XmlBeanFactory(res);
    MySpringTest mbo = (MySpringTest) bf.getBean("myDataSource");

    mbo.Execute();
    }
    catch(Exception ex){
    ex.printStackTrace();
    }
    }

    }


    I get this exception:
    org.apache.commons.logging.LogConfigurationExcepti on:
    org.apache.commons.logging.LogConfigurationExcepti on:
    java.lang.NullPointerException (Caused by
    java.lang.NullPointerException) (Caused by
    org.apache.commons.logging.LogConfigurationExcepti on:
    java.lang.NullPointerException (Caused by
    java.lang.NullPointerException))
    at
    org.apache.commons.logging.impl.LogFactoryImpl.new Instance(LogFactoryImpl.java:543)
    at
    org.apache.commons.logging.impl.LogFactoryImpl.get Instance(LogFactoryImpl.java:235)
    at
    org.apache.commons.logging.impl.LogFactoryImpl.get Instance(LogFactoryImpl.java:209)
    at org.apache.commons.logging.LogFactory.getLog(LogFa ctory.java:351)
    at
    org.springframework.beans.factory.support.Abstract BeanFactory.<init(AbstractBeanFactory.java:99)
    at
    org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.<init(AbstractAutowireC apableBeanFactory.java:104)
    at
    org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.<init(AbstractAutowireC apableBeanFactory.java:113)
    at
    org.springframework.beans.factory.support.DefaultL istableBeanFactory.<init(DefaultListableBeanFactor y.java:87)
    at
    org.springframework.beans.factory.xml.XmlBeanFacto ry.<init(XmlBeanFactory.java:67)
    at
    org.springframework.beans.factory.xml.XmlBeanFacto ry.<init(XmlBeanFactory.java:56)
    at cMain.main(cMain.java:17)
    Caused by: org.apache.commons.logging.LogConfigurationExcepti on:
    java.lang.NullPointerException (Caused by
    java.lang.NullPointerException)
    at
    org.apache.commons.logging.impl.LogFactoryImpl.get LogConstructor(LogFactoryImpl.java:397)
    at
    org.apache.commons.logging.impl.LogFactoryImpl.new Instance(LogFactoryImpl.java:529)
    ... 10 more
    Caused by: java.lang.NullPointerException
    at
    org.apache.commons.logging.impl.LogFactoryImpl.get LogConstructor(LogFactoryImpl.java:374)
    ... 11 more

    Please help...
    What is wrong?
    I can't find any spring framework users who are experiencing the
    same problems.

    Are the problems i'm having caused by dependency problems?

    Thanks in advance,
    Asaf

  • #2
    Can you post your myFile.xml please.

    Also, what do you have on your classpath.

    Seems to be more a commons logging problem. Have you (for example) specified log4j, but not included it in the path? Just a guess.

    Comment


    • #3
      Can't user Spring bean factory

      Hi,

      This is my myFile.xml file:

      <?xml version="1.0" encoding="UTF-8"?>
      <!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd">

      <beans>
      <bean id="myDataSource"
      class="src.MySpringTest"
      destroy-method="close">
      <property name="myProp" value="myPropValue" />
      </bean>


      </beans>

      And as far as jars on my build path:
      JRE System Library [jre1.5.0_03]
      Spring 1.2 Core Libraries
      Spring 1.2 DAO Libraries

      Thanks

      Comment


      • #4
        Beats me then. Thought maybe you were explicitly referencing a logger implementation.

        Sorry

        Comment

        Working...
        X