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 Alexander Schatten <al...@gmx.net> on 2002/02/01 23:10:06 UTC

Problems with simple java programm to access Xindice

I fail to write a simple java application accessing dbXML/XIncice:

(1) I start dbxml on localhost

(2) I try to connect to the database using this code:

     org.xmldb.api.base.Collection col = null;
     try {
       Class c = Class.forName("");

       Database database = (Database) c.newInstance();
       DatabaseManager.registerDatabase(database);
       col = 
DatabaseManager.getCollection("xmldb:dbxml://localhost:4080/db/root");

...
...

I receive an exception. btw. I tried a lot of different URIs also 
xmldb:dbxml:///db and so on.

"org.xmldb.api.base.XMLDBException: A connection to the Database 
instance 'db' could not be created. Error: http://localhost:4080/db.ior"


(3) sometimes I receive an error (even with the method from the 
documentation):

java.lang.NoClassDefFoundError: org/dbxml/server/dbXMLException


I searched through the jars and found neither this class, nor the server 
package...? so even the example programs will not work???


please can anyone give me assistance?


thank you



Alex



btw.: I found no place in the documentation where is explained which 
jars have to be added to the classpath when writing a java application...


Re: Problems with simple java programm to access Xindice

Posted by Kimbro Staken <ks...@dbxmlgroup.com>.
On Saturday, February 2, 2002, at 09:12 AM, Alexander Schatten wrote:
>
> thank you, but that was not the problem. in fact: some jars were not in 
> the classpath, and it worked afterwards. I also have to apologize, 
> because the classpath settings are explained in the documentation, though 
> not on the place one would expect them: they are NOT in the installation 
> part and NOT before the first example. so this seems to be a little bit 
> confusing. eventually one could make at least a link to this section.
>

Yeah, you're right. I'm rearranging things and adding a little more setup 
discussion before diving into the code.

>
>
> thank you
>
>
> Alex
>
>
>
Kimbro Staken
XML Database Software, Consulting and Writing
http://www.xmldatabases.org/


Re: Problems with simple java programm to access Xindice

Posted by Alexander Schatten <al...@gmx.net>.
Mark J. Stang wrote:

> Alex,
> Unless you created the collection "root", it doesn't exist.   The
> default used to be it was there automatically.   I believe the installation
> no longer creates it.   Try listing the collections to see if it is there.
> Or
> add a collection to be sure it is there.
> 
> HTH,
> Mark
> 


thank you, but that was not the problem. in fact: some jars were not in 
the classpath, and it worked afterwards. I also have to apologize, 
because the classpath settings are explained in the documentation, 
though not on the place one would expect them: they are NOT in the 
installation part and NOT before the first example. so this seems to be 
a little bit confusing. eventually one could make at least a link to 
this section.



thank you


Alex


Re: Problems with simple java programm to access Xindice

Posted by Øyvind Vestavik <Oy...@idi.ntnu.no>.
I once tried to access a collection that I hadn't created yet.
I received a nullpointer exception as i tried to create a resource under
my Collection col variable. (Col had not been given a value as the
collection couldn't be found.)So the error here is not consistent with
what you would get trying to access a non-existing collection.

I would think this has to do with your classpath. If you read the
Developers Guide theres a section on how to set up your environment there.

Øyvind

Øyvind Vestavik
Øvre Møllenberggt 44b
7014 Trondheim
oyvindve@idi.ntnu.no
41422911

On Fri, 1 Feb 2002, Mark J. Stang wrote:

> Alex,
> Unless you created the collection "root", it doesn't exist.   The
> default used to be it was there automatically.   I believe the installation
> no longer creates it.   Try listing the collections to see if it is there.
> Or
> add a collection to be sure it is there.
>
> HTH,
> Mark
>
> Alexander Schatten wrote:
>
> > I fail to write a simple java application accessing dbXML/XIncice:
> >
> > (1) I start dbxml on localhost
> >
> > (2) I try to connect to the database using this code:
> >
> >      org.xmldb.api.base.Collection col = null;
> >      try {
> >        Class c = Class.forName("");
> >
> >        Database database = (Database) c.newInstance();
> >        DatabaseManager.registerDatabase(database);
> >        col =
> > DatabaseManager.getCollection("xmldb:dbxml://localhost:4080/db/root");
> >
> > ...
> > ...
> >
> > I receive an exception. btw. I tried a lot of different URIs also
> > xmldb:dbxml:///db and so on.
> >
> > "org.xmldb.api.base.XMLDBException: A connection to the Database
> > instance 'db' could not be created. Error: http://localhost:4080/db.ior"
> >
> > (3) sometimes I receive an error (even with the method from the
> > documentation):
> >
> > java.lang.NoClassDefFoundError: org/dbxml/server/dbXMLException
> >
> > I searched through the jars and found neither this class, nor the server
> > package...? so even the example programs will not work???
> >
> > please can anyone give me assistance?
> >
> > thank you
> >
> > Alex
> >
> > btw.: I found no place in the documentation where is explained which
> > jars have to be added to the classpath when writing a java application...
>


Re: Problems with simple java programm to access Xindice

Posted by "Mark J. Stang" <ma...@earthlink.net>.
Alex,
Unless you created the collection "root", it doesn't exist.   The
default used to be it was there automatically.   I believe the installation
no longer creates it.   Try listing the collections to see if it is there.
Or
add a collection to be sure it is there.

HTH,
Mark

Alexander Schatten wrote:

> I fail to write a simple java application accessing dbXML/XIncice:
>
> (1) I start dbxml on localhost
>
> (2) I try to connect to the database using this code:
>
>      org.xmldb.api.base.Collection col = null;
>      try {
>        Class c = Class.forName("");
>
>        Database database = (Database) c.newInstance();
>        DatabaseManager.registerDatabase(database);
>        col =
> DatabaseManager.getCollection("xmldb:dbxml://localhost:4080/db/root");
>
> ...
> ...
>
> I receive an exception. btw. I tried a lot of different URIs also
> xmldb:dbxml:///db and so on.
>
> "org.xmldb.api.base.XMLDBException: A connection to the Database
> instance 'db' could not be created. Error: http://localhost:4080/db.ior"
>
> (3) sometimes I receive an error (even with the method from the
> documentation):
>
> java.lang.NoClassDefFoundError: org/dbxml/server/dbXMLException
>
> I searched through the jars and found neither this class, nor the server
> package...? so even the example programs will not work???
>
> please can anyone give me assistance?
>
> thank you
>
> Alex
>
> btw.: I found no place in the documentation where is explained which
> jars have to be added to the classpath when writing a java application...