Re: Initialising of CommonsHttpSolrServer in Spring framwork
Out of the box, the simplest way to configure CommonsHttpSolrServer through a spring application context is to simply define the bean for the server and inject it into whatever class you have that will use it, like Avlesh shared below. class="org.apache.solr.client.solrj.impl.CommonsHttpSolrServer" > http://localhost:8080/solr/core0 You can also set the connection parameters like Avlesh did with the HttpClient in the context, or directly in the init method of your implementation. Inject it with a property: A bit more tricky with the embedded solr server since you need to also register cores etc. We solved that by creating a core configuration loader class. - Aleks On Sat, 09 May 2009 03:08:25 +0200, Avlesh Singh wrote: I am giving you a detailed sample of my spring usage. class="org.apache.commons.httpclient.HttpClient"> http://localhost/solr/core1"/> http://localhost/solr/core2"/> Hope this helps. Cheers Avlesh On Sat, May 9, 2009 at 12:39 AM, sachin78 wrote: Ranjeeth, Did you figured aout how to do this? If yes, can you share with me how you did it? Example bean definition in xml will be helpful. --Sachin Funtick wrote: > > Use constructor and pass URL parameter. Nothing SPRING related... > > Create a Spring bean with attributes 'MySolr', 'MySolrUrl', and 'init' > method... 'init' will create instance of CommonsHttpSolrServer. Configure > Spring... > > > >> I am using Solr 1.3 and Solrj as a Java Client. I am >> Integarating Solrj in Spring framwork, I am facing a problem, >> Spring framework is not inializing CommonsHttpSolrServer >> class, how can I define this class to get the instance of >> SolrServer to invoke furthur method on this. >> > > > -- View this message in context: http://www.nabble.com/Initialising-of-CommonsHttpSolrServer-in-Spring-framwork-tp18808743p23451795.html Sent from the Solr - User mailing list archive at Nabble.com. -- Aleksander M. Stensby Lead software developer and system architect Integrasco A/S www.integrasco.no http://twitter.com/Integrasco Please consider the environment before printing all or any of this e-mail
Re: Initialising of CommonsHttpSolrServer in Spring framwork
I am giving you a detailed sample of my spring usage. http://localhost/solr/core1"/> http://localhost/solr/core2"/> Hope this helps. Cheers Avlesh On Sat, May 9, 2009 at 12:39 AM, sachin78 wrote: > > Ranjeeth, > >Did you figured aout how to do this? If yes, can you share with me how > you did it? Example bean definition in xml will be helpful. > > --Sachin > > > Funtick wrote: > > > > Use constructor and pass URL parameter. Nothing SPRING related... > > > > Create a Spring bean with attributes 'MySolr', 'MySolrUrl', and 'init' > > method... 'init' will create instance of CommonsHttpSolrServer. Configure > > Spring... > > > > > > > >> I am using Solr 1.3 and Solrj as a Java Client. I am > >> Integarating Solrj in Spring framwork, I am facing a problem, > >> Spring framework is not inializing CommonsHttpSolrServer > >> class, how can I define this class to get the instance of > >> SolrServer to invoke furthur method on this. > >> > > > > > > > > -- > View this message in context: > http://www.nabble.com/Initialising-of-CommonsHttpSolrServer-in-Spring-framwork-tp18808743p23451795.html > Sent from the Solr - User mailing list archive at Nabble.com. > >
RE: Initialising of CommonsHttpSolrServer in Spring framwork
Ranjeeth, Di you figured aout how to do this.If yes, can you share with me how you did it? Example bean definition in xml will be helpful. --Sachin Funtick wrote: > > Use constructor and pass URL parameter. Nothing SPRING related... > > Create a Spring bean with attributes 'MySolr', 'MySolrUrl', and 'init' > method... 'init' will create instance of CommonsHttpSolrServer. Configure > Spring... > > > >> I am using Solr 1.3 and Solrj as a Java Client. I am >> Integarating Solrj in Spring framwork, I am facing a problem, >> Spring framework is not inializing CommonsHttpSolrServer >> class, how can I define this class to get the instance of >> SolrServer to invoke furthur method on this. >> > > > -- View this message in context: http://www.nabble.com/Initialising-of-CommonsHttpSolrServer-in-Spring-framwork-tp18808743p23451795.html Sent from the Solr - User mailing list archive at Nabble.com.
Re: Initialising of CommonsHttpSolrServer in Spring framwork
Hi, I have downloaded "solr-2008-07-30" version of solr nightly, are you talking different version of HttpClient. Thanks & Regards, Ranjeet - Original Message - From: "Erik Hatcher" <[EMAIL PROTECTED]> To: Sent: Monday, August 04, 2008 10:05 PM Subject: Re: Initialising of CommonsHttpSolrServer in Spring framwork Looks to me like you have a conflict with the version of HttpClient in that exception, likely not using the same version that SolrJ requires. Erik On Aug 4, 2008, at 12:07 PM, Ranjeet wrote: Hi Tomislav, I have user the same way that you suggest, but I am worndering that its not working , exception is attached in this mail. pls suggest me what to do further. Thanks & Regards, Ranjeet - Original Message - From: "Tomislav Poljak" <[EMAIL PROTECTED] > To: Sent: Monday, August 04, 2008 4:31 PM Subject: Re: Initialising of CommonsHttpSolrServer in Spring framwork Hi Ranjeet, try this in your Spring config: http://solr_url:8080/ and inject it to you service like this: and you have to have a setter in SomeService for the prop. server (solrServer), off course. Hope this helps, Tomislav 2008/8/4 Ranjeet <[EMAIL PROTECTED]> Hi, I am using Solr 1.3 and Solrj as a Java Client. I am Integarating Solrj in Spring framwork, I am facing a problem, Spring framework is not inializing CommonsHttpSolrServer class, how can I define this class to get the instance of SolrServer to invoke furthur method on this. Thanks & Regards, Ranjeet Jha
Re: Initialising of CommonsHttpSolrServer in Spring framwork
Looks to me like you have a conflict with the version of HttpClient in that exception, likely not using the same version that SolrJ requires. Erik On Aug 4, 2008, at 12:07 PM, Ranjeet wrote: Hi Tomislav, I have user the same way that you suggest, but I am worndering that its not working , exception is attached in this mail. pls suggest me what to do further. Thanks & Regards, Ranjeet - Original Message - From: "Tomislav Poljak" <[EMAIL PROTECTED] > To: Sent: Monday, August 04, 2008 4:31 PM Subject: Re: Initialising of CommonsHttpSolrServer in Spring framwork Hi Ranjeet, try this in your Spring config: http://solr_url:8080/arg> and inject it to you service like this: and you have to have a setter in SomeService for the prop. server (solrServer), off course. Hope this helps, Tomislav 2008/8/4 Ranjeet <[EMAIL PROTECTED]> Hi, I am using Solr 1.3 and Solrj as a Java Client. I am Integarating Solrj in Spring framwork, I am facing a problem, Spring framework is not inializing CommonsHttpSolrServer class, how can I define this class to get the instance of SolrServer to invoke furthur method on this. Thanks & Regards, Ranjeet Jha
Re: Initialising of CommonsHttpSolrServer in Spring framwork
Hi Tomislav, I have user the same way that you suggest, but I am worndering that its not working , exception is attached in this mail. pls suggest me what to do further. Thanks & Regards, Ranjeet - Original Message - From: "Tomislav Poljak" <[EMAIL PROTECTED]> To: Sent: Monday, August 04, 2008 4:31 PM Subject: Re: Initialising of CommonsHttpSolrServer in Spring framwork Hi Ranjeet, try this in your Spring config: http://solr_url:8080/ and inject it to you service like this: and you have to have a setter in SomeService for the prop. server (solrServer), off course. Hope this helps, Tomislav 2008/8/4 Ranjeet <[EMAIL PROTECTED]> Hi, I am using Solr 1.3 and Solrj as a Java Client. I am Integarating Solrj in Spring framwork, I am facing a problem, Spring framework is not inializing CommonsHttpSolrServer class, how can I define this class to get the instance of SolrServer to invoke furthur method on this. Thanks & Regards, Ranjeet Jha 2008-08-04 21:32:25,125 ERROR org.springframework.web.context.ContextLoader - Context initialization failed org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.scheduling.quartz.SchedulerFactoryBean' defined in ServletContext resource [/WEB-INF/shared-tasks.xml]: Cannot resolve reference to bean 'solrDocumentCommitCronTrigger' while setting bean property 'triggers' with key [1]; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'solrDocumentCommitCronTrigger' defined in ServletContext resource [/WEB-INF/shared-tasks.xml]: Cannot resolve reference to bean 'commitIndexDocumentJob' while setting bean property 'jobDetail'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'commitIndexDocumentJob' defined in ServletContext resource [/WEB-INF/shared-tasks.xml]: Cannot resolve reference to bean 'solrDocumentSchedulerTarget' while setting bean property 'targetObject'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'solrDocumentSchedulerTarget' defined in ServletContext resource [/WEB-INF/shared-tasks.xml]: Cannot resolve reference to bean 'solrServer' while setting bean property 'solrServer'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'solrServer' defined in ServletContext resource [/WEB-INF/shared-tasks.xml]: Instantiation of bean failed; nested exception is org.springframework.beans.FatalBeanException: Could not instantiate class [com.xonos.ecommerce.search.solr.util.SolrServerTest]; constructor threw exception; nested exception is java.lang.NoSuchMethodError: org.apache.commons.httpclient.HttpConnectionManager.getParams()Lorg/apache/commons/httpclient/params/HttpConnectionManagerParams; org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'solrDocumentCommitCronTrigger' defined in ServletContext resource [/WEB-INF/shared-tasks.xml]: Cannot resolve reference to bean 'commitIndexDocumentJob' while setting bean property 'jobDetail'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'commitIndexDocumentJob' defined in ServletContext resource [/WEB-INF/shared-tasks.xml]: Cannot resolve reference to bean 'solrDocumentSchedulerTarget' while setting bean property 'targetObject'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'solrDocumentSchedulerTarget' defined in ServletContext resource [/WEB-INF/shared-tasks.xml]: Cannot resolve reference to bean 'solrServer' while setting bean property 'solrServer'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'solrServer' defined in ServletContext resource [/WEB-INF/shared-tasks.xml]: Instantiation of bean failed; nested exception is org.springframework.beans.FatalBeanException: Could not instantiate class [com.xonos.ecommerce.search.solr.util.SolrServerTest]; constructor threw exception; nested exception is java.lang.NoSuchMethodError: org.apache.commons.httpclient.HttpConnectionManager.getParams()Lorg/apache/commons/httpclient/params/HttpConnectionManagerParams; org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'commitIndexDocumentJob' defined in ServletContext resource [/WEB-INF/shared-tasks.xml]: Cannot resolve reference to bean 'solrDocumentSchedulerTarget' while setting bean property 'targetObject'; nested exception i
RE: Initialising of CommonsHttpSolrServer in Spring framwork
Use constructor and pass URL parameter. Nothing SPRING related... Create a Spring bean with attributes 'MySolr', 'MySolrUrl', and 'init' method... 'init' will create instance of CommonsHttpSolrServer. Configure Spring... > I am using Solr 1.3 and Solrj as a Java Client. I am > Integarating Solrj in Spring framwork, I am facing a problem, > Spring framework is not inializing CommonsHttpSolrServer > class, how can I define this class to get the instance of > SolrServer to invoke furthur method on this. >
Re: Initialising of CommonsHttpSolrServer in Spring framwork
Hi Ranjeet, try this in your Spring config: http://solr_url:8080/ and inject it to you service like this: and you have to have a setter in SomeService for the prop. server (solrServer), off course. Hope this helps, Tomislav 2008/8/4 Ranjeet <[EMAIL PROTECTED]> > Hi, > > I am using Solr 1.3 and Solrj as a Java Client. I am Integarating Solrj in > Spring framwork, I am facing a problem, Spring framework is not inializing > CommonsHttpSolrServer class, how can I define this class to get the > instance of SolrServer to invoke furthur method on this. > > Thanks & Regards, > Ranjeet Jha