Announcement Announcement Module
Collapse
No announcement yet.
Unable to locate Spring NamespaceHandler for [http://www.hazelcast.com/schema/spring] Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Unable to locate Spring NamespaceHandler for [http://www.hazelcast.com/schema/spring]

    I am trying to get spring configured for hazelcast.
    I have hazelcast-spring-2.0-RC1.jar and hazelcast-2.0.1.jar in the classpath.

    When I launch the application with the following xml file :

    Code:
    <?xml version="1.0" encoding="UTF-8"?>
    <beans xmlns="http://www.springframework.org/schema/beans"
     xmlns:hz="http://www.hazelcast.com/schema/spring"
     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
     xmlns:jdbc="http://www.springframework.org/schema/jdbc"
     xmlns:jee="http://www.springframework.org/schema/jee"
     xmlns:cache="http://www.springframework.org/schema/cache"
     xsi:schemaLocation="http://www.springframework.org/schema/jee http://www.springframework.org/schem...ng-jee-3.1.xsd
      http://www.springframework.org/schema/jdbc http://www.springframework.org/schem...g-jdbc-3.1.xsd
      http://www.springframework.org/schema/beans http://www.springframework.org/schem...-beans-3.1.xsd
      http://www.springframework.org/schema/cache http://www.springframework.org/schem...ring-cache.xsd
      http://www.hazelcast.com/schema/spring http://www.hazelcast.com/schema/spring/hazelcast-spring-2.0.xsd">
     
     <cache:annotation-driven cache-manager="cacheManager"/>
    	   
    
     <bean id="testService" class="cache.TestService"/>
        
     <hz:hazelcast id="myhzinstance">
           <hz:config>
               <hz:group name="dev" password="dev"/>
               <hz:properties>
                   <hz:property name="hazelcast.merge.first.run.delay.seconds">5</hz:property>
                   <hz:property name="hazelcast.merge.next.run.delay.seconds">5</hz:property>
               </hz:properties>
    
               <hz:network port="5701" port-auto-increment="false">
                   <hz:join>
                       <hz:multicast enabled="true" />
                   </hz:join>
               </hz:network>
              <hz:map  name="personcache" /> 
           </hz:config>
       </hz:hazelcast>
    
     
       
       <!-- generic cache manager -->
     <bean id="cacheManager" class="framework.HazelcastCacheManager">
       <constructor-arg ref="hazelinstance" /> 
        <constructor-arg value="myhzinstance" /> 
        <property name="caches">
            <set>
          			<value>personcache</value>
     		 </set>
     </property>
     </bean>
        
    </beans>
    I get the following error :

    INFO: Loading XML bean definitions from class path resource [person.xml]
    Exception in thread "main" org.springframework.beans.factory.parsing.BeanDefi nitionParsingException: Configuration problem: Unable to locate Spring NamespaceHandler for XML schema namespace [http://www.hazelcast.com/schema/spring]
    Offending resource: class path resource [person.xml]

    at org.springframework.beans.factory.parsing.FailFast ProblemReporter.error(FailFastProblemReporter.java :68)
    at org.springframework.beans.factory.parsing.ReaderCo ntext.error(ReaderContext.java:85)
    at org.springframework.beans.factory.parsing.ReaderCo ntext.error(ReaderContext.java:80)
    at org.springframework.beans.factory.xml.BeanDefiniti onParserDelegate.error(BeanDefinitionParserDelegat e.java:316)
    at org.springframework.beans.factory.xml.BeanDefiniti onParserDelegate.parseCustomElement(BeanDefinition ParserDelegate.java:1416)
    at org.springframework.beans.factory.xml.BeanDefiniti onParserDelegate.parseCustomElement(BeanDefinition ParserDelegate.java:1409)
    at org.springframework.beans.factory.xml.DefaultBeanD efinitionDocumentReader.parseBeanDefinitions(Defau ltBeanDefinitionDocumentReader.java:184)
    at org.springframework.beans.factory.xml.DefaultBeanD efinitionDocumentReader.doRegisterBeanDefinitions( DefaultBeanDefinitionDocumentReader.java:140)
    at org.springframework.beans.factory.xml.DefaultBeanD efinitionDocumentReader.registerBeanDefinitions(De faultBeanDefinitionDocumentReader.java:111)
    at org.springframework.beans.factory.xml.XmlBeanDefin itionReader.registerBeanDefinitions(XmlBeanDefinit ionReader.java:493)
    at org.springframework.beans.factory.xml.XmlBeanDefin itionReader.doLoadBeanDefinitions(XmlBeanDefinitio nReader.java:390)
    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:174)
    at org.springframework.beans.factory.support.Abstract BeanDefinitionReader.loadBeanDefinitions(AbstractB eanDefinitionReader.java:209)
    at org.springframework.beans.factory.support.Abstract BeanDefinitionReader.loadBeanDefinitions(AbstractB eanDefinitionReader.java:180)
    at org.springframework.beans.factory.support.Abstract BeanDefinitionReader.loadBeanDefinitions(AbstractB eanDefinitionReader.java:243)
    at org.springframework.context.support.AbstractXmlApp licationContext.loadBeanDefinitions(AbstractXmlApp licationContext.java:127)
    at org.springframework.context.support.AbstractXmlApp licationContext.loadBeanDefinitions(AbstractXmlApp licationContext.java:93)
    at org.springframework.context.support.AbstractRefres hableApplicationContext.refreshBeanFactory(Abstrac tRefreshableApplicationContext.java:131)
    at org.springframework.context.support.AbstractApplic ationContext.obtainFreshBeanFactory(AbstractApplic ationContext.java:522)
    at org.springframework.context.support.AbstractApplic ationContext.refresh(AbstractApplicationContext.ja va:436)
    at org.springframework.context.support.ClassPathXmlAp plicationContext.<init>(ClassPathXmlApplicationCon text.java:139)
    at org.springframework.context.support.ClassPathXmlAp plicationContext.<init>(ClassPathXmlApplicationCon text.java:83)
    at cache.TestClient.main(TestClient.java:9)

    I am using spring framework 3.1.1.

    Any help will be greatly appreciated !!
    Last edited by ssudhaka555; May 9th, 2012, 01:30 PM.

  • #2
    Try putting this intead
    Code:
    <beans xmlns="http://www.springframework.org/schema/beans"
    xmlns:hz="http://www.hazelcast.com/schema/config"
     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
     xmlns:jdbc="http://www.springframework.org/schema/jdbc"
     xmlns:jee="http://www.springframework.org/schema/jee"
     xmlns:cache="http://www.springframework.org/schema/cache"
     xsi:schemaLocation="http://www.springframework.org/schema/jee http://www.springframework.org/schem...ng-jee-3.1.xsd
      http://www.springframework.org/schema/jdbc http://www.springframework.org/schem...g-jdbc-3.1.xsd
      http://www.springframework.org/schema/beans http://www.springframework.org/schem...-beans-3.1.xsd
      http://www.springframework.org/schema/cache http://www.springframework.org/schem...ring-cache.xsd
      http://www.hazelcast.com/schema/config http://www.hazelcast.com/schema/config/hazelcast-spring.xsd">
    All i have changed are those marked in bold. I took a look at the spring.schemas and spring.handlers files in the META-INF of the hazelcast-spring-2.0-RC1.jar changed these values accordingly.

    Also assuming the appropriate jar files are present in your classpath
    Let us know if that helps..
    Last edited by Amol Nayak; May 9th, 2012, 02:30 PM. Reason: formatting

    Comment

    Working...
    X