You are viewing a plain text version of this content. The canonical link for it is here.
Posted to xindice-users@xml.apache.org by Richard Featherstone <ri...@btinternet.com> on 2002/02/05 17:46:06 UTC

exception error code

Hi

Hope someone can help

In a Java program I try and call

    col = DatabaseManager.getCollection("xmldb:dbxml:///db/myexamples");

and I get

    XML:DB EXCEPTION: occured 1

can anyone tell me what error code 1 is so I can try to trace the problem

Cheers 

Richard

Re: exception error code

Posted by Richard Featherstone <ri...@btinternet.com>.
tried that now I get a 400 error code

Richard
  ----- Original Message ----- 
  From: Bahman Kalali 
  To: xindice-users@xml.apache.org 
  Sent: Tuesday, February 05, 2002 4:46 PM
  Subject: Re: exception error code


  I am not sure, but I had the same kind of problem when I was trying to run APIExample on Xindice.

  I just changed dbxml to xindice. It worked for me.

  --Bahman  
    ----- Original Message ----- 
    From: Richard Featherstone 
    To: xindice-users@xml.apache.org 
    Sent: Tuesday, February 05, 2002 11:46 AM
    Subject: exception error code


    Hi

    Hope someone can help

    In a Java program I try and call

        col = DatabaseManager.getCollection("xmldb:dbxml:///db/myexamples");

    and I get

        XML:DB EXCEPTION: occured 1

    can anyone tell me what error code 1 is so I can try to trace the problem

    Cheers 

    Richard

Re: exception error code

Posted by Bahman Kalali <bk...@math.uwaterloo.ca>.
I am not sure, but I had the same kind of problem when I was trying to run APIExample on Xindice.

I just changed dbxml to xindice. It worked for me.

--Bahman  
  ----- Original Message ----- 
  From: Richard Featherstone 
  To: xindice-users@xml.apache.org 
  Sent: Tuesday, February 05, 2002 11:46 AM
  Subject: exception error code


  Hi

  Hope someone can help

  In a Java program I try and call

      col = DatabaseManager.getCollection("xmldb:dbxml:///db/myexamples");

  and I get

      XML:DB EXCEPTION: occured 1

  can anyone tell me what error code 1 is so I can try to trace the problem

  Cheers 

  Richard

Re: exception error code

Posted by "Mark J. Stang" <ma...@earthlink.net>.
I think your URL is incorrect for the getCollection().      Which
version of dbXML/Xindice are you using?

In my use of this call, I have "xmldb:xmldb:...
            col =
DatabaseManager.getCollection("xmldb:xindice:///db/myexamples");

Yours don't match.   That is the difference that I see.   I am using
dbXML 1.04b (Mustard).

Mark

Richard Featherstone wrote:

>  I've created the collection and added a few documents.  I've queried
> the collection from the command line and get the right results.  I'm
> no trying to do the same thing from a Java program to get to grips
> with the XML:DB Api.  The code I'm using is below.  Any ideas where
> I'm going wrong will be gratefully received. Cheers Richard import
> org.xmldb.api.base.*;
> import org.xmldb.api.modules.*;
> import org.xmldb.api.*; public class ConnectToDbxml {     /**  */
>     public static void main(String args[]) throws Exception {
>
>         Collection col = null;
>
>         try{
>             String driver = "org.dbxml.client.xmldb.DatabaseImpl";
>             Class c = Class.forName(driver);
>
>             Database database = (Database)c.newInstance();
>             DatabaseManager.registerDatabase(database);
>
>             col =
> DatabaseManager.getCollection("xmldb:xindice:///db/myexamples");
>
>             String xpath = "/person";
>             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);
>         }
>         finally {
>             if (col != null) {
>                 col.close();
>             }
>         }
>     }
> }
>
>      ----- Original Message -----
>      From: Mark J. Stang
>      To: xindice-users@xml.apache.org
>      Sent: Tuesday, February 05, 2002 5:39 PM
>      Subject: Re: exception error code
>       It means something didn't work :-).   I don't mean that in
>      a bad way,
>      I think you get that error for many different types of
>      problems.
>
>      Have you created the collection "myexamples"?
>
>      Try
>
>      dbxmladmin lc -c /db
>
>      It should list your collections.
>
>      Try "getting" one of the ones that are in the list.
>
>      HTH,
>
>      Mark
>
>      Richard Featherstone wrote:
>
>     > Hi Hope someone can help In a Java program I try and
>     > call     col =
>     > DatabaseManager.getCollection("xmldb:dbxml:///db/myexamples");
>     > and I get     XML:DB EXCEPTION: occured 1 can anyone tell
>     > me what error code 1 is so I can try to trace the problem
>     > Cheers Richard
>

Re: exception error code

Posted by "Mark J. Stang" <ma...@earthlink.net>.
Here is a quick cheat sheet to the errors:

 interface ErrorCodes {
      // Error Codes are broken into categories

      // General API Errors
      const long UNKNOWN_ERROR = 0;
      const long VENDOR_ERROR = 1;
      const long NOT_IMPLEMENTED = 2;
      const long WRONG_CONTENT_TYPE = 3;
      const long PERMISSION_DENIED = 4;
      const long INVALID_URI = 5;

      // Service errors
      const long NO_SUCH_SERVICE = 100;

      // Collection errors
      const long NO_SUCH_COLLECTION = 200;
      const long INVALID_COLLECTION = 201;
      const long COLLECTION_CLOSED = 202;

      // Resource errors
      const long NO_SUCH_RESOURCE = 300;
      const long INVALID_RESOURCE = 301;
      const long UNKNOWN_RESOURCE_TYPE = 302;

      // Database errors
      const long NO_SUCH_DATABASE = 400;
      const long INVALID_DATABASE = 401;
   };

Richard,
I think yours' is a VENDOR_ERROR ;-).

Mark

Kimbro Staken wrote:

> You're using the dbxml database impl with the Xindice URI.  If you're
> using dbXML then you shouldn't have any mention of xindice, and if you're
> using xindice you shouldn't have any mention of dbXML
>
> BTW, you can find out the error codes here
> http://www.xmldb.org/xapi/idl/base.idl. Also if you print out e.message it
> should give you more information. The error you're seeing is because it
> can't locate the database impl.
>
> Yeah, I know it's confusing right now. We'll get an actual xindice release
> out real soon now and then dbXML can take its place in history.  The main
> holdup is that we need to get the website setup on the Apache side before
> we do the release.
>
> On Tuesday, February 5, 2002, at 10:46 AM, Richard Featherstone wrote:
>
> > I've created the collection and added a few documents.  I've queried the
> > collection from the command line and get the right results.  I'm no
> > trying to do the same thing from a Java program to get to grips with the
> > XML:DB Api.  The code I'm using is below.  Any ideas where I'm going
> > wrong will be gratefully received.
> >
> > Cheers
> >
> > Richard
> >
> > import org.xmldb.api.base.*;
> > import org.xmldb.api.modules.*;
> > import org.xmldb.api.*;
> >
> > public class ConnectToDbxml {
> >
> >     /**  */
> >     public static void main(String args[]) throws Exception {
> >
> >         Collection col = null;
> >
> >         try{
> >             String driver = "org.dbxml.client.xmldb.DatabaseImpl";
> >             Class c = Class.forName(driver);
> >
> >             Database database = (Database)c.newInstance();
> >             DatabaseManager.registerDatabase(database);
> >
> >             col =
> > DatabaseManager.getCollection("xmldb:xindice:///db/myexamples");
> >
> >             String xpath = "/person";
> >             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)
> > ;
> >         }
> >         finally {
> >             if (col != null) {
> >                 col.close();
> >             }
> >         }
> >     }
> > }
> >
> > ----- Original Message -----
> > From: Mark J. Stang
> > To: xindice-users@xml.apache.org
> > Sent: Tuesday, February 05, 2002 5:39 PM
> > Subject: Re: exception error code
> >
> > It means something didn't work :-).   I don't mean that in a bad way,
> > I think you get that error for many different types of problems.
> >
> > Have you created the collection "myexamples"?
> >
> > Try
> >
> > dbxmladmin lc -c /db
> >
> > It should list your collections.
> >
> > Try "getting" one of the ones that are in the list.
> >
> > HTH,
> >
> > Mark
> >
> > Richard Featherstone wrote:
> >
> >  Hi Hope someone can help In a Java program I try and call     col =
> > DatabaseManager.getCollection("xmldb:dbxml:///db/myexamples"); and I get
> >     XML:DB EXCEPTION: occured 1 can anyone tell me what error code 1 is
> > so I can try to trace the problem Cheers Richard
> >
> >
> Kimbro Staken
> XML Database Software, Consulting and Writing
> http://www.xmldatabases.org/


Re: exception error code

Posted by Kimbro Staken <ks...@dbxmlgroup.com>.
You're using the dbxml database impl with the Xindice URI.  If you're 
using dbXML then you shouldn't have any mention of xindice, and if you're 
using xindice you shouldn't have any mention of dbXML

BTW, you can find out the error codes here 
http://www.xmldb.org/xapi/idl/base.idl. Also if you print out e.message it 
should give you more information. The error you're seeing is because it 
can't locate the database impl.

Yeah, I know it's confusing right now. We'll get an actual xindice release 
out real soon now and then dbXML can take its place in history.  The main 
holdup is that we need to get the website setup on the Apache side before 
we do the release.

On Tuesday, February 5, 2002, at 10:46 AM, Richard Featherstone wrote:

> I've created the collection and added a few documents.  I've queried the 
> collection from the command line and get the right results.  I'm no 
> trying to do the same thing from a Java program to get to grips with the 
> XML:DB Api.  The code I'm using is below.  Any ideas where I'm going 
> wrong will be gratefully received.
>  
> Cheers
>  
> Richard
>  
> import org.xmldb.api.base.*;
> import org.xmldb.api.modules.*;
> import org.xmldb.api.*;
>  
> public class ConnectToDbxml {
>  
>     /**  */
>     public static void main(String args[]) throws Exception {
>        
>         Collection col = null;
>        
>         try{
>             String driver = "org.dbxml.client.xmldb.DatabaseImpl";
>             Class c = Class.forName(driver);
>        
>             Database database = (Database)c.newInstance();
>             DatabaseManager.registerDatabase(database);
>            
>             col = 
> DatabaseManager.getCollection("xmldb:xindice:///db/myexamples");
>        
>             String xpath = "/person";
>             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)
> ;
>         }
>         finally {
>             if (col != null) {
>                 col.close();
>             }
>         }
>     }
> }
>
> ----- Original Message -----
> From: Mark J. Stang
> To: xindice-users@xml.apache.org
> Sent: Tuesday, February 05, 2002 5:39 PM
> Subject: Re: exception error code
>
> It means something didn't work :-).   I don't mean that in a bad way,
> I think you get that error for many different types of problems.
>
> Have you created the collection "myexamples"?
>
> Try
>
> dbxmladmin lc -c /db
>
> It should list your collections.
>
> Try "getting" one of the ones that are in the list.
>
> HTH,
>
> Mark
>
> Richard Featherstone wrote:
>
>  Hi Hope someone can help In a Java program I try and call     col = 
> DatabaseManager.getCollection("xmldb:dbxml:///db/myexamples"); and I get 
>     XML:DB EXCEPTION: occured 1 can anyone tell me what error code 1 is 
> so I can try to trace the problem Cheers Richard
>
>
Kimbro Staken
XML Database Software, Consulting and Writing
http://www.xmldatabases.org/


Re: exception error code

Posted by Richard Featherstone <ri...@btinternet.com>.
I've created the collection and added a few documents.  I've queried the collection from the command line and get the right results.  I'm no trying to do the same thing from a Java program to get to grips with the XML:DB Api.  The code I'm using is below.  Any ideas where I'm going wrong will be gratefully received.

Cheers

Richard 

import org.xmldb.api.base.*;
import org.xmldb.api.modules.*;
import org.xmldb.api.*;

public class ConnectToDbxml {

    /**  */
    public static void main(String args[]) throws Exception {
        
        Collection col = null;
        
        try{
            String driver = "org.dbxml.client.xmldb.DatabaseImpl";
            Class c = Class.forName(driver);
        
            Database database = (Database)c.newInstance();
            DatabaseManager.registerDatabase(database);
            
            col = DatabaseManager.getCollection("xmldb:xindice:///db/myexamples");
        
            String xpath = "/person";
            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);
        }
        finally {
            if (col != null) {
                col.close();
            }
        }
    } 
}

  ----- Original Message ----- 
  From: Mark J. Stang 
  To: xindice-users@xml.apache.org 
  Sent: Tuesday, February 05, 2002 5:39 PM
  Subject: Re: exception error code


  It means something didn't work :-).   I don't mean that in a bad way, 
  I think you get that error for many different types of problems. 
  Have you created the collection "myexamples"? 

  Try 

  dbxmladmin lc -c /db 

  It should list your collections. 

  Try "getting" one of the ones that are in the list. 

  HTH, 

  Mark 

  Richard Featherstone wrote: 

    Hi Hope someone can help In a Java program I try and call     col = DatabaseManager.getCollection("xmldb:dbxml:///db/myexamples"); and I get     XML:DB EXCEPTION: occured 1 can anyone tell me what error code 1 is so I can try to trace the problem Cheers Richard

Re: exception error code

Posted by "Mark J. Stang" <ma...@earthlink.net>.
It means something didn't work :-).   I don't mean that in a bad way,
I think you get that error for many different types of problems.

Have you created the collection "myexamples"?

Try

dbxmladmin lc -c /db

It should list your collections.

Try "getting" one of the ones that are in the list.

HTH,

Mark

Richard Featherstone wrote:

> Hi Hope someone can help In a Java program I try and call     col =
> DatabaseManager.getCollection("xmldb:dbxml:///db/myexamples"); and I
> get     XML:DB EXCEPTION: occured 1 can anyone tell me what error code
> 1 is so I can try to trace the problem Cheers Richard