Announcement Announcement Module
Collapse
No announcement yet.
no declaration can be found for element 'hdp:tasklet' Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • no declaration can be found for element 'hdp:tasklet'

    Hi Friends,

    Few days age, I made some spring-hadoop programs and it run well. But today when I tried to run the sames programs I faced same problem in my all previous spring-hadoop programs.

    The problem is it shows "no declaration can be found for element 'hdp:tasklet'"

    Code:
    $ mvn exec:java -Dexec.mainClass=org.springframework.batch.core.launch.support.CommandLineJobRunner -Dexec.args="context.xml secondJob"
    [INFO] Scanning for projects...
    [INFO]
    [INFO] ------------------------------------------------------------------------
    [INFO] Building spring_hadoop_maven_wordcount 1.0-SNAPSHOT
    [INFO] ------------------------------------------------------------------------
    [INFO]
    [INFO] >>> exec-maven-plugin:1.2.1:java (default-cli) @ spring_hadoop_maven_wordcount >>>
    [INFO]
    [INFO] <<< exec-maven-plugin:1.2.1:java (default-cli) @ spring_hadoop_maven_wordcount <<<
    [INFO]
    [INFO] --- exec-maven-plugin:1.2.1:java (default-cli) @ spring_hadoop_maven_wordcount ---
    12/07/30 16:40:24 INFO support.ClassPathXmlApplicationContext: Refreshing org.springframework.context.support.ClassPathXmlApplicationContext@12a66ea: startup date [Mon Jul 30 16:40:24 IST 2012]; root of context hierarchy
    12/07/30 16:40:24 INFO xml.XmlBeanDefinitionReader: Loading XML bean definitions from class path resource [context.xml]
    12/07/30 16:40:25 ERROR support.CommandLineJobRunner: Job Terminated in error: Line 32 in XML document from class path resource [context.xml] is invalid; nested exception is org.xml.sax.SAXParseException: cvc-complex-type.2.4.c: The matching wildcard is strict, but no declaration can be found for element 'hdp:tasklet'.
    org.springframework.beans.factory.xml.XmlBeanDefinitionStoreException: Line 32 in XML document from class path resource [context.xml] is invalid; nested exception is org.xml.sax.SAXParseException: cvc-complex-type.2.4.c: The matching wildcard is strict, but no declaration can be found for element 'hdp:tasklet'.
            at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:396)
            at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:334)
            at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:302)
            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.context.support.AbstractXmlApplicationContext.loadBeanDefinitions(AbstractXmlApplicationContext.java:126)
            at org.springframework.context.support.AbstractXmlApplicationContext.loadBeanDefinitions(AbstractXmlApplicationContext.java:92)
            at org.springframework.context.support.AbstractRefreshableApplicationContext.refreshBeanFactory(AbstractRefreshableApplicationContext.java:130)
            at org.springframework.context.support.AbstractApplicationContext.obtainFreshBeanFactory(AbstractApplicationContext.java:467)
            at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:397)
            at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:139)
            at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:83)
            at org.springframework.batch.core.launch.support.CommandLineJobRunner.start(CommandLineJobRunner.java:282)
            at org.springframework.batch.core.launch.support.CommandLineJobRunner.main(CommandLineJobRunner.java:574)
            at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
            at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
            at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
            at java.lang.reflect.Method.invoke(Method.java:597)
            at org.codehaus.mojo.exec.ExecJavaMojo$1.run(ExecJavaMojo.java:297)
            at java.lang.Thread.run(Thread.java:662)
    Caused by: org.xml.sax.SAXParseException: cvc-complex-type.2.4.c: The matching wildcard is strict, but no declaration can be found for element 'hdp:tasklet'.
            at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException(ErrorHandlerWrapper.java:195)
            at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.error(ErrorHandlerWrapper.java:131)
            at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:384)
            at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:318)
            at com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator$XSIErrorReporter.reportError(XMLSchemaValidator.java:417)
            at com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator.reportSchemaError(XMLSchemaValidator.java:3182)
            at com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator.handleStartElement(XMLSchemaValidator.java:1927)
            at com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator.emptyElement(XMLSchemaValidator.java:725)
            at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.scanStartElement(XMLNSDocumentScannerImpl.java:377)
            at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(XMLDocumentFragmentScannerImpl.java:2756)
            at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:648)
            at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.next(XMLNSDocumentScannerImpl.java:140)
            at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:511)
            at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:808)
            at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:737)
            at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:119)
            at com.sun.org.apache.xerces.internal.parsers.DOMParser.parse(DOMParser.java:235)
            at com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderImpl.parse(DocumentBuilderImpl.java:284)
            at org.springframework.beans.factory.xml.DefaultDocumentLoader.loadDocument(DefaultDocumentLoader.java:75)
            at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:388)
            ... 21 more
    Can you plz find out what is wrong going on ...
    Last edited by paragflume; Jul 30th, 2012, 08:53 AM.

  • #2
    context.xml 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:hdp="http://www.springframework.org/schema/hadoop"
            xmlns:p="http://www.springframework.org/schema/p"
            xmlns:batch="http://www.springframework.org/schema/batch"
            xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
            http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd
            http://www.springframework.org/schema/hadoop http://www.springframework.org/schema/hadoop/spring-hadoop.xsd
            http://www.springframework.org/schema/batch http://www.springframework.org/schema/batch/spring-batch-2.1.xsd">
    
            <import resource="applicationContext.xml"/>
    
            <bean name="firstTasklet" class="org.test.SecondTasklet">
                    <property name="message" value="FIRST MESSAGE"/>
            </bean>
            <bean name="secondTasklet" class="org.test.SecondTasklet">
                    <property name="message" value="SECOND MESSAGE"/>
            </bean>
            <bean name="thirdTasklet" class="org.test.SecondTasklet">
                    <property name="message" value="THIRD MESSAGE"/>
            </bean>
            <bean name="fourthTasklet" class="org.test.SecondTasklet">
                    <property name="message" value="FOURTH MESSAGE"/>
            </bean>
            <bean name="fifthTasklet" class="org.test.SecondTasklet">
                    <property name="message" value="FIFTH MESSAGE"/>
            </bean>
    
            <hdp:tasklet id="wordcount-tasklet" job-ref="wordcount-job"/>
    
            <hdp:tasklet id="wordcount-tasklet2" job-ref="wordcount-job2"/>
    
            <hdp:tasklet id="wordcount-tasklet3" job-ref="wordcount-job3"/>
    
            <batch:job id="secondJob" job-repository="jobRepository">
    
                    <batch:step id="firstJobStep">
                            <batch:tasklet ref="firstTasklet" />
                    </batch:step>
    
                    <batch:step id="firstJobStep" next="secondJobStep">
                            <batch:tasklet ref="firstTasklet" />
                    </batch:step>
                    <batch:step id="secondJobStep" next="thirdJobStep">
                            <batch:tasklet ref="secondTasklet" />
                    </batch:step>
                    <batch:step id="thirdJobStep" next="fourthJobStep">
                            <batch:tasklet ref="thirdTasklet" />
                    </batch:step>
                    <batch:step id="fourthJobStep" next="fifthJobStep">
                            <batch:tasklet ref="fourthTasklet" />
                    </batch:step>
                    <batch:step id="fifthJobStep" next="sixthJobStep" >
                            <batch:tasklet ref="fifthTasklet" />
                    </batch:step>
                    <batch:step id="sixthJobStep" next="seventhJobStep">
                            <batch:tasklet ref="wordcount-tasklet" />
                    </batch:step>
                    <batch:step id="seventhJobStep" next="eighthJobStep">
                            <batch:tasklet ref="wordcount-tasklet2" />
                    </batch:step>
    
                    <batch:step id="eighthJobStep">
                            <batch:tasklet ref="wordcount-tasklet3" />
                    </batch:step>
    
            </batch:job>
    
            <bean id="message"      class="org.test.Message"/>
    
            <context:property-placeholder location="hadoop.properties"/>
    
            <hdp:configuration>
                    fs.default.name=${hd.fs}
            </hdp:configuration>
    
            <hdp:job id="wordcount-job" validate-paths="false"
                input-path="/user/test1/licence" output-path="/user/test2/output_4"
                    mapper="org.test.FirstMapReduce.FirstMaper"
                    reducer="org.test.FirstMapReduce.FirstReducer"/>
    
            <hdp:job id="wordcount-job2" validate-paths="false"
                input-path="/user/test1/licence" output-path="/user/test2/output_5"
                    mapper="org.test.FirstMapReduce.FirstMaper"
                    reducer="org.test.FirstMapReduce.FirstReducer"/>
    
            <hdp:job id="wordcount-job3" validate-paths="false"
                input-path="/user/test1/licence" output-path="/user/test2/output_6"
                    mapper="org.test.FirstMapReduce.FirstMaper"
                    reducer="org.test.FirstMapReduce.FirstReducer"/>
    </beans>

    Comment


    • #3
      Take a look at the namespace - tasklet was renamed to job-tasklet to align it with the rest of the tasklet definitions.
      In the future, if you encounter XML problems, just look at the backing XSD.

      Comment


      • #4
        Hi Costin,
        Thank for the reply... It solved the problem ..

        Comment


        • #5
          but no declaration can be found for element 'hdp:tasklet&quot;

          Hi Costin,

          I am stuck with similar kind of problem.
          Though I have checked the XSD and it does contain the element "tasklet" in spring batch and hadoop

          Below is out configuration xml
          Code:
          <?xml version="1.0" encoding="UTF-8"?>
          <beans:beans xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
              xmlns:beans="http://www.springframework.org/schema/beans"
          	xmlns:context="http://www.springframework.org/schema/context"
          	xmlns:hdp="http://www.springframework.org/schema/hadoop"
          	xmlns:batch="http://www.springframework.org/schema/batch"
          	xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
          	http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd
          	http://www.springframework.org/schema/batch http://www.springframework.org/schema/batch/spring-batch.xsd
          	http://www.springframework.org/schema/hadoop http://www.springframework.org/schema/hadoop/spring-hadoop.xsd">
          	
          
          
          
          <!-- <beans:import resource="applicationContext.xml" />
          <beans:import resource="hadoopJobs.xml" /> -->
          
          
          
          	<batch:job id="helloWorldJob6" job-repository="jobRepository">
          
          		<batch:step id="step1" next="decision">
          			<batch:tasklet ref="helloWorldTasklet1" />
          		</batch:step>
          
          		<batch:decision id="decision" decider="decider">
          			<batch:next on="JUMP" to="step2" />
          			<batch:next on="NOJUMP" to="mrjob" />
          		</batch:decision>
          
          		<batch:step id="step2">
          			<batch:tasklet ref="helloWorldTasklet2" />
          		</batch:step>
          
          <!-- 		<batch:step id="step3">
          			<batch:tasklet ref="helloWorldTasklet3" />
          		</batch:step> -->
          	
          		<batch:step id="mrjob">
          		<batch:tasklet ref="hadoop-tasklet" />
          		</batch:step>
          	</batch:job>
          	
          	
          		<beans:bean id="dataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource">
                  <beans:property name="driverClassName" value="com.mysql.jdbc.Driver"/>
                  <beans:property name="url" value="jdbc:mysql://127.0.0.1:3306/springbatch?createDatabaseIfNotExist=true"/>
                  <beans:property name="username" value="root"/>
                  <beans:property name="password" value="windows18$"/>
          </beans:bean>
          	
          	
          	<beans:bean name="helloWorldTasklet1" class="org.abhi.springBatch.exmaples.helloworld.HelloWorld1" />
          	<beans:bean name="helloWorldTasklet2" class="org.abhi.springBatch.exmaples.helloworld.HelloWorld2" />
          	<beans:bean name="helloWorldTasklet3" class="org.abhi.springBatch.exmaples.helloworld.HelloWorld3" />
          	<beans:bean id="decider" class="org.abhi.springBatch.exmaples.helloworld.HelloWorldDecider"/>
          
          <beans:bean id="jobRepository"
              class="org.springframework.batch.core.repository.support.JobRepositoryFactoryBean">
                  <beans:property name="dataSource" ref="dataSource"/>
              <beans:property name="transactionManager" ref="transactionManager" />
          </beans:bean>
          
          
          	<beans:bean id="jobLauncher"
          		class="org.springframework.batch.core.launch.support.SimpleJobLauncher">
          		<beans:property name="jobRepository" ref="jobRepository" />
          	</beans:bean>
          
          	<beans:bean id="transactionManager"
          		class="org.springframework.batch.support.transaction.ResourcelessTransactionManager" />
          		
          		
          		
          		
          		
          		
          		
          		
          		
          		
          		
          		
          		
          		
          		<context:property-placeholder location="hadoop.properties"/>
          
           <hdp:configuration>
           fs.default.name=${hd.fs}
           mapred.job.tracker=${hd.jobtracker}
          </hdp:configuration>
          	
          <hdp:job id="mr-job" scope="step"
          	     input-path="${mapper.input.directory}" 
          	     output-path="${reducer.output.directory}" 
          		 mapper="org.my.mapper.MovieDetailsMappers"
          		 reducer="org.my.reducer.MovieDetailsReducerSix"/>
          		 
          		 <!-- <hdp:cache create-symlink="true">
          			<hdp:cache value="/user/testdata/u.item" />
          			<hdp:cache value="/user/testdata/u.user" />
          		</hdp:cache> -->
          
          	<!-- <hdp:tasklet id="hadoop-tasklet" job-ref="mr-job" wait-for-job="true" /> -->
          	
          	<hdp:tasklet id="hadoop-tasklet"/>
          	
          
          	
          
          
          
          	<!-- To run the job from the command line type the following: mvn exec:java 
          		-Dexec.mainClass=org.springframework.batch.core.launch.support.CommandLineJobRunner 
          		-Dexec.args="simpleJob.xml helloWorldJob" -->
          </beans:beans>
          Below mentioned is the error we are getting
          Code:
           INFO xml.XmlBeanDefinitionReader: Loading XML bean definitions from class path resource [workflow.xml]
          13/01/30 18:17:52 ERROR support.CommandLineJobRunner: Job Terminated in error: Line 106 in XML document from class path resource [workflow.xml] is invalid; nested exception is org.xml.sax.SAXParseException: cvc-complex-type.2.4.c: The matching wildcard is strict, but no declaration can be found for element 'hdp:tasklet'.
          org.springframework.beans.factory.xml.XmlBeanDefinitionStoreException: Line 106 in XML document from class path resource [workflow.xml] is invalid; nested exception is org.xml.sax.SAXParseException: cvc-complex-type.2.4.c: The matching wildcard is strict, but no declaration can be found for element 'hdp:tasklet'.
          	at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:396)
          	at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:334)
          	at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:302)
          	at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:174)
          	at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:209)
          	at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:180)
          	at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:243)
          	at org.springframework.context.support.AbstractXmlApplicationContext.loadBeanDefinitions(AbstractXmlApplicationContext.java:127)
          	at org.springframework.context.support.AbstractXmlApplicationContext.loadBeanDefinitions(AbstractXmlApplicationContext.java:93)
          	at org.springframework.context.support.AbstractRefreshableApplicationContext.refreshBeanFactory(AbstractRefreshableApplicationContext.java:131)
          	at org.springframework.context.support.AbstractApplicationContext.obtainFreshBeanFactory(AbstractApplicationContext.java:527)
          	at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:441)
          	at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:139)
          	at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:83)
          	at org.springframework.batch.core.launch.support.CommandLineJobRunner.start(CommandLineJobRunner.java:282)
          	at org.springframework.batch.core.launch.support.CommandLineJobRunner.main(CommandLineJobRunner.java:574)
          	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
          	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
          	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
          	at java.lang.reflect.Method.invoke(Method.java:597)
          	at org.codehaus.mojo.exec.ExecJavaMojo$1.run(ExecJavaMojo.java:297)
          	at java.lang.Thread.run(Thread.java:619)
          Caused by: org.xml.sax.SAXParseException: cvc-complex-type.2.4.c: The matching wildcard is strict, but no declaration can be found for element 'hdp:tasklet'.
          	at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException(ErrorHandlerWrapper.java:195)
          	at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.error(ErrorHandlerWrapper.java:131)
          	at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:384)
          	at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:318)
          	at com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator$XSIErrorReporter.reportError(XMLSchemaValidator.java:417)
          	at com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator.reportSchemaError(XMLSchemaValidator.java:3181)
          	at com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator.handleStartElement(XMLSchemaValidator.java:1926)
          	at com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator.emptyElement(XMLSchemaValidator.java:725)
          	at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.scanStartElement(XMLNSDocumentScannerImpl.java:377)
          	at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(XMLDocumentFragmentScannerImpl.java:2755)
          	at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:648)
          	at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.next(XMLNSDocumentScannerImpl.java:140)
          	at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:511)
          	at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:808)
          	at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:737)
          	at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:119)
          	at com.sun.org.apache.xerces.internal.parsers.DOMParser.parse(DOMParser.java:235)
          	at com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderImpl.parse(DocumentBuilderImpl.java:284)
          	at org.springframework.beans.factory.xml.DefaultDocumentLoader.loadDocument(DefaultDocumentLoader.java:75)
          	at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:388)
          	... 21 more

          Please help,

          Thanks in advance

          Comment


          • #6
            Try job-tasklet - tasklet was renamed in RC1 to make it consistent with the rest of the tasklet definitions.

            Comment

            Working...
            X