Results 1 to 3 of 3

Thread: spring data schema location

  1. #1
    Join Date
    Sep 2012
    Posts
    5

    Default spring data schema location

    Hi,

    I'm new to Spring Data and trying to integrate hadoop with Spring. With the following applicationContext.xml, I got an genericOptionType error when parsing the xml file during server start up.

    <?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="http://www.springframework.org/schema/p"
    xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schem...ring-beans.xsd
    http://www.springframework.org/schema/context http://www.springframework.org/schem...ng-context.xsd
    http://www.springframework.org/schema/hadoop http://www.springframework.org/schema/hadoop/spring-hadoop.xsd">


    <contextroperty-placeholder location="hadoop.properties"/>

    <hdp:configuration>
    fs.default.name=${hd.fs}
    </hdp:configuration>

    <hdp:hbase-configuration configuration-ref="hadoopConfiguration"/>

    <bean id="hTemplate" class="org.springframework.data.hadoop.hbase.Hbase Template" p:configuration-ref="hbaseConfiguration"/>

    <context:component-scan base-package="org.springframework.data.hadoop.samples.h base"/>

    </beans>

    SEVERE: Exception sending context initialized event to listener instance of class com.dell.wnm.platform.core.controllerindigo.Indigo StartupListener
    org.springframework.beans.factory.xml.XmlBeanDefin itionStoreException: Line 250 in XML document from ServletContext resource [/WEB-INF/applicationContext.xml] is invalid; nested exception is org.xml.sax.SAXParseException: cos-ct-extends.1.4.2.2.2.2.1: Error for type 'genericOptionsType'. The content type of a derived type and that of its base must both be mixed or element-only.
    at org.springframework.beans.factory.xml.XmlBeanDefin itionReader.doLoadBeanDefinitions(XmlBeanDefinitio nReader.java:396)
    at org.springframework.beans.factory.xml.XmlBeanDefin itionReader.loadBeanDefinitions(XmlBeanDefinitionR eader.java:334)
    at org.springframework.beans.factory.xml.XmlBeanDefin itionReader.loadBeanDefinitions(XmlBeanDefinitionR eader.java:302)
    at org.springframework.beans.factory.support.Abstract BeanDefinitionReader.loadBeanDefinitions(AbstractB eanDefinitionReader.java:143)
    at org.springframework.beans.factory.support.Abstract BeanDefinitionReader.loadBeanDefinitions(AbstractB eanDefinitionReader.java:178)
    at org.springframework.beans.factory.support.Abstract BeanDefinitionReader.loadBeanDefinitions(AbstractB eanDefinitionReader.java:149)
    at org.springframework.web.context.support.XmlWebAppl icationContext.loadBeanDefinitions(XmlWebApplicati onContext.java:124)
    at org.springframework.web.context.support.XmlWebAppl icationContext.loadBeanDefinitions(XmlWebApplicati onContext.java:93)
    at org.springframework.context.support.AbstractRefres hableApplicationContext.refreshBeanFactory(Abstrac tRefreshableApplicationContext.java:130)
    at org.springframework.context.support.AbstractApplic ationContext.obtainFreshBeanFactory(AbstractApplic ationContext.java:467)
    at org.springframework.context.support.AbstractApplic ationContext.refresh(AbstractApplicationContext.ja va:397)
    at org.springframework.web.context.ContextLoader.crea teWebApplicationContext(ContextLoader.java:276)
    at org.springframework.web.context.ContextLoader.init WebApplicationContext(ContextLoader.java:197)
    at org.springframework.web.context.ContextLoaderListe ner.contextInitialized(ContextLoaderListener.java: 47)
    at com.dell.wnm.platform.core.controllerindigo.Indigo StartupListener.contextInitialized(IndigoStartupLi stener.java:27)
    at org.apache.catalina.core.StandardContext.listenerS tart(StandardContext.java:4779)
    at org.apache.catalina.core.StandardContext.startInte rnal(StandardContext.java:5273)
    at org.apache.catalina.util.LifecycleBase.start(Lifec ycleBase.java:150)
    at org.apache.catalina.core.ContainerBase.addChildInt ernal(ContainerBase.java:897)
    at org.apache.catalina.core.ContainerBase.addChild(Co ntainerBase.java:873)
    at org.apache.catalina.core.StandardHost.addChild(Sta ndardHost.java:615)
    at org.apache.catalina.startup.HostConfig.deployWAR(H ostConfig.java:958)
    at org.apache.catalina.startup.HostConfig$DeployWar.r un(HostConfig.java:1599)
    at java.util.concurrent.Executors$RunnableAdapter.cal l(Executors.java:441)
    at java.util.concurrent.FutureTask$Sync.innerRun(Futu reTask.java:303)

    This seems related to the schema (spring-hadoop.xsd). Spring Data documentation mentioned that although the schema location indicates external file, but it will resolve the schema locally since it is available in the spring hadoop jar. Does that mean the spring-hadoop.xsd will be picked up from the local jar file instead of using the external one?

    Thanks,

    YuLing

  2. #2
    Join Date
    Jan 2005
    Location
    Bucharest, Romania
    Posts
    5,403

    Default

    Hi,

    The XSD is embedded in the jar and it should be resolved locally - the schema is also available at the public registered URL but that's typically a fallback used for tools that cannot read it locally.
    The error however should not occur as it looks like the parser or the schema is invalid. We have nightly builds against the namespace so the latter is incorrect which leads me to believe there's something wrong with the former.

    What version of the JDK/Tomcat/SHDP are you using?

    Cheers,

    P.S. Can you please wrap the stacktrace/xml with code tags next time to increase readability? Thanks.
    Costin Leau
    SpringSource - http://www.SpringSource.com- Spring Training, Consulting, and Support - "From the Source"
    http://twitter.com/costinl
    Please use [ c o d e ] [ / c o d e ] tags

  3. #3
    Join Date
    Jan 2005
    Location
    Bucharest, Romania
    Posts
    5,403

    Default

    I've done some minor adjustments to the XSD which should fix your problem so please do try out the latest snapshot (http://www.springsource.org/spring-data/hadoop#maven). The validator in Eclipse and on-line pass just fine - let me know if this is or not the case for you.
    Cheers,
    Costin Leau
    SpringSource - http://www.SpringSource.com- Spring Training, Consulting, and Support - "From the Source"
    http://twitter.com/costinl
    Please use [ c o d e ] [ / c o d e ] tags

Posting Permissions

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