ClassCastException from custom request handler

2009-08-03 Thread James Brady
Hi, I'm creating a custom request handler to return a list of live cores in Solr. On startup, I get this exception for each core: Jul 31, 2009 5:20:39 PM org.apache.solr.common. SolrException log SEVERE: java.lang.ClassCastException: LiveCoresHandler at org.apache.solr.core.RequestHandler

Re: ClassCastException from custom request handler

2009-08-03 Thread Avlesh Singh
Can you cross check the class attribute for your handler in solrconfig.xml? My guess is that it is specified as "solr.LiveCoresHandler". It should be fully qualified class name - com.foo.path.to.LiveCoresHandler instead. Moreover, I am damn sure that you did not forget to drop your jar into solr.h

Re: ClassCastException from custom request handler

2009-08-03 Thread James Brady
Hi, Thanks for your suggestions! I'm sure I have the class name right - changing it to something patently incorrect results in the expected "org.apache.solr.common.SolrException: Error loading class ...", rather than the ClassCastException. I did have some problems getting my class on the app ser

Re: ClassCastException from custom request handler

2009-08-03 Thread Avlesh Singh
> > I'm sure I have the class name right - changing it to something patently > incorrect results in the expected "org.apache.solr.common.SolrException: > Error loading class ...", rather thanthe ClassCastException. > You are right about that, James. Which Solr version are you using? Can you please

Re: ClassCastException from custom request handler

2009-08-03 Thread Noble Paul നോബിള്‍ नोब्ळ्
I guess a requesthandler may not be the right component to implement. try implementing a CoreAdminHandler . http://wiki.apache.org/solr/CoreAdmin#head-dfab3233db613c1976e05cdf894aa326ca64d312 On Mon, Aug 3, 2009 at 9:11 PM, James Brady wrote: > Hi, > I'm creating a custom request handler to retur

Re: ClassCastException from custom request handler

2009-08-04 Thread James Brady
Solr version: 1.3.0 694707 solrconfig.xml: public class LiveCoresHandler extends RequestHandlerBase { public void init(NamedList args) { } public String getDescription() { return ""; } public String getSource() { return ""; } public String getSourceId() { return ""; } pub

Re: ClassCastException from custom request handler

2009-08-04 Thread Noble Paul നോബിള്‍ नोब्ळ्
what is the package of LiveCoresHandler ? I guess the requestHandler name should be name="/livecores" On Tue, Aug 4, 2009 at 5:04 PM, James Brady wrote: > Solr version: 1.3.0 694707 > > solrconfig.xml: >     > > public class LiveCoresHandler extends RequestHandlerBase { >    public void init(Named

Re: ClassCastException from custom request handler

2009-08-04 Thread James Brady
Hi, the LiveCoresHandler is in the default package - the behaviour's the same if I have it in a properly namespaced package too... The requestHandler name can start either be a path (starting with '/') or a qt name: http://wiki.apache.org/solr/SolrRequestHandler 2009/8/4 Noble Paul നോബിള്‍ नोब्ळ्

Re: ClassCastException from custom request handler

2009-08-04 Thread James Brady
There is *something* strange going on with classloaders; when I put my .class files in the right place in WEB-INF/lib in a repackaged solr.war file, it's not found by the plugin loader ("Error loading class"). So the plugin classloader isn't seeing stuff inside WEB-INF/lib. That explains why the

Re: ClassCastException from custom request handler

2009-08-04 Thread Chantal Ackermann
Hi James! James Brady schrieb: There is *something* strange going on with classloaders; when I put my .class files in the right place in WEB-INF/lib in a repackaged solr.war file, it's not found by the plugin loader ("Error loading class"). So the plugin classloader isn't seeing stuff inside WE

Re: ClassCastException from custom request handler

2009-08-04 Thread James Brady
Hi Chantal! I've included a stack trace below. I've attached a debugger to the server starting up, and it is finding my class file as expected... I agree it looks like something wrong with how I've deployed the compiled code, but perhaps different Solr versions at compile time and run time? Howeve

Re: ClassCastException from custom request handler

2009-08-04 Thread Chantal Ackermann
Hi there, could it be that something with the Generics code in the plugin loader classes works not as expected? Citing for example http://stackoverflow.com/questions/372250/java-generics-arrays-and-the-classcastexception this is because """ Generics only provide type-safety at compile-time. """

Re: ClassCastException from custom request handler

2009-08-04 Thread Chantal Ackermann
Code is from AbstractPluginLoader in the solr plugin package, 1.3 (the regular stable release, no svn checkout). 80-84 @SuppressWarnings("unchecked") protected T create( ResourceLoader loader, String name, String className, Node node ) throws Exception { return (T) loader.newInstance( classN

Re: ClassCastException from custom request handler

2009-08-04 Thread James Brady
Yeah I was thinking T would be SolrRequestHandler too. Eclipse's debugger can't tell me... Lot's of other handlers are created with no problem before my plugin falls over, so I don't think it's a problem with T not being what we expected. Do you know of any working examples of plugins I can downl

Re: ClassCastException from custom request handler

2009-08-04 Thread Chantal Ackermann
James Brady schrieb: Yeah I was thinking T would be SolrRequestHandler too. Eclipse's debugger can't tell me... You could try disassembling. Or Eclipse opens classes in a very rudimentary format when there is no source code attached. Maybe it shows the actual return value there, instead of

Re: ClassCastException from custom request handler

2009-08-05 Thread James Brady
OK, problem solved! Well, worked around. I gave up on the new style plugin loading in a multicore Jetty setup, and packaged up my plugin in a rebuilt solr.war. I had tried this before, but only putting the class files in WEB-INF/lib. If I put a jar file in there, it works. 2009/8/4 Chantal Acker