Uploaded image for project: 'Spring Data for Apache Solr'
  1. Spring Data for Apache Solr
  2. DATASOLR-151

solr and spring application integrate problem

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Major
    • Resolution: Duplicate
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: None
    • Labels:
      None
    • Environment:
      eclipse

      Description

      Data are imported to solr from sql using data import handler.But when tries to retrive the data from solr to spring it is showing null pointer exception. the queries used is
      problem facing :connecting dispatcher severlet and the web application running sample project created by spring mvc application and search values by using solr template and above code facing problem
      query used to get values localhost//8983//solr
      dispatcher:
      ?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:mvc="http://www.springframework.org/schema/mvc"
      xmlns:context="http://www.springframework.org/schema/context"
      xmlns:repository="http://www.springframework.org/schema/data/repository"
      xmlns:solr="http://www.springframework.org/schema/data/solr"
      xsi:schemaLocation="http://www.springframework.org/schema/mvc
      http://www.springframework.org/schema/mvc/spring-mvc-3.0.xsd
      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/data/solr
      http://www.springframework.org/schema/data/solr/spring-solr-1.0.xsd">

      <!-- Enable Solr repositories and configure repository base package -->

      <!-- <solr:repositories base-package="com.org.ntpl" multicoreSupport="true" />
      <solr:solr-server id="solrServer" url="http://localhost:8983/solr" /> -->

      <!-- declare mvc to be annotation driven -->
      <mvc:annotation-driven />
      <!-- <bean class="org.springframework.data.solr.core.SolrTemplate"></bean> -->
      <context:annotation-config />
      <!-- provide Your Base package to scan annotations for components -->
      <context:component-scan base-package="com.org.ntpl" />

      <bean id="templateResolver"
      class="org.thymeleaf.templateresolver.ServletContextTemplateResolver">
      <property name="prefix" value="/" />
      <property name="suffix" value=".html" />
      <property name="templateMode" value="HTML5" />
      </bean>

      <bean id="templateEngine"
      class="org.thymeleaf.spring3.SpringTemplateEngine">
      <property name="templateResolver" ref="templateResolver" />
      <property name="dialects">
      <set>
      <bean class="org.thymeleaf.spring3.dialect.SpringStandardDialect" />
      <bean class="net.sourceforge.pagesdialect.PagesDialect" />
      </set>
      </property>
      </bean>

      <bean id="multipartResolver"
      class="org.springframework.web.multipart.commons.CommonsMultipartResolver" />

      <bean class="org.thymeleaf.spring3.view.ThymeleafViewResolver">
      <property name="templateEngine" ref="templateEngine" />
      </bean>

      <!-- DataSource configuration of database -->
      <bean id="myDataSource" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close">
      <property name="driverClassName" value="com.mysql.jdbc.Driver" />
      <property name="url" value="jdbc:mysql://192.168.3.69:3306/springdb" />
      <property name="username" value="root" />
      <property name="password" value="admin" />
      </bean>

      <bean id="mySessionFactory" class="org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean">
      <property name="dataSource" ref="myDataSource"/>
      <property name="annotatedClasses">
      <list>
      <value>com.org.ntpl.bean.UserBean</value>
      <value>com.org.ntpl.bean.UserCases</value>
      <value>com.org.ntpl.bean.SignupBean</value>
      </list>
      </property>
      <property name="hibernateProperties">
      <props>
      <prop key="hibernate.dialect">
      org.hibernate.dialect.HSQLDialect
      </prop>
      <prop key="hibernate.show_sql">
      true
      </prop>
      <prop key="hibernate.hbm2ddl.auto">
      create
      </prop>
      </props>
      </property>
      </bean>
      <!-- <context:property-placeholder location="classpath:application.properties"/>

      -->

      <!-- Enable Solr repositories and configure repository base package -->
      <solr:repositories base-package="com.org.ntpl"/>

      <!-- Bean definitions for the dev profile are omitted -->

      <solr:solr-server id="solrServer" url="http://locahost:8983/solr" />

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

      </beans>

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              cstrobl Christoph Strobl
              Reporter:
              vivek142 gokul
              Last updater:
              Christoph Strobl
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: