Page 2 of 2 FirstFirst 12
Results 11 to 15 of 15

Thread: Newbie : AbstractDependencyInjectionSpringContextTests and Spring xml file

  1. #11
    Join Date
    Jul 2006
    Location
    Philadelphia, PA, USA
    Posts
    341

    Default Misspelling

    Hi davout,

    Your package as in Eclipse is com.eis.sor.hiberate.mysql, but in your applicationContext, you have com/eis/sor/hibernate/mysql.

    Basically, you spelled 'Hibernate' wrong in Eclipse but correctly in your config file.

    When you are having trouble like this, it always helps to decrease your chance for error by simplifying; I would have named the file "a.hbm.xml" and placed it directly in the "src" directory and tried to get that working first.

    -Arthur Loder

  2. #12
    Join Date
    Jun 2006
    Location
    The Netherlands
    Posts
    13,625

    Default

    If you just map your src root then adding the code below should work.

    Code:
    <property name="mappingResources">
    	<list>
    		<value>com/eis/sor/hibernate/mysql/FinancialAccount.hbm.xml</value>
    	</list>
    </property>
    Code:
    @Override
       protected String[] getConfigLocations() {
          return new String[] {"classpath:conf/applicationContext.xml"};
       }
    You still have to include the whole path to the file you want to load. Because conf/applicationContext.xml and applicationContext.xml could be 2 different files.

    [edit]
    And I totally missed the spelling error Maybe it is time to leave for home, hanging around the office doesn't really clear your head.
    [/edit]
    Marten Deinum
    Java Consultant / Pragmatist / Open Source Enthousiast / Author


    Pro Spring MVC: With Web Flow
    Conspect

    Have you read the reference guide.
    Use the [ code ] tags, young padawan

  3. #13
    Join Date
    Oct 2006
    Posts
    100

    Default

    Thanks...

    Why is it that I need to add 'src/conf' as a source folder in Eclipse? This is required to enable the finding of the 'applicationContext.xml' returned by the 'getConfigLOcations' method...

    Code:
    protected String[] getConfigLocations() {
          return new String[] {"classpath:applicationContext.xml"};
    }

  4. #14
    Join Date
    Jun 2006
    Location
    The Netherlands
    Posts
    13,625

    Default

    Because you look for applicationContext.xml and not conf/applicationContext.xml. Classloaders do not check every directory for the existance of a certain file. You need the whole path to the file, within the classpath.
    Marten Deinum
    Java Consultant / Pragmatist / Open Source Enthousiast / Author


    Pro Spring MVC: With Web Flow
    Conspect

    Have you read the reference guide.
    Use the [ code ] tags, young padawan

  5. #15
    Join Date
    Oct 2006
    Posts
    100

    Default

    I found the problem...

    In Eclipse when I added source folders for the two xml file locations, the Eclipse IDE added two exclusion entries for those same two locations under the original 'src' entry.

    Hence, when I deleted the two xml file location source folders the exclusions were still in place under the original 'src' folder.

    Many thanks for all those who took time to help this poor hapless soul!

Posting Permissions

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