Re: Please help me run Example1

"Lisa McCabe" <[email protected]>
Newsgroups gmane.text.xml.xindice.user
Message-ID <001a01c57cf1$c7789c20$8ed3d442@MegaCool>
Renaming Xindice to xindice didn't work (same error) - broke the web browser
connection too. I am trying to reload everything on a different computer
(windows xp desktop) to see if starting over helps. Man, this problem is
killing me.

----- Original Message -----
From: "Todd Byrne" <[email protected]>
To: <[email protected]>
Sent: Wednesday, June 29, 2005 12:28 PM
Subject: Re: Please help me run Example1


> I think you need to rename your server to lowercase xindice.
>
> So rename the Xindice directory to xindice and restart tomcat see if
> that works.
>
> Todd
>
> Lisa McCabe wrote:
> > Hi Todd,
> >
> > I put the code you gave me into my example and ran it. The main problem
is
> > that it throws an exception in the line:
> >
> > Collection dbCollection = Database Manager.getCollection(uri);
> >
> >      where String uri = "xmldb:xindice://localhost:8080/db";
> >
> > so I never get past this point.
> >
> > Just a question: my Xindice created the /db/... directories under
> > ...\tomcat50-jwsdp\registry-server\Xindice\db... is this correct?
> >
> > The directories are there, my web browser sees them, xindice comandline
sees
> > them. I must have something configed wrong. but what...
> >
> > I appreciate your help very much!
> > Lisa
> >
> > PS From your code, I assumed collectionName was a String and I used
> > "addressbook".
> >
> > ----- Original Message -----
> > From: "Lisa McCabe" <[email protected]>
> > To: <[email protected]>
> > Sent: Tuesday, June 28, 2005 6:20 PM
> > Subject: Re: Please help me run Example1
> >
> >
> >
> >>Hi  Todd,
> >>
> >>My addressbook is definately there and I can browse it with the web
> >
> > browser.
> >
> >>I knew the code was good because it was straight from Users Guide. I
will
> >>try your code to create a collection from within my code. Then I will
see
> >
> > if
> >
> >>I can browse the new collection from the web browser. I must have set
> >>something up wrong somehow but the steps were pretty straight forward
and
> >
> > I
> >
> >>am not sure where I went wrong. I'll report back...
> >>
> >>Thanks,
> >>Lisa
> >>
> >>
> >>----- Original Message -----
> >>From: "Todd Byrne" <[email protected]>
> >>To: <[email protected]>
> >>Sent: Tuesday, June 28, 2005 3:20 PM
> >>Subject: Re: Please help me run Example1
> >>
> >>
> >>
> >>>Hi Lisa,
> >>>
> >>>I load that code up and I didn't run because I didn't have the
> >>>addressbook collection added on my computer. Once I added the
collection
> >>>it ran fine.
> >>>
> >>>Try pointing your browser to http://localhost:8080/xindice insuring
that
> >>>the addressbook collection is there.
> >>>
> >>>I have included some code that will create that collection from within
> >>>your code.
> >>>
> >>>The line: System.out.println(database.acceptsURI(uri));
> >>>Doesn't seem to properly work the way I do it is to check to see if the
> >>>collection is null after calling 'DatabaseManager.getCollection(uri)'.
> >>>
> >>>Here is the code to create the addressbook collection.
> >>>String uri = "xmldb:xindice://localhost:8080/db";
> >>>Collection dbCollection = DatabaseManager.getCollection(uri);
> >>>
> >>>CollectionManager manager = (CollectionManager)dbCollection.getService(
> >>>          "CollectionManager", "1.0");
> >>>String collectionConfig =
> >>>              "<collection compressed=\"true\" name=\""
> >>>              + collectionName
> >>>              + "\">"
> >>>              +
> >>>              "   <filer
> >>>class=\"org.apache.xindice.core.filer.BTreeFiler\" gzip=\"true\"/>"
> >>>               + "</collection>";
> >>>manager.createCollection(collectionName,
> >>>DOMParser.toDocument(collectionConfig));
> >>>
> >>>Collection addressBookCollection = DatabaseManager.getCollection(uri +
> >>>"/addressbook");
> >>>
> >>>
> >>>
> >>>Hope this helps.
> >>>
> >>>I will look into why acceptsURI returns false.
> >>>
> >>>
> >>>Todd
> >>>
> >>>
> >>>
> >>>
> >>>
> >>>Lisa McCabe wrote:
> >>>
> >>>>Hi Todd, (or anyone who could help me!)
> >>>>
> >>>>Here is the source code that I have been trying to run:
> >>>>
> >>>>package org.apache.xindice.examples;
> >>>>
> >>>>import org.xmldb.api.base.*;
> >>>>import org.xmldb.api.modules.*;
> >>>>import org.xmldb.api.*;
> >>>>
> >>>>/**
> >>>> * Simple XML:DB API example to query the database.
> >>>> */
> >>>>public class Example1 {
> >>>>
> >>>>    public static void main(String[] args) throws Exception {
> >>>>        Collection collection = null;
> >>>>        try {
> >>>>
> >>>>  String driver = "org.apache.xindice.client.xmldb.DatabaseImpl";
> >>>>  Class c = Class.forName(driver);
> >>>>
> >>>>  Database database = (Database) c.newInstance();
> >>>>
> >>>>  database.setProperty("xmlrpc-password", "...");
> >>>>  database.setProperty("xmlrpc-user", "xindice");
> >>>>
> >>>>  DatabaseManager.registerDatabase(database);
> >>>>
> >>>>            String uri =
> >>
> >>"xmldb:xindice://localhost:8080/db/addressbook";
> >>
> >>>>  System.out.println("*******");
> >>>>  System.out.println(database.acceptsURI(uri));
> >>>>  System.out.println("*******");
> >>>>
> >>>>  collection = DatabaseManager.getCollection(uri);
> >>>>
> >>>>            String xpath = "//person[fname='John']";
> >>>>            XPathQueryService service = (XPathQueryService)
> >>>>collection.getService("XPathQueryService", "1.0");
> >>>>            ResourceSet resourceSet = service.query(xpath);
> >>>>            ResourceIterator resourceIterator =
> >>
> >>resourceSet.getIterator();
> >>
> >>>>            while (resourceIterator.hasMoreResources()) {
> >>>>                Resource resource = resourceIterator.nextResource();
> >>>>                System.out.println((String) resource.getContent());
> >>>>            }
> >>>>        } catch (XMLDBException e) {
> >>>>            System.err.println("XML:DB Exception occured " +
> >
> > e.errorCode
> >
> >>+ "
> >>
> >>>>" + e.getMessage());
> >>>>        } finally {
> >>>>            if (collection != null) {
> >>>>                collection.close();
> >>>>            }
> >>>>        }
> >>>>    }
> >>>>}
> >>>>
> >>>>I can't firgure out why it cannot find /db. From reading other users
> >>
> >>email,
> >>
> >>>>classpath problems seem possible. The following is my classpath. Do
> >
> > you
> >
> >>see
> >>
> >>>>anything missing or out of order?
> >>>>
> >>>>c:\Sun\jwsdp-1.5\jaxp\lib;
> >>>>
> >>>>c:\junit3.8.1\junit.jar;
> >>>>
> >>>>c:\junit3.8.1\junit;
> >>>>
> >>>>c:\j2sdk1.4.2_08;
> >>>>
> >>>>c:\j2sdk1.4.2_08\bin;
> >>>>
> >>>>c:\j2sdk1.4.2_08\lib;
> >>>>
> >>>>c:\j2sdk1.4.2_08\jre;
> >>>>
> >>>>c:\j2sdk1.4.2_08\include;
> >>>>
> >>>>%XINDICE_HOME%;
> >>>>
> >>>>%XINDICE_HOME%\lib;
> >>>>
> >>>>%XINDICE_HOME%\bin;
> >>>>
> >>>>c:\XIndiceBrowser_bin\XindiceBrowser\XIndiceBrowser.jar;
> >>>>
> >>>>c:\XindiceBrowser_bin\XindiceBrowser\XIndiceBrowser_lib.jar
> >>>>
> >>>>%XINDICE_HOME%\lib\xindice-1.1b4.jar;
> >>>>
> >>>>%XINDICE_HOME%\lib\xmldb-common-20030701.jar;
> >>>>
> >>>>%XINDICE_HOME%\lib\xmldb-api-20030701.jar;
> >>>>
> >>>>%XINDICE_HOME%\lib\xmldb-api-sdk-20030701.jar;
> >>>>
> >>>>%XINDICE_HOME%\lib\xmldb-xupdate-20040205.jar;
> >>>>
> >>>>%XINDICE_HOME%\lib\xml-apis.jar;
> >>>>
> >>>>%XINDICE_HOME%\lib\xerces-2.6.0.jar;
> >>>>
> >>>>%XINDICE_HOME%\lib\xalan-2.5.2.jar;
> >>>>
> >>>>%XINDICE_HOME%\lib\commons-logging-1.0.3.jar;
> >>>>
> >>>>%XINDICE_HOME%\lib\xmlrpc-1.1.jar;
> >>>>
> >>>>%TOMCAT_HOME%\bin\common-logging-api.jar;
> >>>>
> >>>>%TOMCAT_HOME%\common\endorsed\xercesImpl.jar;
> >>>>
> >>>>%TOMCAT_HOME%\common\endorsed\xmlParserAPIs.jar;
> >>>>
> >>>>.;
> >>>>
> >>>>
> >>>>
> >>>>Thanks!
> >>>>
> >>>>Lisa McCabe
> >>>>
> >>>>
> >>>>
> >>>>----- Original Message -----
> >>>>From: "Todd Byrne" <[email protected]>
> >>>>To: <[email protected]>
> >>>>Sent: Friday, June 24, 2005 2:36 PM
> >>>>Subject: Re: Please help me run Example1
> >>>>
> >>>>
> >>>>
> >>>>
> >>>>>Yeah the addressbook example is webapp.
> >>>>>
> >>>>>Once Xindice is running inside tomcat you will beable to access it
> >
> > from
> >
> >>>>>simple java code but the addressbook is just a jsp example. If you
> >
> > have
> >
> >>>>>the code that your having trouble getting to work post to the list
and
> >
> > I
> >
> >>>>>can take a look.
> >>>>>
> >>>>>Todd
> >>>>>
> >>>>>Lisa McCabe wrote:
> >>>>>
> >>>>>
> >>>>>>Hi Todd,
> >>>>>>
> >>>>>>Thank you for your response.
> >>>>>>
> >>>>>>I forgot to say that I am running on Windows. I just downloaded the
> >>
> >>.zip
> >>
> >>>>>>file and will take a look at the example files.
> >>>>>>
> >>>>>>Are you saying that I should build a .war file then deploy it in
> >
> > tomcat
> >
> >>>>and
> >>>>
> >>>>
> >>>>>>run it like a webapp? I was hoping to be able to access xindice from
> >
> > a
> >
> >>>>java
> >>>>
> >>>>
> >>>>>>program. I will try what you suggest.
> >>>>>>
> >>>>>>Thanks again,
> >>>>>>Lisa
> >>>>>>
> >>>>>>PS  I still think I may simply have a CLASSPATH problem.
> >>>>>>
> >>>>>>----- Original Message -----
> >>>>>>From: "Todd Byrne" <[email protected]>
> >>>>>>To: <[email protected]>
> >>>>>>Sent: Thursday, June 23, 2005 12:18 PM
> >>>>>>Subject: Re: Please help me run Example1
> >>>>>>
> >>>>>>
> >>>>>>
> >>>>>>
> >>>>>>
> >>>>>>>Hi Lisa,
> >>>>>>>
> >>>>>>>So I am assuming you downloaded
>
>>>>>>>http://ftp.wayne.edu/apache/xml/xindice/xml-xindice-1.1b4-jar.tar.gz
> >>>>>>>
> >>>>>>>Un-tarred it into a dir lets say /tmp.
> >>>>>>>
> >>>>>>>cd $XINDICE_HOME/java/examples
> >>>>>>># this builds the addressbook example ant needs to be in your path
> >>>>>>>ant
> >>>>>>># this copies the war to your webapps under a tomcat directory
> >>>>>>>cp ../../dist/addressbook.war $JAKARTA_HOME/webapps #
> >>>>>>>cd $JAKARTA_HOME/bin
> >>>>>>>./shutdown.sh #shutdown tomcat
> >>>>>>>./startup.sh  #restart tomecat
> >>>>>>>
> >>>>>>>Open up your favorite browser point it to:
> >>>>>>
> >>>>>>http://localhost:8080/addressbook
> >>>>>>
> >>>>>>
> >>>>>>
> >>>>>>>That should get you going. Let me know if you need any more help
let
> >>
> >>me
> >>
> >>>>>>know
> >>>>>>
> >>>>>>
> >>>>>>
> >>>>>>>Todd
> >>>>>>>
> >>>>>>>PS: Lines starting with a '#' are comments.
> >>>>>>>
> >>>>>>>
> >>>>>>>Lisa McCabe wrote:
> >>>>>>>
> >>>>>>>
> >>>>>>>
> >>>>>>>>Hello,
> >>>>>>>>
> >>>>>>>>I am still trying to get Example1 to run (unfortunately). I have
> >>>>
> >>>>changed
> >>>>
> >>>>
> >>>>>>>>the port to 8080. I have also added xmlParserAPIs.jar and
> >>>>
> >>>>xercesImpl.jar
> >>>>
> >>>>
> >>>>>>>>to my CLASSPATH. I still am getting the same runtime error.
> >>>>>>>>
> >>>>>>>>If my URI is "xmldb:xindice:///db/addressbook" as specified in
> >>>>
> >>>>Example1,
> >>>>
> >>>>
> >>>>>>>>I get
> >>>>>>>>
> >>>>>>>>XML:DB Exception occurred 1 A connection to the Database Instance
> >>
> >>'db'
> >>
> >>>>>>>>could not be created. Error:  Connection refused: connect
> >>>>>>>>
> >>>>>>>>Else if my URI is "xmldb:xindice://localhost:8080/db/addressbook"
> >>>>>>>>XML:DB Exception occurred 1 A connection to the Database Instance
> >>
> >>'db'
> >>
> >>>>>>>>could not be created. Error:
http://localhost:8080/db_bootstrap.ior
> >>>>>>>>
> >>>>>>>>Commandline xindice and "Ugly" web browser have no problems
> >>>>
> >>>>"connecting"
> >>>>
> >>>>
> >>>>>>>>to /db.
> >>>>>>>>
> >>>>>>>>I really need to move past this problem (and on to the next!) Hope
> >>
> >>you
> >>
> >>>>>>>>can help...
> >>>>>>>>
> >>>>>>>>Thanks,
> >>>>>>>>Lisa McCabe
> >>>>>>>>
> >>>>>>>>----- Original Message -----
> >>>>>>>>
> >>>>>>>>  *From:* Lisa McCabe <mailto:[email protected]>
> >>>>>>>>  *To:* [email protected]
> >>>>>>>>  <mailto:[email protected]>
> >>>>>>>>  *Sent:* Monday, June 20, 2005 4:48 PM
> >>>>>>>>  *Subject:* Please help me run Example1
> >>>>>>>>
> >>>>>>>>  Hi,
> >>>>>>>>
> >>>>>>>>  I am having trouble getting Example1 to work correctly. I am
> >
> > using
> >
> >>>>>>>>  Xindice 1.1b4 with Tomcat V5.
> >>>>>>>>
> >>>>>>>>  Example1 runs but gives me the following:
> >>>>>>>>
> >>>>>>>>  XML:DB Exception occurred 1 A connection to the Database
> >
> > Instance
> >
> >>>>>>>>  'db' could not be created. Error:
> >>>>>>
> >>>>>>http://localhost:8888/db_bootstrap.ior
> >>>>>>
> >>>>>>
> >>>>>>
> >>>>>>>>  Xindice commandline works fine. And I can view /db through the
> >>>>
> >>>>"Ugly
> >>>>
> >>>>
> >>>>>>>>  Browser".
> >>>>>>>>
> >>>>>>>>  I also get basically the same error when I try to run
> >>>>>>
> >>>>>>XindiceBrowser.
> >>>>>>
> >>>>>>
> >>>>>>
> >>>>>>>>  I have read through some old xindice-users problem emails,
> >
> > looking
> >
> >>>>>>>>  for similar problems. I have found one saying that
> >>
> >>db_bootstrap.ior
> >>
> >>>>>>>>  indicates that I am using Xindice 1.0 client and Xindice 1.1
> >>>>
> >>>>Server.
> >>>>
> >>>>
> >>>>>>>>  Since I downloaded Xindice binary in one .zip, I am not sure how
> >
> > I
> >
> >>>>>>>>  could have that problem. Another email said it could be a
> >>
> >>CLASSPATH
> >>
> >>>>>>>>  problem. I think I now have every .jar file on the planet in my
> >>>>>>>>  classpath but the email indicated xmlParserAPIs.jar and
> >>>>>>>>  xercesImpl.jar (not xerces.jar), I could find neither of those.
> >>>>>>>>
> >>>>>>>>  Is there anyone out there who could help me with this
> >
> > problem???!
> >
> >>>>>>>>  Need help,
> >>>>>>>>  Lisa McCabe
> >>>>>>>>
> >>>>>>>>  Thanks a bunch in advance!!
> >>>
> >>
>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.