0

To enable full text search, I ever used hibernate-search and solrJ, No I am trying spring-data-solr, but found I seems not working together with spring-data-jpa. I just can't make the configuration correct. If I add the following solr configuration xml to my project.I get error message. The config xml file of spring-data-solr is:

    <?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:p="http://www.springframework.org/schema/p" xmlns:context="http://www.springframework.org/schema/context"
  xmlns:solr="http://www.springframework.org/schema/data/solr" xmlns:util="http://www.springframework.org/schema/util" xmlns:cache="http://www.springframework.org/schema/cache" xmlns:security="http://www.springframework.org/schema/security"
  xsi:schemaLocation="http://www.springframework.org/schema/data/solr http://www.springframework.org/schema/data/solr/spring-solr-1.0.xsd
        http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
        http://www.springframework.org/schema/cache http://www.springframework.org/schema/cache/spring-cache.xsd
        http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd
        http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util.xsd
        http://www.springframework.org/schema/security http://www.springframework.org/schema/security/spring-security.xsd">

 <!-- 
  #####################################
  CONTEXT SETTINGS
  #####################################
   -->
  <context:property-placeholder location="classpath:laa.properties" ignore-resource-not-found="true" />

 <!-- 
  #####################################
  SOLR
  #####################################
 -->
  <solr:solr-server id="solrServer" url="${solr.host}" />

  <bean id="solrTemplate" class="org.springframework.data.solr.core.SolrTemplate" scope="singleton">
    <constructor-arg ref="solrServer" />
  </bean>

</beans>

The error message is:

org.xml.sax.SAXParseException; systemId: http://www.springframework.org/schema/data/jpa/spring-jpa.xsd; lineNumber: 18; columnNumber: 48; src-resolve: Cannot resolve the name 'repository:repository' to a(n) 'type definition' component.
    at org.apache.xerces.util.ErrorHandlerWrapper.createSAXParseException(Unknown Source)
    at org.apache.xerces.util.ErrorHandlerWrapper.error(Unknown Source)
    at org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown Source)
    at org.apache.xerces.impl.xs.traversers.XSDHandler.reportSchemaError(Unknown Source)
    at org.apache.xerces.impl.xs.traversers.XSDHandler.getGlobalDecl(Unknown Source)
    at org.apache.xerces.impl.xs.traversers.XSDComplexTypeTraverser.traverseComplexContent(Unknown Source)
    at org.apache.xerces.impl.xs.traversers.XSDComplexTypeTraverser.traverseComplexTypeDecl(Unknown Source)
    at org.apache.xerces.impl.xs.traversers.XSDComplexTypeTraverser.traverseGlobal(Unknown Source)
    at org.apache.xerces.impl.xs.traversers.XSDHandler.traverseSchemas(Unknown Source)
    at org.apache.xerces.impl.xs.traversers.XSDHandler.parseSchema(Unknown Source)
    at org.apache.xerces.impl.xs.XMLSchemaLoader.loadSchema(Unknown Source)
    at org.apache.xerces.impl.xs.XMLSchemaValidator.findSchemaGrammar(Unknown Source)
    at org.apache.xerces.impl.xs.XMLSchemaValidator.handleStartElement(Unknown Source)
    at org.apache.xerces.impl.xs.XMLSchemaValidator.emptyElement(Unknown Source)
    at org.apache.xerces.impl.XMLNSDocumentScannerImpl.scanStartElement(Unknown Source)
    at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown Source)
    at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)
    at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
    at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
Joachim Sauer
  • 302,674
  • 57
  • 556
  • 614
Tom
  • 2,857
  • 9
  • 46
  • 59
  • Have a look at this other question. http://stackoverflow.com/questions/12550685/cannot-resolve-the-name-repositoryrepository-to-an-type-definition-compon – javanna Nov 06 '12 at 14:42

1 Answers1

2

You're missing Spring Data Commons on the classpath.

Oliver Drotbohm
  • 80,157
  • 18
  • 225
  • 211
  • I have added spring-data-commons-core to my pom.xml file.Before I do this the maven build got classnotfound excption. – Tom Nov 08 '12 at 01:40
  • 1
    Which versions did you refer to? Spring Data JPA 1.2.0.RELEASE and Spring Data Solr 1.0.0.M1 both refer to Spring Data Commons 1.4.0.RELEASE and should pull the dependency without the need to explicitly declare it. – Oliver Drotbohm Nov 13 '12 at 13:55
  • After I changed the version of Spring Data JPA from 1.1.0.RELEASE to 1.2.0.RELEASE. It seems the issue resolved. Yet there is another exception. – Tom Nov 16 '12 at 01:26