xml-xindice-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jonathan Melhuish <j.melhu...@signal.qinetiq.com>
Subject Re: Null Pointer Exception
Date Tue, 27 Apr 2004 17:04:57 GMT
I'm really sorry to have to post yet again, but I'm really struggling to 
understand what I'm doing wrong!

Vadim Gritsenko wrote:

>> public void connect() throws RepositoryException {
>>    try {
>>        Class driver = 
>> Class.forName("org.apache.xindice.client.xmldb.embed.DatabaseImpl");
>
>
>
> You are using embedded driver. This means, *database will be running 
> within the JVM of this java program*.

Okay.  I have xindice installed as a webapp under Tomcat.  From the 
logs, it looks like Xindice is loading successfully with Tomcat.  Does 
this mean that Xindice is "running in the same JVM"?  So the embedded 
driver should work?

>>        // initialize a new database, then register it globally
>>        Database db = (Database) driver.newInstance();
>>              
>> db.setProperty("db-home","/home/jon/tomcat/webapps/xindice/WEB-INF");
>
>
>
> Database, running within this JVM, will mount database files from the 
> specified location.
> IMPORTANT: You HAVE TO guarantee that no other process (no other JVM) 
> accesses this database.

Am I right in thinking that the db-home that I have set is actually the 
default anyway?  It's also not massively clear from the documentation I 
have read what this path is relative to (if it were not absolute).

>
>>        db.setProperty("managed","true");
>
>
>
> This means that driver will NOT start database automatically. You have 
> to manually start the database, and manually manage database instance.

I'm not sure I actually want managed mode in that case, so I set it to 
false.  Presumably I can still use DatabaseManager if my database is not 
managed?  (you can see why I get confused!)

Also, could you just confirm that this property name is correct?  It is 
copied from the UpgradeTo11EmbedNotes 
<http://wiki.apache.org/xindice/UpgradeTo11EmbedNotes?action=fullsearch&value=UpgradeTo11EmbedNotes&literal=1&case=1&context=40>

Wiki page, but you refer to "PROP_XINDICE_MANAGED" in another post.  
I've been reading lots of the Javadocs today, but can't find a reference 
to the property names.

>>             DatabaseManager.registerDatabase(db);
>>        col = 
>> DatabaseManager.getCollection("xmldb:xindice-embed:///db/sne/");
>
>
>
> Because you asked for managed mode, and you have not started the 
> database, this method will return null.

Even with managed set to false, DatabaseManager.getCollection still 
returns null.

I gather that this could mean that the Collection is not being found, 
however am I right to assume that this isn't the case, seeing as the 
UglyBrowser functions correctly?

Thanks very much for your help, I'll buy you a pint someday ;-)

Cheers,

Jon

Mime
View raw message