You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by dkropotova <Da...@semantico.com> on 2007/11/23 12:58:45 UTC

Re: AW: eXist xmldb

Hello Abbas,

I followed your instractions. And I can now access my eXist db via xmldb
protocol. 

I am now trying to use xquery generator, that i have specified as
<map:generator name="xquery" src="org.exist.cocoon.XQueryGenerator"/>

While accessing my db now it gives me the following error
org.exist.util.DatabaseConfigurationException: cannot read data directory:
C:\Documents and
Settings\daria\workspace\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\webapps\Marsden-Reader-Prototype\WEB-INF\data

If I change the data directory in the conf.xml to point to my db (it is at
C:\apache-tomcat-5.5.25\webapps\exist-1.1.1-newcore\WEB-INF\data). It then
says that the database has been locked org.exist.EXistException: The
database directory seems to be locked by another database instance. Found a
valid lock file:
C:\apache-tomcat-5.5.25\webapps\exist-1.1.1-newcore\WEB-INF\data\dbx_dir.lck

I was wondering is there a way of specifing the exist db's location rather
than copying it to cocoon/WEB-INF/data/

Many thanks!!!
Daria



Abbas Mousavi wrote:
> 
>   Hi Peter and Chris
>    
>   I think that I should add something to the chris mail:
>      
> Mainly - as I know - there is two document for Installing exist with
> cocoon on tomcat one at Cocoon Wiki and One at eXist Wiki:
>    http://wiki.exist-db.org/space/CocoonInstall
> http://wiki.apache.org/cocoon/EXistInCocoon?highlight=%28exist%29
> 
>    
>   I prefer the document at eXist site, as Chris said, the document says
> that you should copy 
>       
>   * commons-pool-1.1.jar
>       * xmlrpc-1.2-patched.jar
>       * xmldb.jar
>       * exist.jar
>       * exist-optional.jar
>    
>   and optionaly
>       * castor-0.9.5-xml.jar
>       * commons-fileupload-1.0.jar
>       * isorelax.jar
>       * jgroups-all.jar
>       * xsdlib.jar
>       * msv.jar
>    
>   from cocoon distribution to cocoon/WEB-INF/lib, (the exact list of
> required jars depends on your needs.) then you should remove
>    
>       * xmldb-api-20030701.jar
>       * xmldb-common-20030701.jar
>       * xmldb-xupdate-20040205.jar
>    
>   From cocoon/WEB-INF/lib.
>    
>   Next, copy the central configuration file for exists from
> $EXIST_HOME/webapp/WEB-INF/conf.xml to cocoon/WEB-INF.
>   If you need to use the SOAP service, you should also copy
> $EXIST_HOME/webapp/WEB-INF/server-config.wsdd to cocoon/WEB-INF.
>   In order to move the data in the eXist database, copy the contents of
> $EXIST_HOME/webapp/WEB-INF/data/ to cocoon/WEB-INF/data/. 
>    
>   Edit cocoon/WEB-INF/web.xml. At the top, before the Cocoon servlet is
> configured, add the following lines:
>   You can eliminate the servlets that you don’t need them, You may skip
> the AxisServlet, AdminServlet, WebDAVServlet or RpcServlet (needed if you
> want to access the database instance from a remote client app), but you
> definitely need EXistServlet here
>    
>   <!-- RpcServlet provides XML-RPC access to eXist -->
>     <servlet>
>       <servlet-name>org.exist.xmlrpc.RpcServlet</servlet-name>
>       <servlet-class>org.exist.xmlrpc.RpcServlet</servlet-class>
>     </servlet>
>    
>   <servlet> <servlet-name>WebDAVServlet</servlet-name>
> <servlet-class>org.exist.http.servlets.WebDAVServlet</servlet-class>
>    
>   <init-param> <param-name>authentication</param-name>
> <param-value>basic</param-value> </init-param> </servlet>
>    
>   <!-- XQueryServlet generates HTML from an XQuery file. --> <servlet>
> <servlet-name>XQueryServlet</servlet-name>
> <servlet-class>org.exist.http.servlets.XQueryServlet</servlet-class>
>    
>   <init-param> <param-name>uri</param-name>
> <param-value>xmldb:exist:///db</param-value> </init-param>
>    
>   <init-param> <param-name>form-encoding</param-name>
> <param-value>UTF-8</param-value> </init-param>
>    
>   <init-param> <param-name>container-encoding</param-name>
> <param-value>UTF-8</param-value> </init-param>
>    
>   <init-param> <param-name>encoding</param-name>
> <param-value>UTF-8</param-value> </init-param> </servlet>
>    
>   <servlet> <servlet-name>EXistServlet</servlet-name>
> <servlet-class>org.exist.http.servlets.EXistServlet</servlet-class>
>    
>   <!-- where to find eXist's configuration file relative to the basedir of
> the web-application. --> <init-param>
> <param-name>configuration</param-name> <param-value>conf.xml</param-value>
> </init-param>
>    
>   <!-- eXist's home directory. All file names in the configuration file
> will be relative to this directory. --> <init-param>
> <param-name>basedir</param-name> <param-value>WEB-INF/</param-value>
> </init-param>
>    
>   <init-param> <param-name>start</param-name>
> <param-value>true</param-value> </init-param>
>    
>   <load-on-startup>1</load-on-startup>
>    
>   </servlet>
>    
>   <!-- configure the Axis servlets. Axis provides eXist's web-services via
> SOAP --> <servlet> <servlet-name>AxisServlet</servlet-name>
> <display-name>Apache-Axis Servlet</display-name>
> <servlet-class>org.apache.axis.transport.http.AxisServlet</servlet-class>
> </servlet>
>    
>   <servlet> <servlet-name>AdminServlet</servlet-name> <display-name>Axis
> Admin Servlet</display-name> <servlet-class>
> org.apache.axis.transport.http.AdminServlet </servlet-class>
> <load-on-startup>100</load-on-startup> </servlet>
>    
>    
>   Next, you need to add url mappings for these servlets. At the bottom
> section of the file, again before the Cocoon mapping, add:
>   Again you can use only url mappings that you need
>    
>   <!-- Define where the XMLRPC servlet listens -->
>     <servlet-mapping>
>       <servlet-name>org.exist.xmlrpc.RpcServlet</servlet-name>
>       <url-pattern>/xmlrpc</url-pattern>
>     </servlet-mapping>
>    
>   <!-- eXist's DatabaseAdminServlet --> <servlet-mapping>
> <servlet-name>EXistServlet</servlet-name>
> <url-pattern>/servlet/*</url-pattern> </servlet-mapping>
>    
>   <servlet-mapping> <servlet-name>WebDAVServlet</servlet-name>
> <url-pattern>/webdav/*</url-pattern> </servlet-mapping>
>    
>   <!-- XQueryServlet --> <servlet-mapping>
> <servlet-name>XQueryServlet</servlet-name>
> <url-pattern>*.xql</url-pattern> </servlet-mapping>
>    
>   <!-- The following servlet-mappings are for Axis (SOAP) -->
> <servlet-mapping> <servlet-name>AxisServlet</servlet-name>
> <url-pattern>/axis-servlet/AxisServlet</url-pattern> </servlet-mapping>
>    
>   <servlet-mapping> <servlet-name>AxisServlet</servlet-name>
> <url-pattern>*.jws</url-pattern> </servlet-mapping>
>    
>   <servlet-mapping> <servlet-name>AxisServlet</servlet-name>
> <url-pattern>/services/*</url-pattern> </servlet-mapping>
>    
>   <servlet-mapping> <servlet-name>AdminServlet</servlet-name>
> <url-pattern>/axis-servlet/AdminServlet</url-pattern> </servlet-mapping>
>    
>    
>   Then edit cocoon/WEB-INF/cocoon.xconf. Change the section that
> configures the xmldb pseudo protocol. Add the xmldb driver for eXist:
>   <!-- xmldb pseudo protocol -->
>   <component-instance 
>   class="org.apache.cocoon.components.source.impl.XMLDBSourceFactory" 
>   name="xmldb">
>     <!-- Add here other XML:DB compliant databases' drivers -->
>     <driver class="org.exist.xmldb.DatabaseImpl" type="exist"/>
>   </component-instance>
>    
>   This configuration works but from my experience it is better that you
> also replace org.apache.cocoon.components.source.impl.XMLDBSourceFactory
> with org.exist.cocoon.XMLDBSourceFactory, since it seems that 
>   org.apache.cocoon.components.source.impl.XMLDBSourceFactory has some
> problems with unicode document, but org.exist.cocoon.XMLDBSourceFactory
> uses eXist’s xmldb source and is taylored to eXist and has no Unicode
> problem.
>    
>    
>   To use eXist's XSP logicsheet, edit the section on markup languages and
> include a reference to eXist's logicsheet at the top:
>    
>   <markup-languages>
>       <xsp-language logger="core.markup.xsp" name="xsp">
>         <parameter name="prefix" value="xsp"/>
>         <parameter name="uri" value="http://apache.org/xsp"/>
>    
>   <!--+ | Properties for the java language +--> <target-language
> name="java"> <!-- Defines the XSP Core logicsheet for the Java language
> --> <parameter name="core-logicsheet"
> value="resource://org/apache/cocoon/components/language/markup/xsp/java/xsp.xsl"/>
>   
>    
>   <builtin-logicsheet> <parameter name="prefix" value="xdb"/> <parameter
> name="uri" value="http://exist-db.org/xmldb/1.0"/> <parameter name="href"
> value="resource://org/exist/xmldb.xsl"/> </builtin-logicsheet> ...
>    
>   You should now be able to copy the contents of eXist's webapp directory
> ($EXIST_HOME/webapp) into a subdirectory of your Cocoon installation (e.g.
> cocoon/exist) and access eXist's main page and most examples. However,
> some examples won't work as they assume a fixed path /exist. The XQuery
> scripts need to be changed accordingly. 
>   Also you can use XQuery Generator as Chris said.
>    
>   Regards
>   Abbas
>   
> 		
> ---------------------------------
> Yahoo! Messenger with Voice. PC-to-Phone calls for ridiculously low rates.
> 

-- 
View this message in context: http://www.nabble.com/eXist-xmldb-tf1743163.html#a13911129
Sent from the Cocoon - Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org