My very own thread... sorry for harrasing the list with my postings about this, 
but
now that I solved it, I thought it is best to tell people in case anybody in the
future would  have the same problem.

Not surprisingly, it's a classpath problem, even though it doesn't look like it.
In the end, I mangaged to run the Example1.java (renamed Xin in my code below) 
by
having

xindice-1.1b4.jar
xmldb-api-20030701.jar
commons-logging-api.jar
xmlrpc-1.1.jar
xercesImpl.jar
xmlParserAPIs.jar

in the classpath.

> Forgot to mention what OS: this error was on Linux (see below). When I run it 
> on
> Windows 2000 or XP Pro, i get
>
> XML:DB Exception occured 1 A connection to the Database instance 'db' could 
> not
> be created. Error: http://localhost:8080/db_bootstrap.ior
>
> My source code is:
>
> package nina;
>
> import org.xmldb.api.base.*;
> import org.xmldb.api.modules.*;
> import org.xmldb.api.*;
>
> public class Xin
> {
>
>       public static void main(String[] args) throws Exception
>       {
>         Collection col = null;
>         try
>         {
>               String driver = "org.apache.xindice.client.xmldb.DatabaseImpl";
>               Class c = Class.forName(driver);
>
>               Database database = (Database) c.newInstance();
>               DatabaseManager.registerDatabase(database);
>
>               String uri = "xmldb:xindice://localhost:8080/db/restaurants";
>               col = DatabaseManager.getCollection(uri);
>
>               String xpath = "/restaurant[name='TheBratwurst']";
>               XPathQueryService service =
>                 (XPathQueryService) col.getService("XPathQueryService", 
> "1.0");
>               ResourceSet resultSet = service.query(xpath);
>               ResourceIterator results = resultSet.getIterator();
>               while (results.hasMoreResources())
>               {
>                 Resource res = results.nextResource();
>                 System.out.println((String) res.getContent());
>               }
>         }
>         catch (XMLDBException e)
>         {
>               System.err.println("XML:DB Exception occured " + e.errorCode + 
> " " +
> e.getMessage());
>         } finally
>         {
>               if (col != null)
>               {
>                 col.close();
>               }
>         }
>     }
> }
>
>
> Could anyone tell me what this mysterious db_bootstrap.ior is? I've seen a 
> couple of
> people asking questions on this (on the cocoon-users group), but nobody ever 
> got an
> answer. A google search for bootstrap.ior gives me next to nothing. Howcome 
> *nobody*
> has had this problem, and what is causing it??? And what am I doing wrong?
>
> Thanks from desperate,
> Nina
>
>
>
>> Hi everyone,
>>
>> I've been trying connect to Xindice through Cocoon for a few days now without
>> success. I'm running Xindice 1.1b4 as a standalone under Tomcat 5.0. I've 
>> got it
>> up
>> and running fine, I can access it through
>> xmldb:xindice://localhost:8080/db/testcol
>> and add documents and query it and all that.
>>
>> As I gave up on trying to get Cocoon to connect to it, I used the source 
>> code from
>>
>> http://xml.apache.org/xindice/guide-developer.html#Diving+in+With+an+Example+Program
>>
>> and changed the details to reflect my database. But when I run it, I get the
>> error:
>>
>> XML:DB Exception occured 1 A connection to the Database instance 'db' could 
>> not be
>> created. Error: Connection refused
>>
>> My uri string is declared as:
>>
>> String uri = "xmldb:xindice://localhost:8080/db/testcol";
>>
>> and that's the only thing I have changed from the original code.
>>
>> Has anyone come across this problem before, by any chance? Any idea what to 
>> do?
>>
>> Cheers,
>> Nina
>>
>>
>


Cheers,
Nina


Reply via email to