Announcement Announcement Module
Collapse
No announcement yet.
Unexpected exception parsing XML document from class path resource Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Unexpected exception parsing XML document from class path resource

    Hi Peoples.

    I have one applicationContext and this load beans of datasource, hibernate, jobsFactory and one Job.
    But when this load job xml I have one error of parser xml.
    I think my applicationContext not able load tags of jobs <jobs></job>.

    What I would do to solution this problem?

    ApplicationContext:
    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:util="http://www.springframework.org/schema/util"
    	xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
    	http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-2.0.xsd">
    
    	<import resource="hibernate-context.xml" />
    	<import resource="applicationContext-DAO.xml" />
    	<import resource="simple-job-launcher-context.xml" />
    	<import resource="requesterElectronicInvoice.xml" />
    
    </beans>
    bean of job where the error doing:
    Code:
    <beans:beans xmlns="http://www.springframework.org/schema/batch"
    	xmlns:beans="http://www.springframework.org/schema/beans" 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">
    
    	<job id="requesterElectronicInvoice">
    		<step id="readerInvoice">
    			<tasklet>
    				<chunk reader="itemReader"/>
    			</tasklet>
    		</step>
    	</job>
    
    	<beans:bean id="ReaderInvoice" class="br.com.moip.jobs.rnf.ReaderInvoice">
    		<beans:property name="sessionFactory" ref="sessionFactory" />
    	</beans:bean>
    
    	<beans:bean id="itemReader"
    		class="org.springframework.batch.item.database.HibernateCursorItemReader">
    		<beans:property name="sessionFactory" ref="sessionFactory" />
    		<beans:property name="queryString" value="from PaymentUsed" />
    	</beans:bean>
    
    </beans:beans>

    Error:]
    Code:
    2009-07-03 15:41:40,197 INFO  [main] xml.XmlBeanDefinitionReader (XmlBeanDefinitionReader.java:303) - Loading XML bean definitions from class path resource [requesterElectronicInvoice.xml]
    java.lang.ExceptionInInitializerError
    Caused by: org.springframework.beans.factory.parsing.BeanDefinitionParsingException: Configuration problem: Failed to import bean definitions from relative location [requesterElectronicInvoice.xml]
    Offending resource: class path resource [applicationContext.xml]; nested exception is org.springframework.beans.factory.BeanDefinitionStoreException: Unexpected exception parsing XML document from class path resource [requesterElectronicInvoice.xml]; nested exception is java.lang.NoSuchMethodError: org.springframework.beans.factory.support.BeanDefinitionBuilder.genericBeanDefinition(Ljava/lang/String;)Lorg/springframework/beans/factory/support/BeanDefinitionBuilder;
    	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:195)
    	at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.parseDefaultElement(DefaultBeanDefinitionDocumentReader.java:145)
    	at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.parseBeanDefinitions(DefaultBeanDefinitionDocumentReader.java:130)
    	at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.registerBeanDefinitions(DefaultBeanDefinitionDocumentReader.java:90)
    	at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.registerBeanDefinitions(XmlBeanDefinitionReader.java:468)
    	at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:363)
    	at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:313)
    	at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:290)
    	at org.springframework.beans.factory.xml.XmlBeanFactory.<init>(XmlBeanFactory.java:73)
    	at org.springframework.beans.factory.xml.XmlBeanFactory.<init>(XmlBeanFactory.java:61)
    	at br.com.moip.initializer.ApplicationContextFactoryJob.<init>(ApplicationContextFactoryJob.java:62)
    	at br.com.moip.initializer.ApplicationContextFactoryJob.<clinit>(ApplicationContextFactoryJob.java:56)
    Caused by: org.springframework.beans.factory.BeanDefinitionStoreException: Unexpected exception parsing XML document from class path resource [requesterElectronicInvoice.xml]; nested exception is java.lang.NoSuchMethodError: org.springframework.beans.factory.support.BeanDefinitionBuilder.genericBeanDefinition(Ljava/lang/String;)Lorg/springframework/beans/factory/support/BeanDefinitionBuilder;
    	at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:385)
    	at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:313)
    	at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:290)
    	at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.importBeanDefinitionResource(DefaultBeanDefinitionDocumentReader.java:185)
    	... 11 more
    Caused by: java.lang.NoSuchMethodError: org.springframework.beans.factory.support.BeanDefinitionBuilder.genericBeanDefinition(Ljava/lang/String;)Lorg/springframework/beans/factory/support/BeanDefinitionBuilder;
    	at org.springframework.batch.core.configuration.xml.CoreNamespaceUtils.checkForStepScope(CoreNamespaceUtils.java:68)
    	at org.springframework.batch.core.configuration.xml.CoreNamespaceUtils.autoregisterBeansForNamespace(CoreNamespaceUtils.java:51)
    	at org.springframework.batch.core.configuration.xml.JobParser.doParse(JobParser.java:61)
    	at org.springframework.beans.factory.xml.AbstractSingleBeanDefinitionParser.parseInternal(AbstractSingleBeanDefinitionParser.java:81)
    	at org.springframework.beans.factory.xml.AbstractBeanDefinitionParser.parse(AbstractBeanDefinitionParser.java:56)
    	at org.springframework.beans.factory.xml.NamespaceHandlerSupport.parse(NamespaceHandlerSupport.java:69)
    	at org.springframework.beans.factory.xml.BeanDefinitionParserDelegate.parseCustomElement(BeanDefinitionParserDelegate.java:1123)
    	at org.springframework.beans.factory.xml.BeanDefinitionParserDelegate.parseCustomElement(BeanDefinitionParserDelegate.java:1113)
    	at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.parseBeanDefinitions(DefaultBeanDefinitionDocumentReader.java:133)
    	at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.registerBeanDefinitions(DefaultBeanDefinitionDocumentReader.java:90)
    	at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.registerBeanDefinitions(XmlBeanDefinitionReader.java:468)
    	at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:363)
    	... 14 more
    Exception in thread "main"

  • #2
    Do you have the correct spring-beans jar? You'll need version 2.5.x...

    Comment

    Working...
    X