Announcement Announcement Module
Collapse
No announcement yet.
repository:jackson-populator produces "Could not open ServletContext resource [/]" Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • repository:jackson-populator produces "Could not open ServletContext resource [/]"

    Hello,
    I'm trying to use the jackson-populator to put some fixed values into a database. However loading the application context always fails with a FileNotFoundException:-
    java.io.FileNotFoundException: Could not open ServletContext resource [/]

    The application context is:-

    Code:
    <?xml version="1.0" encoding="UTF-8"?>
    <beans xmlns="http://www.springframework.org/schema/beans"
    	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    	xmlns:context="http://www.springframework.org/schema/context"
    	xmlns:tx="http://www.springframework.org/schema/tx"
    	xmlns:repository="http://www.springframework.org/schema/data/repository"
    	xsi:schemaLocation="http://www.springframework.org/schema/data/repository http://www.springframework.org/schema/data/repository/spring-repository.xsd
    		http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.1.xsd
    		http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.0.xsd
    		http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.1.xsd">
    	
    	<repository:jackson-populator location="classpath*:/data.json" />
    	
    </beans>
    The data.json file is in src/main/resources/data.json. It seems as if I have specified location="/", though clearly I have not. I also tried having location="classpath:data.json" location="classpath:/data.json" all produce the same results.

    If anyone knows what I've done wrong here i would be greatful if you could point it out.
    Thanks,
    Graeme.

  • #2
    Hi Graeme

    Are you using spring-data-commons-core version '1.4.0.RELEASE'?

    If so there seems to be a bug, The attribute for the file path is defined in 'location' defined in the xsd for <repository:jackson-populator /> however the ResourceReaderRepositoryPopulatorBeanDefinitionPar ser used to parse the context is looking for a 'locations' attribute. There seems to be a bit of a mis match here.

    I'm not 100% sure on this I have not had time to test properly but this looks to be an issue. Sorry I cant be more help than that.

    Thanks

    Chris

    Comment


    • #3
      FYI

      https://jira.springsource.org/browse/DATACMNS-227

      Comment


      • #4
        Looks good, kind of you for sharing this.

        Comment


        • #5
          I am using 1.4 and so that bug seems like it must be the problem.

          Thanks for the help!

          Comment

          Working...
          X