xml-xindice-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Vadim Gritsenko <va...@reverycodes.com>
Subject Re: embedding xindice inside a specific webapp
Date Thu, 09 Sep 2004 02:45:21 GMT
Laxma Reddy Dendi wrote:

> Thanks for your reply Vadim.
> I did exactly the same.
> I can see in the tomcat startup that my "db" is
> pointing to the new location. Everything looks great.
> 
> but when i try to list the collections using 
> "xindice" command, (xindice lc -c
> xmldb:xindice://localhost:8080/db) i am getting the
> following error: XMLDB Exception 0: Cannot communicate
> with the server: http://localhost:8080/xindice
> 
> (I did not changed the "xml-rpc" part in system.xml)
> (i also tried xmldb:xindice://localhost:8080/myapp/db)


Please see javadoc for o.a.x.client.xmldb.xmlrpc.DatabaseImpl. Most 
probably you have to add SYSPROP_SERVICE_LOCATION parameter when running 
java:
   -Dxindice.xmlrpc.service-location=/myapp/

Otherwise it goes to DEFAULT_SERVICE_LOCATION, which is "/xindice/".


> also when i try the following code
> ==================================================
> <%@ page import = "org.xmldb.api.base.*" %> 
> <%@ page import = "org.xmldb.api.modules.*" %> 
> <%@ page import = "org.xmldb.api.*" %> 
> <%@ page import =
> "org.apache.xindice.client.xmldb.services.*" %> 
> <%@ page import = "org.apache.xindice.xml.dom.*" %> 
> 
> <%
> 
>   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";
>     col =
>       DatabaseManager.getCollection(uri);

When you are in the same webapp, use embed driver - it is faster. See 
javadoc.



>     String collectionName = "test";
>     CollectionManager service =
>       (CollectionManager)
> col.getService("CollectionManager", "1.0");
> 
>     // Build up the Collection XML configuration.
>     String collectionConfig =
>       "<collection compressed=\"true\" " +
>       "            name=\"" + collectionName + "\">" +
>       "   <filer
> class=\"org.apache.xindice.core.filer.BTreeFiler\"/>"
> +
>       "</collection>";
> 
>     service.createCollection(collectionName,
>       DOMParser.toDocument(collectionConfig));
> 
>     out.print("Collection " + collectionName + "
> created.");
>   }
>   catch (XMLDBException e) {
>     out.print("XML:DB Exception occured " +
> e.getMessage());
>   }
>   finally {
>     if (col != null) {
>       col.close();
>     }
>   }
>   
> %>
> ================================================
> i am getting the same error. 
> 
> Am I missing something here.? or doing wrong.?
> 
> please advise.
> 
> 
> regards,
> laxma
> 
> 
> 
> --- Vadim Gritsenko <vadim@reverycodes.com> wrote:
> 
> 
>>Laxma Reddy Dendi wrote:
>>
>>
>>>  Instead of deploying xindice.war under webapps, I
>>
>>>want to integrate xindice with my existing webapp.
>>>
>>>   So far I figured that I need to change the
>>>server.xml that comes with xindice and put it in
>>>my
>>
>>What server.xml? I don't see any.
>>
>>
>>>webapp's WEB-INF  folder. (also i need to put the
>>>jar's into my webapp's lib folder)
>>
>>Yes.
>>
>>
>>>   Please let me know what else I need to do.
>>
>>Same as for merging any other webapp:
>>WEB-INF/classes, WEB-INF/web.xml, 
>>all other resources within WEB-INF folder.
>>
>>
>>Vadim


Mime
View raw message