Announcement Announcement Module
Collapse
No announcement yet.
Cnt get spring example to run in eclipse ide Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Cnt get spring example to run in eclipse ide

    Hi guys,
    I will appreciate your help pls.I get this error when i try to run a simple spring example in eclipse.I have installed springide and followed all the advise i could find online.

    org.springframework.beans.factory.BeanDefinitionSt oreException: IOException parsing XML document from class path resource [beans.xml]; nested exception is java.io.FileNotFoundException: class path resource [beans.xml] cannot be opened because it does not exist
    16-Feb-2009 11:05:28 org.springframework.beans.factory.xml.XmlBeanDefin itionReader loadBeanDefinitions
    INFO: Loading XML bean definitions from class path resource [beans.xml]

    the beans.xml file is in the root folder for the project

    Any help will be appreciated.
    Thanks.
    Last edited by skolob; Feb 16th, 2009, 08:31 AM.

  • #2
    cnt get spring example to run in eclipse ide

    heres the code if its any help.

    public static void main(String args[]) throws Exception

    {

    try

    {
    System.out.println("please Wait.");
    Resource res = new ClassPathResource("beans.xml");
    BeanFactory factory = new XmlBeanFactory(res);
    SimpleInterestCalculatorBean interest=
    (SimpleInterestCalculatorBean)factory.getBean("Sim pleInterestBean");
    System.out.println(interest.getInterest());
    }

    catch(Exception e1)

    { System.out.println(""+e1); }

    }

    }

    Comment


    • #3
      the beans.xml file is in the root folder for the project
      Because you are using a ClassPathResource you need to place the beans.xml in the root of your classpath. Put the beans.xml into the root of your source folder and you should be ready to go.

      HTH

      Christian

      Comment


      • #4
        thanks it worked

        Thanks for that.It worked.
        cheers

        Comment

        Working...
        X