2011-06-09 3 views
1

Quand je lance la cible de fourmi pour JUnit, l'erreur suivante se produit:cible ant pour JUnit ne parvient pas à charger des fichiers XML contexte de printemps

Configuration problem: Failed to import bean definitions from URL location [classpath:/esw-web-ctx.xml] Offending resource: class path resource [applicationContext.xml]; nested exception is org.springframework.beans.factory.parsing.BeanDefinitionParsingException: Configuration problem: Failed to import bean definitions from URL location [classpath:/com/bgc/ecm/core/tools/exceptions/errorpagehandler-ctx.xml] Offending resource: class path resource [esw-web-ctx.xml]; nested exception is org.springframework.beans.factory.BeanDefinitionStoreException: IOException parsing XML document from class path resource [com/bgc/ecm/core/tools/exceptions/errorpagehandler-ctx.xml]; nested exception is java.net.UnknownHostException: www.springframework.org 

    org.springframework.beans.factory.parsing.BeanDefinitionParsingException: Configuration problem: Failed to import bean definitions from URL location [classpath:/esw-web-ctx.xml] 
    Offending resource: class path resource [applicationContext.xml]; nested exception is org.springframework.beans.factory.parsing.BeanDefinitionParsingException: Configuration problem: Failed to import bean definitions from URL location [classpath:/com/bgc/ecm/core/tools/exceptions/errorpagehandler-ctx.xml] 
    Offending resource: class path resource [esw-web-ctx.xml]; nested exception is org.springframework.beans.factory.BeanDefinitionStoreException: IOException parsing XML document from class path resource [com/bgc/ecm/core/tools/exceptions/errorpagehandler-ctx.xml]; nested exception is java.net.UnknownHostException: www.springframework.org 
    at org.springframework.beans.factory.parsing.FailFastProblemReporter.error(FailFastProblemReporter.java:68) 
    at org.springframework.beans.factory.parsing.ReaderContext.error(ReaderContext.java:85) 
    at org.springframework.beans.factory.parsing.ReaderContext.error(ReaderContext.java:76)....... 
...... 

cible Ant:

<target name="junit" depends="buildlocal"> 
    <delete dir="${JUNIT_REPORT}" failonerror="false"/> 
    <mkdir dir="${BUILD_TEST_DIR}" /> 
    <mkdir dir="${JUNIT_REPORT}" /> 
    <echo message="Launching JUnit tests" />  
    <copy todir="${BUILD_TEST_DIR}/" overwrite="true"> 
     <fileset dir="${COMP_TESTCONFIG_DIR}"> 
      <exclude name="*.properties.template" /> 
      <exclude name="*.xml.template" /> 
      <exclude name="*.ccf.template" /> 
      <exclude name="**/*.bak" /> 
      <exclude name="**/*.keep" /> 
      <exclude name="**/*.keep.*" /> 
      <exclude name="**/*.contrib" /> 
      <exclude name="**/*.java" /> 
      <exclude name="**/*.class" /> 
      <exclude name="**/*.contrib.*" /> 
     </fileset> 
    </copy> 
    <junit printsummary="on" fork="off" haltonfailure="false" failureproperty="junit.failure" showoutput="false"> 
     <classpath> 
      <path refid="CLASSPATH_JUNIT"/>    
     </classpath>    
     <batchtest fork="off" todir="${BUILD_TEST_DIR}"> 
      <fileset dir="${TEST_CLASSES_DIR}"> 
       <include name="**/*Test.class" /> 
       <include name="**/Test*.class" />  
       <!-- <exclude name="**/EswCacheInitializerTest.class" /> -->  
      </fileset> 
     </batchtest> 
     <formatter type="xml" /> 
    </junit>   
    <echo message="Launching junitreport" />  
    <junitreport todir="${JUNIT_REPORT}"> 
     <fileset dir="${BUILD_TEST_DIR}"> 
      <include name="TEST-*.xml" />   
     </fileset>  
     <report format="frames" todir="${JUNIT_REPORT}"/>  
    </junitreport> 
    <delete dir="${BUILD_TEST_DIR}" failonerror="false"/>  
    <echo message="**** Junit report generated at the location: ${JUNIT_REPORT} ***"/> 
    <echo message="==============================================="/> 
    <echo message="****** JUNIT BUILD ENDS - CORE ******  "/> 
    <echo message="==============================================="/> 
    <fail if="junit.failure" message="Unit test(s) failed. See reports at: ${JUNIT_REPORT}"/> 
</target> 
<path id="CLASSPATH_JUNIT"> 
    <path refid="LIB_JAVAC"/> 
    <pathelement location="${TEST_CLASSES_DIR}" /> 
    <pathelement location="${BUILD_TEST_DIR}" /> 
    <pathelement location="${APP_DIR}\bgc-esw-core\target\classes" /> 
    <pathelement location="${APP_DIR}\bgc-esw-web\target\classes" /> 
    <pathelement location="${APP_DIR}\bgc-esw-wicket-components\target\classes" /> 
    <fileset dir="${BUILD_LIBS_HOME}"> 
     <include name="*.jar" /> 
    </fileset> 
    <fileset dir="${APP_DIR}\bgc-esw-web\build" erroronmissingdir="false"> 
     <include name="bgc-esw-*.jar" />    
    </fileset> 
    <fileset dir="${APP_DIR}\bgc-esw-services\build" erroronmissingdir="false"> 
     <include name="bgc-esw-service*.jar" /> 
    </fileset> 
    <fileset dir="${APP_DIR}\bgc-esw-core\build" erroronmissingdir="false"> 
     <include name="bgc-esw-core*.jar" /> 
    </fileset> 
    <fileset dir="${APP_DIR}\bgc-esw-wicket-components\build" erroronmissingdir="false"> 
     <include name="bgc-esw-wicket-components*.jar" /> 
    </fileset> 
</path> 
+0

J'ai remarqué que errorpagehandler-ctx.xml ne pouvait pas charger. ce fichier est dans un autre projet, mais j'ai pointé le fichier jar pour cela dans LIB_JAVAC. Est-il nécessaire de charger à l'extérieur ou le pot de pointage est-il suffisant? – TechFind

Répondre

0

Vérifiez les définitions XML espaces de noms dans ce définition de contexte d'application. Il contient généralement quelque chose comme ceci:

<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:aop="http://www.springframework.org/schema/aop" xmlns:task="http://www.springframework.org/schema/task" 
xmlns:util="http://www.springframework.org/schema/util" 
xmlns:security="http://www.springframework.org/schema/security" 
xsi:schemaLocation=" 
    http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd 
    http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-2.5.xsd 
    http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.5.xsd 
    http://www.springframework.org/schema/task http://www.springframework.org/schema/task/spring-task-3.0.xsd 
    http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-3.0.xsd 
    http://www.springframework.org/schema/security http://www.springframework.org/schema/security/spring-security-3.0.xsd"> 

Je parie que certains des fichiers XSD du printemps ne sont pas dans les pots sur votre chemin de classe; tout cela devrait être localement sur votre système et non téléchargé sur le web.

+1

oui, errorpagehandler-ctx.xml avait une déclaration DTD, mais un autre fichier spring xml avait une déclaration de schéma. Mais pour travailler, je dois faire TechFind

Questions connexes