2

I am trying to integrate spring and Apache solr. For that i am trying NamespaceHandler http://www.springframework.org/schema/data/solr. But this giving me the following error. Can any please help me.

<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:oxm="http://www.springframework.org/schema/oxm" xmlns:tx="http://www.springframework.org/schema/tx"
xmlns:aop="http://www.springframework.org/schema/aop" xmlns:task="http://www.springframework.org/schema/task" 
xmlns:solr="http://www.springframework.org/schema/data/solr"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-3.0.xsd
http://www.springframework.org/schema/oxm
http://www.springframework.org/schema/oxm/spring-oxm-3.0.xsd
http://www.springframework.org/schema/tx
http://www.springframework.org/schema/tx/spring-tx-3.2.xsd
http://www.springframework.org/schema/aop 
http://www.springframework.org/schema/aop/spring-aop-3.0.xsd
http://www.springframework.org/schema/task
http://www.springframework.org/schema/task/spring-task.xsd
http://www.springframework.org/schema/data/solr
http://www.springframework.org/schema/data/solr/spring-solr.xsd
">

This is leading to an error

Configuration problem: Unable to locate Spring NamespaceHandler for XML schema namespace [http://www.springframework.org/schema/data/solr]Offending resource: ServletContext resource [/WEB-INF/applicationContext.xml]

Thanx in advance for any help..

Dibyendu
  • 51
  • 7
  • Try changing "http://www.springframework.org/schema/data/solr/spring-solr.xsd" to "http://www.springframework.org/schema/data/solr/spring-solr-1.0.xsd" – Leandro Carracedo Jan 03 '15 at 17:24
  • Make sure you have the `spring-data-sold` jars in your class path. @PatrickLC it is recommended to use the version less schema's that way you always have the most recent version of the xsd at your disposal. – M. Deinum Jan 03 '15 at 18:13
  • I have added spring-data-solr-1.1.0.RELEASE.jar in my classpath. Which resolved the above mentioned error but there is another error occurring . Mentioning that java.lang.ClassNotFoundException: org.springframework.data.repository.config.RepositoryConfigurationExtension – Dibyendu Jan 03 '15 at 18:35
  • I have added another jar spring-data-commons-1.5.0.RELEASE.jar but this time it is unable to find org.apache.solr.common.SolrException. SolrException is present in the added jars but in a different package which is org.springframework.data.solr.core.SolrException. Can any one please help me .. – Dibyendu Jan 03 '15 at 18:56
  • You should be using something like maven or gradle to manage your dependencies. You are searching the internet yourself don't. – M. Deinum Jan 04 '15 at 08:31

1 Answers1

0

If this is a new project, you should start from Spring Boot and add Spring Data Solr into it. There are sample projects of how to do it. You can also check a real project using Spring Boot, and Spring Data Solr for auto-complete.

Alexandre Rafalovitch
  • 9,709
  • 1
  • 24
  • 27
  • But this is an existing project. But probably Spring Boot is not mandatory to be used. Is the any other way to solve this problem. – Dibyendu Jan 04 '15 at 05:38
  • Spring Boot was designed to make things simpler, but sure you don't have to use it. Sorry, don't have an answer for your specific setup. – Alexandre Rafalovitch Jan 04 '15 at 17:07