Hi,
I'm trying to write a new XMLRPC handler for Xindice. I made a simple
test
to try it out. Here's the class:
package org.apache.xindice.server.rpc.messages;
import org.apache.xindice.server.rpc.RPCDefaultMessage;
import java.util.Hashtable;
public class SimpleTest extends RPCDefaultMessage {
public Hashtable execute(Hashtable message) throws Exception {
Hashtable result = new Hashtable();
result.put( RESULT, "hello there. I'm simple test." );
return result;
}
}
I added this to war file. I verified it was in the war file by running:
%JAVA_HOME%\bin\jar -tf ..\webapps\xindice-1.1b.war
and sure enough, it eventually output:
WEB-INF/classes/org/apache/xindice/server/rpc/messages/SimpleTest.class
Then I made a short perl script to test it out:
#!/usr/local/bin/perl -w
use strict;
use Frontier::Client;
use Data::Dumper;
my($server,$result,$url);
$url = 'http://localhost:8080/xindice-1.1b';
print "Hello World!\n";
$server = Frontier::Client->new('url'=>$url,'debug'=>0);
$result = listColl($server,'/db');
print "\nresult returned:\n";
print Dumper($result);
#exit;
$result = tester($server);
print Dumper($result);
exit;
sub tester
{
my($server) = @_;
my $args = {};
$args->{'message'} = 'SimpleTest';
return $server->call('run',$args);
}
## list collections
sub listColl
{
my($server,$name) = @_;
my $args = {};
$args->{'message'} = 'ListCollections';
$args->{'collection'} = $name;
return $server->call('run',$args);
}
This calls the ListCollections function perfectly, but the whole output
looks like:
D:\xindice>perl c:\xi.pl
Hello World!
result returned:
$VAR1 = {
'result' => [
'firstmetatest',
'nometatest',
'system',
'meta'
]
};
Fault returned from XML RPC Server, fault code 0: java.lang.Exception:
java.lang
.ClassNotFoundException: org.apache.xindice.server.rpc.messages.SimpleTest
D:\xindice>
How is it that the SimpleTest class isn't found if it's in the war file?
I tried going to Tomcat's Web Application Manager and "Reload"-ing xindice.
And starting and stopping Tomcat.
Is there something that I'm missing?
thanks
dave viner