Getting 'Error loading class 'me.outofti.solrspatiallight.SpatialQueryComponent' on new Rails 2.3.5 Sunspot installation

69 views
Skip to first unread message

Tejus Parikh

unread,
Oct 24, 2010, 10:26:18 AM10/24/10
to Sunspot
Hi all,

I'm trying to integrate Sunspot into a Rails 2.3.5 application that I
maintain. I followed the instructions on the Wiki, copied the
distributions "schema.xml" and "solrconfig.xml" files into
_RAILS_ROOT_/solr/conf and added the searchable section to one of my
models. When I execute "rake sunspot:solr:run" the process starts and
no errors are shown on the console.

However, when I execute "rake sunspot:reindex" I get an error message
on the console and the following stack trace in "sunspot-solr-
development.log":


SEVERE: org.apache.solr.common.SolrException: Error loading class
'me.outofti.solrspatiallight.SpatialQueryComponent'
at
org.apache.solr.core.SolrResourceLoader.findClass(SolrResourceLoader.java:
373)
at org.apache.solr.core.SolrCore.createInstance(SolrCore.java:
413)
at
org.apache.solr.core.SolrCore.createInitInstance(SolrCore.java:435)
at org.apache.solr.core.SolrCore.initPlugins(SolrCore.java:
1498)
at org.apache.solr.core.SolrCore.initPlugins(SolrCore.java:
1492)
at org.apache.solr.core.SolrCore.initPlugins(SolrCore.java:
1525)
at
org.apache.solr.core.SolrCore.loadSearchComponents(SolrCore.java:833)
at org.apache.solr.core.SolrCore.<init>(SolrCore.java:551)
at org.apache.solr.core.CoreContainer
$Initializer.initialize(CoreContainer.java:137)
at
org.apache.solr.servlet.SolrDispatchFilter.init(SolrDispatchFilter.java:
83)
at
org.mortbay.jetty.servlet.FilterHolder.doStart(FilterHolder.java:99)
at
org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:
40)
at
org.mortbay.jetty.servlet.ServletHandler.initialize(ServletHandler.java:
594)
at org.mortbay.jetty.servlet.Context.startContext(Context.java:
139)
at
org.mortbay.jetty.webapp.WebAppContext.startContext(WebAppContext.java:
1218)
at
org.mortbay.jetty.handler.ContextHandler.doStart(ContextHandler.java:
500)
at
org.mortbay.jetty.webapp.WebAppContext.doStart(WebAppContext.java:448)
at
org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:
40)
at
org.mortbay.jetty.handler.HandlerCollection.doStart(HandlerCollection.java:
147)
at
org.mortbay.jetty.handler.ContextHandlerCollection.doStart(ContextHandlerCollection.java:
161)
at
org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:
40)
at
org.mortbay.jetty.handler.HandlerCollection.doStart(HandlerCollection.java:
147)
at
org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:
40)
at
org.mortbay.jetty.handler.HandlerWrapper.doStart(HandlerWrapper.java:
117)
at org.mortbay.jetty.Server.doStart(Server.java:210)
at
org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:
40)
at org.mortbay.xml.XmlConfiguration.main(XmlConfiguration.java:
929)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:
39)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:
25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.mortbay.start.Main.invokeMain(Main.java:183)
at org.mortbay.start.Main.start(Main.java:497)
at org.mortbay.start.Main.main(Main.java:115)
Caused by: java.lang.ClassNotFoundException:
me.outofti.solrspatiallight.SpatialQueryComponent
at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
at
java.net.FactoryURLClassLoader.loadClass(URLClassLoader.java:627)
at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:247)
at
org.apache.solr.core.SolrResourceLoader.findClass(SolrResourceLoader.java:
357)
... 33 more

I see the jar in "/usr/local/Cellar/ruby-enterprise-edition/current/
lib/ruby/gems/1.8/gems/sunspot-1.1.0/solr/solr/lib" which I assume is
the lib directory for the running solr installation.

My rails version is 2.3.5, I'm using sunspot and sunspot-rails 1.1.0
and my ruby is "ruby 1.8.7 (2010-04-19 patchlevel 253) [i686-
darwin10.4.0], MBARI 0x6770, Ruby Enterprise Edition 2010.02".

Thanks in advance for the help!

Tejus

Mat Brown

unread,
Nov 8, 2010, 3:54:40 PM11/8/10
to ruby-s...@googlegroups.com
Hi Tejus,

I'd suggest using sunspot 1.2.rc4 , which no longer has the extra
dependency on SolrSpatialLight

Mat

> --
> You received this message because you are subscribed to the Google Groups "Sunspot" group.
> To post to this group, send email to ruby-s...@googlegroups.com.
> To unsubscribe from this group, send email to ruby-sunspot...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/ruby-sunspot?hl=en.
>
>

sri

unread,
Nov 22, 2010, 4:06:46 PM11/22/10
to Sunspot
Hi there! I am also running into this problem when I installed 1.2
rc4 this afternoon ..

any ideas?

thx so much!

Nov 22, 2010 4:01:54 PM org.apache.solr.common.SolrException log
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown
Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.mortbay.start.Main.invokeMain(Main.java:183)
at org.mortbay.start.Main.start(Main.java:497)
at org.mortbay.start.Main.main(Main.java:115)
Caused by: java.lang.ClassNotFoundException:
me.outofti.solrspatiallight.SpatialQueryComponent
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.net.FactoryURLClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Unknown Source)
at
org.apache.solr.core.SolrResourceLoader.findClass(SolrResourceLoader.java:
357)
... 33 more


Mat Brown

unread,
Nov 22, 2010, 4:24:49 PM11/22/10
to ruby-s...@googlegroups.com
Howdy,

Sounds like you have a legacy solrconfig.xml generated by a previous
version of Sunspot. You'll want to open up the solrconfig and remove
the nodes that refer to the SpatialQueryComponent. You'll find that
file in $RAILS_ROOT/solr/conf/solrconfig.xml

Mat

Guy Argo

unread,
Dec 6, 2010, 7:35:55 PM12/6/10
to Sunspot
I had a similar experience.
There was no previous version of sunspot on my machine so the previous
suggestion doesn't help.

I installed a fresh version sunspot 1.1.0 and sunspot_rails 1.1.0 into
a fresh rails 2.3.8 project.
Despite what the doc:

https://github.com/outoftime/sunspot/wiki/adding-sunspot-search-to-rails-in-5-minutes-or-less

says, no config files were put in $RAILS_ROOT/solr/conf
the first time I started the rake task, rake sunspot:solr:start:

I manually copied over solrconfig.xml and schema.xml
but then I hit the above problem: complaints that
SpatialQueryComponent was missing
When I removed the sections in the config file you suggest,
I get the following error:

org.apache.solr.common.SolrException: Unknown Search Component:
spatial

Damned if you do, damned if you don't...




On Nov 22, 1:24 pm, Mat Brown <m...@patch.com> wrote:
> Howdy,
>
> Sounds like you have a legacy solrconfig.xml generated by a previous
> version of Sunspot. You'll want to open up the solrconfig and remove
> the nodes that refer to the SpatialQueryComponent. You'll find that
> file in $RAILS_ROOT/solr/conf/solrconfig.xml
>
> Mat
>
> ...
>
> read more »

span...@gmail.com

unread,
Oct 7, 2016, 3:42:35 PM10/7/16
to Sunspot, te...@vijedi.net
I resolved this error by uninstalling and reinstalling the gem (which is being used in production). This is on an old application using Ruby 1.8.7 and Rails 2.3.17
  1. cd /mnt/www/k2master/current
  2. RAILS_ENV=production rbenv exec rake sunspot:solr:stop stop all running solr processes
  3. rm -rf /mnt/www/k2master/current/solr remove the solr folder
  4. gem uninstall rsolr uninstall the gem (may be unnecessary)
  5. bundle install install the gem (may be unnecessary)
  6. RAILS_ENV=production rbenv exec rake sunspot:solr:start start solr
  7. RAILS_ENV=production rbenv exec rake sunspot:solr:reindex reindex solr

Reply all
Reply to author
Forward
0 new messages