Are you accesing the XML database from another computer? Is the JSP in a
different machine than the xml server?
If so, you should indicate it in the collection URI.
For example:
> // get a collection:
> String colURI =
> "xmldb:xindice://<xml_server_host>:<port>/db/sample";
> col = DatabaseManager.getCollection(colURI);
And of course, you should have connection to that machine (no firewalls at
least on port 4080).
I hope that helps. I've been looking to the code and looks fine.
E.Chiner
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Esteban Chiner Sanz
I+D / Centro de Soluciones Web y Multimedia
�rea de Servicios Interactivos
Tel: +34 96 5040000 Ext. 44717
Wanadoo Espa�a - http://www.wanadoo.es
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> -----Mensaje original-----
> De: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED]
> Enviado el: viernes, 07 de febrero de 2003 0:43
> Para: [email protected]
> Asunto: Can't get Collection from jsp
>
>
> Hello,
>
> i am using Xindice 1.0,java1.4.0_01,tomcat4.0.3,and apache1.3.22.
> i can access my db on local commandline,BUT i can't access from jsp.
>
> on local,i can access as this:
>
> # /usr/local/Xindice/start
> Xindice Loader
> ==============
> Environment
> -----------
> XINDICE_HOME = /usr/local/Xindice
> CLASSPATH =
> /usr/local/Xindice/java/lib/xmldb.jar:
> /usr/local/Xindice/java/lib/xmldb-xupdate.jar:
> /usr/local/Xindice/java/lib/xmldb-sdk.jar:
> /usr/local/Xindice/java/lib/xml-apis-1.0.jar:
> /usr/local/Xindice/java/lib/xindice.jar:
> /usr/local/Xindice/java/lib/xerces-1.4.3.jar:
> /usr/local/Xindice/java/lib/xalan-2.0.1.jar:
> /usr/local/Xindice/java/lib/openorb_tools-1.2.0.jar:
> /usr/local/Xindice/java/lib/openorb-1.2.0.jar:
> /usr/local/Xindice/java/lib/infozone-tools.jar:
> /usr/local/Xindice/java/lib/examples.jar:
> /usr/local/Xindice/java/lib/ant-1.4.1.jar:
> /usr/local/Xindice/classgen:
> /usr/local/Xindice/config:
> /usr/java/j2sdk1.4.0_01/lib/tools.jar:
> /usr/java/j2sdk1.4.0_01/jre/lib/rt.jar:
> /var/tomcat4/common/lib/servlet.jar:
> /var/tomcat4/lib/jdbc7.1-1.2.jar:/
> .:
> Starting Xindice
> ----------------
> Xindice 1.0 (Birthday)
> Database: 'db' initializing
> Script: 'GET' added to script storage
> Service: 'db' started
> Service: 'HTTPServer' started @ http://localhost:4080/
> Service: 'APIService' started
> Server Running
>
>
> in this context,i can access the xindice like this:
> $ xindice lc -c /db/sample
> $ xindice xpath -c /db/sample -q "//entry[name='AA']"
>
>
> next,i made this jsp program:
>
> <!-- test.jsp -->
> <%@ page contentType="text/html; charset=Shift_JIS"
> import="java.io.*,,
> org.xmldb.api.base.*,
> org.xmldb.api.modules.*,
> org.xmldb.api.*,
> org.w3c.dom.*,
> javax.xml.parsers.DocumentBuilderFactory,
> org.apache.xerces.dom.DocumentImpl"
> %>
> <HTML><HEAD>
> <META HTTP-EQUIV="content-type" CONTENT="text/html;charset=Shift_JIS">
> <TITLE>test</TITLE></HEAD>
> <BODY>
> <%
> Collection col = null;
>
> try {
> // redist a database:
> String driver =
> "org.apache.xindice.client.xmldb.DatabaseImpl";
> Class c = Class.forName(driver);
> Database database = (Database) c.newInstance();
> DatabaseManager.registerDatabase(database);
>
> // get a collection:
> String colURI = "xmldb:xindice:///db/sample";
> col = DatabaseManager.getCollection(colURI);
> // *** error!! ***
>
> // search with an XPath:
> String xpath = request.getParameter("entry[name='AA']");
> ResourceSet resultSet = service.query(xpath);
>
> // get XML document as String
> ResourceIterator results = resultSet.getIterator();
> while (results.hasMoreResources()) {
> Resource res = results.nextResource();
> out.println((String) res.getContent());
> }
> }
> catch (XMLDBException e) {
> out.println("XML:DB Exception. code:"+ e.errorCode);
> out.println("message:"+e.getMessage());
> }
> finally {
> if (col != null) {
> col.close();
> }
> }
> %>
> </BODY>
> </HTML>
>
>
> looking this page on internet,I get a error masage like this:
> XML:DB Exception. code:1
> message:A connection to the Database instance 'db' could not
> be created.
> Error: Cannot create resource URL. Please set the
> openorb.home property
>
>
> why can't i access my db on jsp?
> set the openorb.home property? in where?
>
>
> sorry,too long.
> thank you in advance for your help,
> UOTSUKA,Jin
> --
> UOTSUKA,Jin <[EMAIL PROTECTED]>
>
>