Announcement Announcement Module
Collapse
No announcement yet.
Unable to locate Spring NamespaceHandler Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Unable to locate Spring NamespaceHandler

    I did some changes in footballJob.xml and when i am running QuartzBatchLauncher getting following error
    This is my footballJob.xml
    Code:
     <?xml version="1.0" encoding="UTF-8"?>
    <?xml version="1.0" encoding="UTF-8"?>
    <beans xmlns="http://www.springframework.org/schema/beans"
    	xmlns:batch="http://www.springframework.org/schema/batch"
    	xmlns:aop="http://www.springframework.org/schema/aop"
    	xmlns:tx="http://www.springframework.org/schema/tx"
    	xmlns:p="http://www.springframework.org/schema/p"
    	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    	xsi:schemaLocation="
    		http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
    		http://www.springframework.org/schema/batch http://www.springframework.org/schema/batch/spring-batch-2.0.xsd
    		http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.0.xsd
    		http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.0.xsd">
    
    	
    	<batch:job id="footballJob" job-repository="jobRepository" restartable="true">
    			<batch:split id="split1" next="step3">
    				<batch:flow>
    					<batch:step id="step1" next="step2" tasklet="playerload"/> 
    					<batch:step id="step2" tasklet="gameLoad"/>
    				</batch:flow>
    				
    			</batch:split>
    			<batch:step id="step3" tasklet="playerSummarization"/>
    		</batch:job>
    	
    
    				<bean id="playerload" parent="simpleStep">
    					<property name="commitInterval" value="${job.commit.interval}" />
    					<property name="startLimit" value="100" />
    					<property name="itemReader"
    						ref="playerFileItemReader" />
    					<property name="itemWriter">
    						<bean
    							class="org.springframework.batch.sample.item.writer.PlayerItemWriter">
    							<property name="playerDao">
    								<bean
    									class="org.springframework.batch.sample.dao.JdbcPlayerDao">
    									<property name="dataSource"
    										ref="dataSource" />
    								</bean>
    							</property>
    						</bean>
    					</property>
    			
    				</bean>
    				<bean id="gameLoad" parent="simpleStep" >
    					<property name="itemReader"
    						ref="gameFileItemReader" />
    					<property name="itemWriter">
    						<bean
    							class="org.springframework.batch.sample.dao.JdbcGameDao">
    							<property name="dataSource"
    								ref="dataSource" />
    						</bean>
    					</property>
    					<property name="commitInterval" value="${job.commit.interval}" />
    				</bean>
    				<bean id="playerSummarization" parent="simpleStep" >
    					<property name="commitInterval" value="${job.commit.interval}" />
    					<property name="itemReader"
    						ref="playerSummarizationSource" />
    					<property name="itemWriter">
    						<bean
    							class="org.springframework.batch.sample.dao.JdbcPlayerSummaryDao">
    							<property name="dataSource"
    								ref="dataSource" />
    						</bean>
    					</property>
    				</bean>
    and this is the error which i am getting
    Code:
    org.springframework.beans.factory.parsing.BeanDefinitionParsingException: Configuration problem: Failed to import bean definitions from URL location [classpath:/jobs/footballJob.xml]
    Offending resource: class path resource [org/springframework/batch/sample/FootballJobFunctionalTests-context.xml]; nested exception is org.springframework.beans.factory.parsing.BeanDefinitionParsingException: Configuration problem: Unable to locate Spring NamespaceHandler for XML schema namespace [http://www.springframework.org/schema/batch]
    Offending resource: class path resource [jobs/footballJob.xml]
    
    	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)
    	at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.importBeanDefinitionResource(DefaultBeanDefinitionDocumentReader.java:182)
    	at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.parseDefaultElement(DefaultBeanDefinitionDocumentReader.java:147)
    	at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.parseBeanDefinitions(DefaultBeanDefinitionDocumentReader.java:132)
    	at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.registerBeanDefinitions(DefaultBeanDefinitionDocumentReader.java:92)
    	at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.registerBeanDefinitions(XmlBeanDefinitionReader.java:507)
    	at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:398)
    	at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:342)
    	at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:310)
    	at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:143)
    	at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:178)
    	at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:149)
    	at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:212)
    	at org.springframework.test.AbstractSingleSpringContextTests.createApplicationContext(AbstractSingleSpringContextTests.java:242)
    	at org.springframework.test.AbstractSingleSpringContextTests.loadContextLocations(AbstractSingleSpringContextTests.java:212)
    	at org.springframework.test.AbstractSingleSpringContextTests.loadContext(AbstractSingleSpringContextTests.java:187)
    	at org.springframework.test.AbstractSpringContextTests.getContext(AbstractSpringContextTests.java:140)
    	at org.springframework.test.AbstractSingleSpringContextTests.setUp(AbstractSingleSpringContextTests.java:100)
    	at junit.framework.TestCase.runBare(TestCase.java:132)
    	at org.springframework.test.ConditionalTestCase.runBare(ConditionalTestCase.java:76)
    	at junit.framework.TestResult$1.protect(TestResult.java:110)
    	at junit.framework.TestResult.runProtected(TestResult.java:128)
    	at junit.framework.TestResult.run(TestResult.java:113)
    	at junit.framework.TestCase.run(TestCase.java:124)
    	at junit.framework.TestSuite.runTest(TestSuite.java:232)
    	at junit.framework.TestSuite.run(TestSuite.java:227)
    	at org.junit.internal.runners.OldTestClassRunner.run(OldTestClassRunner.java:76)
    	at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:45)
    	at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
    	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:460)
    	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673)
    	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386)
    	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)
    Caused by: org.springframework.beans.factory.parsing.BeanDefinitionParsingException: Configuration problem: Unable to locate Spring NamespaceHandler for XML schema namespace [http://www.springframework.org/schema/batch]
    Offending resource: class path resource [jobs/footballJob.xml]

  • #2
    Is the Spring Batch Core jar on your classpath? Is there more than one version of it on your classpath?

    Comment


    • #3
      My project is having these two jars in claspath
      1.spring-batch-infrastructure-1.1.4.RELEASE.jar
      2.spring-batch-core-1.1.4.RELEASE.jar

      Comment


      • #4
        The schema only works for 2.0 and above.

        Comment


        • #5
          Same error with org.springframework.batch.core-2.0.0.RC1.jar

          Hi,

          I am having the same error and am using "org.springframework.batch.core-2.0.0.RC1.jar".

          I am new to spring and spring batch..Any idea what might be wrong?

          Thanks,

          Comment


          • #6
            Any chance there is an older Batch Core jar on the classpath as well? How are you launching your job?

            Comment


            • #7
              dont think so but

              I am running them using 'CommandLineJobRunner'. These are examples which I am trying to get up and running.
              I dont think I have old version in my classpath but I am not sure about the name of old jar file either...

              here is the list of all jar files in classpath:

              Code:
              com.springsource.antlr-2.7.6.jar;
              com.springsource.com.thoughtworks.xstream-1.3.0.jar;
              com.springsource.com.ibatis-2.3.0.677.jar;com.springsource.org.aopalliance-1.0.0.jar
              com.springsource.net.sf.cglib-2.1.3.jar
              com.springsource.javax.transaction-1.1.0.jar
              com.springsource.javax.persistence-1.0.0.jar
              com.springsource.javax.jms-1.1.0.jar
              com.springsource.javax.annotation-1.0.0.jar
              com.springsource.javassist-3.3.0.ga.jar
              com.springsource.org.apache.commons.io-1.4.0.jar
              com.springsource.org.apache.commons.dbcp-1.2.2.osgi.jar
              com.springsource.org.apache.commons.collections-3.2.0.jar
              com.springsource.org.apache.log4j-1.2.15.jar
              com.springsource.org.apache.commons.pool-1.3.0.jar
              com.springsource.org.apache.commons.logging-1.1.1.jar
              com.springsource.org.apache.commons.lang-2.1.0.jar
              com.springsource.org.aspectj.weaver-1.5.4.jar
              com.springsource.org.aspectj.runtime-1.5.4.jar
              com.springsource.org.apache.ws.commons.schema-1.3.2.jar
              com.springsource.org.easymock-2.3.0.jar
              com.springsource.org.dom4j-1.6.1.jar
              com.springsource.org.codehaus.jettison-1.0.0.jar
              com.springsource.org.hibernate.ejb-3.3.2.GA.jar
              com.springsource.org.hibernate.annotations.common-3.3.0.ga.jar
              com.springsource.org.hibernate.annotations-3.3.1.ga.jar
              com.springsource.org.hibernate-3.2.6.ga.jar
              com.springsource.org.jboss.util-2.0.4.GA.jar
              com.springsource.org.hsqldb-1.8.0.9.jar
              com.springsource.org.xmlpull-1.1.3.4-O.jar
              com.springsource.org.objectweb.asm.commons-2.2.3.jar
              com.springsource.org.objectweb.asm-2.2.3.jar
              com.springsource.org.junit-4.4.0.jar
              org.springframework.aop-2.5.6.A.jar
              org.eclipse.osgi-3.4.2.R34x_v20080826-1230.jar
              org.springframework.jdbc-2.5.6.A.jar
              org.springframework.core-2.5.6.A.jar
              org.springframework.context-2.5.6.A.jar
              org.springframework.beans-2.5.6.A.jar
              org.springframework.orm-2.5.6.A.jar
              org.springframework.jms-2.5.6.A.jar
              org.springframework.xml-1.5.5.A.jar
              org.springframework.transaction-2.5.6.A.jar
              org.springframework.test-2.5.6.A.jar
              org.springframework.oxm-1.5.5.A.jar
              org.springframework.osgi.io-1.1.2.A.jar
              org.springframework.osgi.core-1.1.2.A.jar
              org.springframework.batch.test-2.0.0.RC1.jar
              org.springframework.batch.infrastructure-2.0.0.RC1.jar
              org.springframework.batch.core-2.0.0.RC1.jar
              com.springsource.com.mysql.jdbc-5.1.6.jar
              com.springsource.javax.servlet-2.5.0.jar
              com.springsource.jcifs-1.2.15.jar
              com.springsource.net.sourceforge.jtds-1.2.2.jar
              com.springsource.oracle.jdbc-10.2.0.2.jar
              com.springsource.org.custommonkey.xmlunit-1.2.0.jar
              com.springsource.org.apache.derby-10.3.2000001.599110.jar
              com.springsource.org.postgresql.jdbc3-8.3.603.jar
              com.springsource.org.quartz-1.6.2.jar
              commons-collections-3.1.jar
              org.springframework.context.support-2.5.6.A.jar
              spring-modules-validation-0.8.jar
              org.springframework.web-2.5.6.A.jar
              stax-api-1.0.1.jar;stax-1.2.0.jar;

              Comment


              • #8
                You posted another thread as well with a different stack trace. You have both problems at the same time?

                Comment


                • #9
                  Thanks for your help

                  Yes, both were mine issues one after the other..

                  I have resolved the things and samples are running now..However I am still not sure why things did not work just out of the box as I had to move xml files across different directories..

                  but it could be just me..guess it will take a while to be fully familiar with things..

                  thanks again.

                  Comment


                  • #10
                    spring.handlers and spring.schemas

                    I use spring batch 2.0.0 and spring 2.5.6 in my project. When I assemble a jar with dependencies using maven, the spring.handlers and spring.schemas get overwritten in the meta-inf causing the "Unable to locate Spring NamespaceHandler" error.
                    There seems to be a related thread in the forum:http://forum.springsource.org/showthread.php?p=261258

                    Comment


                    • #11
                      Just for the sake of clarification: that forum post is in no way related as far as I can tell with this one (it is to do with the use of JarJar).

                      Comment

                      Working...
                      X