Results 1 to 2 of 2

Thread: Maven 2.0 XmlBeanDefinitionReader fails to load application context

  1. #1

    Default Maven 2.0 XmlBeanDefinitionReader fails to load application context

    Hi

    I am trying to build an Spring Unit Test. I am not understanding why the application context cannot be found on the classpath.

    I have checked the class path of the unit test, which appears to have
    the correct folders and location of resources

    java.class.path=/c:/Program Files/IBM/Rational/SDP/6.0/eclipse/plugins/org.eclipse.jdt.junit_3.0.1/junitsupport.jar
    /c:/Program Files/IBM/Rational/SDP/6.0/eclipse/plugins/org.eclipse.jdt.junit.runtime_3.0.2/junitruntime.jar
    V:\pilgripe_PTSP1_2\LDN_PTS\valuations\ptsp-valuations\target\test-classes
    V:\pilgripe_PTSP1_2\LDN_PTS\valuations\ptsp-valuations\target\test-classes
    V:\pilgripe_PTSP1_2\LDN_PTS\valuations\ptsp-valuations\target\classes
    C:\Program Files\IBM\Rational\SDP\6.0\runtimes\base_v6_stub\l ib\activitySession.jar
    C:\Program Files\IBM\Rational\SDP\6.0\runtimes\base_v6_stub\l ib\acwa.jar
    C:\Program Files\IBM\Rational\SDP\6.0\runtimes\base_v6_stub\l ib\admin.jar
    // We are using the spring framework here
    System.out.println("java.class.path="+
    StringHelper.join(
    StringHelper.splice( System.getProperty("java.class.path"), File.pathSeparator, false ),
    "\n"));
    ApplicationContext context = new ClassPathXmlApplicationContext( "com/ubs/firc/ptsp/valuations/processor/valuations-processor-test.xml" );
    Therefore the context file `valuations-processor-test.xml' is located under
    `<MAVEN2_PROJECT>/src/test/resources/com/ubs/firc/ptsp/valuations/valuations-processor-test.xml'

    Everything says that XmlBeanDefinitionReader should be able to load the resource, but it can't find it.


    29-Aug-2006 17:09:22 org.springframework.beans.factory.xml.XmlBeanDefin itionReader
    INFO: Loading XML bean definitions from class path resource [com/ubs/firc/ptsp/valuations/processor/valuations-processor-test.xml]
    org.springframework.beans.factory.BeanDefinitionSt oreException: IOException parsing XML document from class path resource [com/ubs/firc/ptsp/valuations/processor/valuations-processor-test.xml]; nested exception is java.io.FileNotFoundException: class path resource [com/ubs/firc/ptsp/valuations/processor/valuations-processor-test.xml] cannot be opened because it does not exist
    java.io.FileNotFoundException: class path resource [com/ubs/firc/ptsp/valuations/processor/valuations-processor-test.xml] cannot be opened because it does not exist
    at org.springframework.core.io.ClassPathResource.getI nputStream(ClassPathResource.java:137)
    at org.springframework.beans.factory.xml.XmlBeanDefin itionReader.loadBeanDefinitions(XmlBeanDefinitionR eader.java:167)
    at org.springframework.beans.factory.xml.XmlBeanDefin itionReader.loadBeanDefinitions(XmlBeanDefinitionR eader.java:148)
    at org.springframework.beans.factory.support.Abstract BeanDefinitionReader.loadBeanDefinitions(AbstractB eanDefinitionReader.java:126)
    at org.springframework.beans.factory.support.Abstract BeanDefinitionReader.loadBeanDefinitions(AbstractB eanDefinitionReader.java:142)
    at org.springframework.context.support.AbstractXmlApp licationContext.loadBeanDefinitions(AbstractXmlApp licationContext.java:113)
    at org.springframework.context.support.AbstractXmlApp licationContext.loadBeanDefinitions(AbstractXmlApp licationContext.java:81)
    at org.springframework.context.support.AbstractRefres hableApplicationContext.refreshBeanFactory(Abstrac tRefreshableApplicationContext.java:89)
    at org.springframework.context.support.AbstractApplic ationContext.refresh(AbstractApplicationContext.ja va:269)
    at org.springframework.context.support.ClassPathXmlAp plicationContext.<init>(ClassPathXmlApplicationCon text.java:87)
    at org.springframework.context.support.ClassPathXmlAp plicationContext.<init>(ClassPathXmlApplicationCon text.java:72)
    at org.springframework.context.support.ClassPathXmlAp plicationContext.<init>(ClassPathXmlApplicationCon text.java:63)
    at com.ubs.firc.ptsp.valuations.processor.TestDefault BatchHeaderParser.testProcessWorkItem(TestDefaultB atchHeaderParser.java:79)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Nativ e Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Native MethodAccessorImpl.java:85)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Native MethodAccessorImpl.java:58)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(De legatingMethodAccessorImpl.java:60)
    at java.lang.reflect.Method.invoke(Method.java:391)
    at junit.framework.TestCase.runTest(TestCase.java:154 )
    at junit.framework.TestCase.runBare(TestCase.java:127 )
    at junit.framework.TestResult$1.protect(TestResult.ja va:106)
    at junit.framework.TestResult.runProtected(TestResult .java:124)
    at junit.framework.TestResult.run(TestResult.java:109 )
    at junit.framework.TestCase.run(TestCase.java:118)
    at junit.framework.TestSuite.runTest(TestSuite.java:2 08)
    at junit.framework.TestSuite.run(TestSuite.java:203)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRu nner.runTests(RemoteTestRunner.java:436)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRu nner.run(RemoteTestRunner.java:311)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRu nner.main(RemoteTestRunner.java:192)

    Any ideas appreciated. TIA
    ==
    Peter Pilgrim
    Java Champion
    Technical leader
    Java EE Engineer for Financial Services, City of London
    Certified SCRUM Master
    Scala, JavaFX and Groovy Enthusiast

    Java FX Enthusiast
    Java EE Development, Design and Architecture
    http://xenonique.co.uk/blog/

  2. #2

    Default [SOLVED] Dont Bother

    Sorry about it just takes a fresh piece of eyes sometimes.

    Spring Framework was correct and I, the master programmer, was strongly affronted.

    The resource package was
    <PROJECT>/src/test/resources/com/ubs/firc/ptsp/valuations/
    it should have been
    <PROJECT>/src/test/resources/com/ubs/firc/ptsp/valuations/processor
    ==
    Peter Pilgrim
    Java Champion
    Technical leader
    Java EE Engineer for Financial Services, City of London
    Certified SCRUM Master
    Scala, JavaFX and Groovy Enthusiast

    Java FX Enthusiast
    Java EE Development, Design and Architecture
    http://xenonique.co.uk/blog/

Posting Permissions

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