Results 1 to 4 of 4

Thread: Cnt get spring example to run in eclipse ide

  1. #1
    Join Date
    Feb 2009
    Posts
    4

    Default 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 at 07:31 AM.

  2. #2
    Join Date
    Feb 2009
    Posts
    4

    Default 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); }

    }

    }

  3. #3
    Join Date
    Aug 2004
    Location
    Duesseldorf, Germany
    Posts
    1,210

    Default

    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
    Christian Dupuis
    SpringSource, a division of VMware
    Lead, SpringSource Tools Team
    http://www.springsource.com
    http://twitter.com/cdupuis

  4. #4
    Join Date
    Feb 2009
    Posts
    4

    Default thanks it worked

    Thanks for that.It worked.
    cheers

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •