0

I am using Solr + Spring Data Solr for Solr Indexing.

I am getting following error when I am trying save the solr document.

HTTP Status 500 - Request processing failed; nested exception is org.springframework.data.solr.UncategorizedSolrException: Expected mime type application/octet-stream but got text/html.

Here is my code: Config:

<?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:solr="http://www.springframework.org/schema/data/solr"
    xsi:schemaLocation="http://www.springframework.org/schema/data/solr http://www.springframework.org/schema/data/solr/spring-solr.xsd
    http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd">

    <solr:repositories base-package="my.solr.repo"
        multicore-support="true" />
    <solr:solr-server id="solrServer" url="http://localhost:8983/solr" />


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

</beans>


@Repository
public class SolrMyRepository extends
        SimpleSolrRepository<SolrmyModel, Serializable> {
    @Autowired
    public SolrMyRepository(final SolrTemplate solrTemplate) {
        super(solrTemplate);
    }

}




@SolrDocument(solrCoreName = "my")
public class SolrMyModel {

    @Id
    @Indexed
    private Long id;

    @Indexed
    private String myTitle;

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public String getMyTitle() {
        return myTitle;
    }

    public void setMyTitle(String myTitle) {
        this.myTitle = myTitle;
    }

}




@Service
public class SolrMyService {

    @Autowired
    private SolrMyRepository solrMyRepository;

    public void test() {
        final SolrMyModel model = new SolrMyModel();
        model.setId((long) 1);
        model.setTitle("My title");
        System.out.println(model);
        solrMyRepository.save(model);
    }
}

I am not sure what else I am missing but constantly I am getting this error.

Solution:

I got over the above problem as I have not create a solr core by running following command.

./solr create -c my

As now its working, how can I created core programatically?

behinddwalls
  • 644
  • 14
  • 39

1 Answers1

0

I got over the above problem as I have not create a solr core by running following command.

./solr create -c my

behinddwalls
  • 644
  • 14
  • 39