Unable to get jetty servlet to see existing database

Friday, 19 October 2012 · 4 messages · last reply 23 Oct 2012
MM
Michael Mendez19 Oct 2012 19:21 #
I have an existing install of basex running on a centos machine. The install runs fine, I am able to edit .basex files to point to the main database, and can run the client from anywhere and connect once I make .basex changes. I also have jetty6 running (on the same box) with the basex war package (7.3), which also runs, is accessible, and returns valid rest responses. My issue is the rest response shows no resources available, which as far as I can tell means it is not connecting to my existing database but creating (or created) it's own. Based on the documentation on the site, I have changed the web.xml's dbpath variable to the existing BaseXData path. I have used the same value I used in the .basex files, repackaged the .war, and restarted jetty, with no success. Other changes, like to the index.html in the war, will show, so I know I am rebuilding the war and viewing those changes correctly. What do I need to change to make the servlet of basex see a database folder already available? I have posted this question on stackoverflow as well: http://stackoverflow.com/questions/12976335/basex-servlet-doesnt-see-existing-database Here is my web.xml:
<?xml version="1.0" encoding="UTF-8"?>
<web-app
  xmlns="http://java.sun.com/xml/ns/javaee"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
  version="2.5">

  <display-name>ATS</display-name>
  <description>REST Services for XML data</description>

  <!-- The following parameters may also be passed on as system properties:
-->

  <!-- Operation mode: by default, the value is "local": the servlets will
       work with a local database context. If "server" is specified, a
database
       server instance will be started after the first call of a service.
-->
  <context-param>
    <param-name>org.basex.mode</param-name>
    <param-value>local</param-value>
  </context-param>
  <context-param>
   <param-name>org.basex.server</param-name>
   <param-value>local</param-value>
 </context-param>

  <!-- Login data: by default, no user and password is specified, and the
       credentials must be passed on by the client. Please check by yourself
       if it is safe to store your credentials in this file. -->
  <context-param>
    <param-name>org.basex.user</param-name>
    <param-value>admin</param-value>
  </context-param>
  <context-param>
    <param-name>org.basex.password</param-name>
    <param-value>admin</param-value>
  </context-param>

  <!-- All database main options, which are usually stored in the .basex
       configuration file (DBPATH, DEBUG, etc.), can be specified as well by
       prefixing the key with "org.basex.". If an option references a
relative
       path, it will be prefixed with the servlet root path.
  <context-param>
    <param-name>org.basex.dbpath</param-name>
    <param-value>/ats/BaseXData/</param-value>
  </context-param>
  <context-param>
    <param-name>org.basex.httppath</param-name>
    <param-value>.</param-value>
  </context-param>
  <context-param>
    <param-name>org.basex.repopath</param-name>
    <param-value>http</param-value>
  </context-param>
  <context-param>
    <param-name>org.basex.lang</param-name>
    <param-value>English</param-value>
  </context-param>
  <context-param>
    <param-name>org.basex.debug</param-name>
    <param-value>true</param-value>
  </context-param>
    <param-value>true</param-value>
  </context-param>
  -->

  <!--  REST Service (can be deactivated by removing this entry) -->
  <servlet>
    <servlet-name>REST</servlet-name>
    <servlet-class>org.basex.http.rest.RESTServlet</servlet-class>
  </servlet>
  <servlet-mapping>
    <servlet-name>REST</servlet-name>
    <url-pattern>/rest/*</url-pattern>
  </servlet-mapping>
</web-app>
Thank you for your time!
CG
Christian Grün23 Oct 2012 13:47 #
Dear Michael, sorry for the late feedback. Along with BaseX 7.5, several changes have been performed in the web application context, so I would like to hear if you have already tried our latest snapshot [1], and if the problems are resolved with that version. The new version will be released pretty soon, which means there will only be minor changes in the code. If you are running BaseX as web application, the .basex can be safely ignored. Christian [1] http://files.basex.org/releases/latest/
Quoted text · Michael Mendez · 119 lines
On Fri, Oct 19, 2012 at 5:21 PM, Michael Mendez <michaelgmendez at gmail.com> wrote: > I have an existing install of basex running on a centos machine. The install > runs fine, I am able to edit .basex files to point to the main database, > and can run the client from anywhere and connect once I make .basex changes. > > I also have jetty6 running (on the same box) with the basex war package > (7.3), which also runs, is accessible, and returns valid rest responses. > > My issue is the rest response shows no resources available, which as far as > I can tell means it is not connecting to my existing database but creating > (or created) it's own. Based on the documentation on the site, I have > changed the web.xml's dbpath variable to the existing BaseXData path. I have > used the same value I used in the .basex files, repackaged the .war, and > restarted jetty, with no success. > > Other changes, like to the index.html in the war, will show, so I know I am > rebuilding the war and viewing those changes correctly. > > What do I need to change to make the servlet of basex see a database folder > already available? > > I have posted this question on stackoverflow as well: > http://stackoverflow.com/questions/12976335/basex-servlet-doesnt-see-existing-database > > Here is my web.xml: > > > <?xml version="1.0" encoding="UTF-8"?> > <web-app > xmlns="http://java.sun.com/xml/ns/javaee" > xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" > xsi:schemaLocation="http://java.sun.com/xml/ns/javaee > http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" > version="2.5"> > > <display-name>ATS</display-name> > <description>REST Services for XML data</description> > > <!-- The following parameters may also be passed on as system properties: > --> > > <!-- Operation mode: by default, the value is "local": the servlets will > work with a local database context. If "server" is specified, a > database > server instance will be started after the first call of a service. > --> > <context-param> > <param-name>org.basex.mode</param-name> > <param-value>local</param-value> > </context-param> > <context-param> > <param-name>org.basex.server</param-name> > <param-value>local</param-value> > </context-param> > > <!-- Login data: by default, no user and password is specified, and the > credentials must be passed on by the client. Please check by yourself > if it is safe to store your credentials in this file. --> > <context-param> > <param-name>org.basex.user</param-name> > <param-value>admin</param-value> > </context-param> > <context-param> > <param-name>org.basex.password</param-name> > <param-value>admin</param-value> > </context-param> > > <!-- All database main options, which are usually stored in the .basex > configuration file (DBPATH, DEBUG, etc.), can be specified as well by > prefixing the key with "org.basex.". If an option references a > relative > path, it will be prefixed with the servlet root path. > <context-param> > <param-name>org.basex.dbpath</param-name> > <param-value>/ats/BaseXData/</param-value> > </context-param> > <context-param> > <param-name>org.basex.httppath</param-name> > <param-value>.</param-value> > </context-param> > <context-param> > <param-name>org.basex.repopath</param-name> > <param-value>http</param-value> > </context-param> > <context-param> > <param-name>org.basex.lang</param-name> > <param-value>English</param-value> > </context-param> > <context-param> > <param-name>org.basex.debug</param-name> > <param-value>true</param-value> > </context-param> > <param-value>true</param-value> > </context-param> > --> > > <!-- REST Service (can be deactivated by removing this entry) --> > <servlet> > <servlet-name>REST</servlet-name> > <servlet-class>org.basex.http.rest.RESTServlet</servlet-class> > </servlet> > <servlet-mapping> > <servlet-name>REST</servlet-name> > <url-pattern>/rest/*</url-pattern> > </servlet-mapping> > </web-app> > > > > Thank you for your time! > > > > _______________________________________________ > BaseX-Talk mailing list > BaseX-Talk at mailman.uni-konstanz.de > https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk >
CG
Christian Grün23 Oct 2012 19:07 #
Hi Michael, with 7.5, there are several, alternative options to start the BaseX HTTP Server, which are listed at [1]. You either need to deploy the WAR file, or run basexhttp. a) if you deploy the WAR file, your databases will be contained in the archived webapp directory. With the latest snapshots, the database server will be automatically started along with the web server b) if you run basexhttp, you can specify DBPATH and the path to the webapp directory (WEBPATH) in the .basex configuration file. Hope this helps, feel free to ask for more, Christian [1] http://docs.basex.org/wiki/Startup#BaseX_HTTP_Server
Quoted text · Christian Grün · 187 lines
> I am running the 7.5 snapshot now, which has been a bit easier to work with, > but I still end up stuck in the same place. > > Ultimately, I would like to be able to: > run basex from a cli > offer REST > be able to interact with the db via python without using REST (so I can > perform maintenance with it off and maintain separation of duties) > and have all of these actions performed against the same database > > I know client spawns a different instance, so I have no plans to use it. As > far as I can tell, I should be able to do all of this. I can execute basex > and perform operations, I should (haven't tested yet) be able to use python > to communicate via 1984, and I have rest running on 8984. However, I cannot > seem to get REST to recognize the existing database. > > In my set up, the DB created using basex is at /ats/BaseXData. The actual > xml files are at /ats/xml/[folders], and my install of basex is at > /ats/basex. Looking at the web.xml, it originally read WEB-INF/Data as the > dbapth parameter. I have tried /ats/BaseXData, ../../ats/BaseXData, and > other variants without any luck (stopping and starting basexhttp after each > change). I'm guessing this is more of a jetty question, but I don't seem to > get anything useful when looking for information on setting absolute paths > in a web.xml, which is where I think I'm hitting the wall. > > Thank you again! > > Michael Mendez > > > > > > On Tue, Oct 23, 2012 at 7:47 AM, Christian Grün <christian.gruen at gmail.com> > wrote: >> >> Dear Michael, >> >> sorry for the late feedback. Along with BaseX 7.5, several changes >> have been performed in the web application context, so I would like to >> hear if you have already tried our latest snapshot [1], and if the >> problems are resolved with that version. The new version will be >> released pretty soon, which means there will only be minor changes in >> the code. If you are running BaseX as web application, the .basex can >> be safely ignored. >> >> Christian >> >> [1] http://files.basex.org/releases/latest/ >> ___________________________ >> >> On Fri, Oct 19, 2012 at 5:21 PM, Michael Mendez >> <michaelgmendez at gmail.com> wrote: >> > I have an existing install of basex running on a centos machine. The >> > install >> > runs fine, I am able to edit .basex files to point to the main >> > database, >> > and can run the client from anywhere and connect once I make .basex >> > changes. >> > >> > I also have jetty6 running (on the same box) with the basex war package >> > (7.3), which also runs, is accessible, and returns valid rest responses. >> > >> > My issue is the rest response shows no resources available, which as far >> > as >> > I can tell means it is not connecting to my existing database but >> > creating >> > (or created) it's own. Based on the documentation on the site, I have >> > changed the web.xml's dbpath variable to the existing BaseXData path. I >> > have >> > used the same value I used in the .basex files, repackaged the .war, and >> > restarted jetty, with no success. >> > >> > Other changes, like to the index.html in the war, will show, so I know I >> > am >> > rebuilding the war and viewing those changes correctly. >> > >> > What do I need to change to make the servlet of basex see a database >> > folder >> > already available? >> > >> > I have posted this question on stackoverflow as well: >> > >> > http://stackoverflow.com/questions/12976335/basex-servlet-doesnt-see-existing-database >> > >> > Here is my web.xml: >> > >> > >> > <?xml version="1.0" encoding="UTF-8"?> >> > <web-app >> > xmlns="http://java.sun.com/xml/ns/javaee" >> > xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" >> > xsi:schemaLocation="http://java.sun.com/xml/ns/javaee >> > http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" >> > version="2.5"> >> > >> > <display-name>ATS</display-name> >> > <description>REST Services for XML data</description> >> > >> > <!-- The following parameters may also be passed on as system >> > properties: >> > --> >> > >> > <!-- Operation mode: by default, the value is "local": the servlets >> > will >> > work with a local database context. If "server" is specified, a >> > database >> > server instance will be started after the first call of a >> > service. >> > --> >> > <context-param> >> > <param-name>org.basex.mode</param-name> >> > <param-value>local</param-value> >> > </context-param> >> > <context-param> >> > <param-name>org.basex.server</param-name> >> > <param-value>local</param-value> >> > </context-param> >> > >> > <!-- Login data: by default, no user and password is specified, and >> > the >> > credentials must be passed on by the client. Please check by >> > yourself >> > if it is safe to store your credentials in this file. --> >> > <context-param> >> > <param-name>org.basex.user</param-name> >> > <param-value>admin</param-value> >> > </context-param> >> > <context-param> >> > <param-name>org.basex.password</param-name> >> > <param-value>admin</param-value> >> > </context-param> >> > >> > <!-- All database main options, which are usually stored in the .basex >> > configuration file (DBPATH, DEBUG, etc.), can be specified as >> > well by >> > prefixing the key with "org.basex.". If an option references a >> > relative >> > path, it will be prefixed with the servlet root path. >> > <context-param> >> > <param-name>org.basex.dbpath</param-name> >> > <param-value>/ats/BaseXData/</param-value> >> > </context-param> >> > <context-param> >> > <param-name>org.basex.httppath</param-name> >> > <param-value>.</param-value> >> > </context-param> >> > <context-param> >> > <param-name>org.basex.repopath</param-name> >> > <param-value>http</param-value> >> > </context-param> >> > <context-param> >> > <param-name>org.basex.lang</param-name> >> > <param-value>English</param-value> >> > </context-param> >> > <context-param> >> > <param-name>org.basex.debug</param-name> >> > <param-value>true</param-value> >> > </context-param> >> > <param-value>true</param-value> >> > </context-param> >> > --> >> > >> > <!-- REST Service (can be deactivated by removing this entry) --> >> > <servlet> >> > <servlet-name>REST</servlet-name> >> > <servlet-class>org.basex.http.rest.RESTServlet</servlet-class> >> > </servlet> >> > <servlet-mapping> >> > <servlet-name>REST</servlet-name> >> > <url-pattern>/rest/*</url-pattern> >> > </servlet-mapping> >> > </web-app> >> > >> > >> > >> > Thank you for your time! >> > >> > >> > >> > _______________________________________________ >> > BaseX-Talk mailing list >> > BaseX-Talk at mailman.uni-konstanz.de >> > https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk >> > > >
CG
Christian Grün23 Oct 2012 20:28 #
Perfect! Thanks for the confirmation.
Quoted text · Christian Grün · 246 lines
Am 23.10.2012 20:10 schrieb "Michael Mendez" <michaelgmendez at gmail.com>: > That was it - I was still changing the war config instead of the .basex > for the server after changing from 7.3 to 7.5 even though I had started > using the basexhttp server instead. > > Thank you! I really look forward to testing our system with basex, I > expect a vast improvement in speed based on an alpha build I've been > playing with on the windows side. > > Michael Mendez > > > > On Tue, Oct 23, 2012 at 1:07 PM, Christian Grün <christian.gruen at gmail.com > > wrote: > >> Hi Michael, >> >> with 7.5, there are several, alternative options to start the BaseX >> HTTP Server, which are listed at [1]. You either need to deploy the >> WAR file, or run basexhttp. >> >> a) if you deploy the WAR file, your databases will be contained in the >> archived webapp directory. With the latest snapshots, the database >> server will be automatically started along with the web server >> >> b) if you run basexhttp, you can specify DBPATH and the path to the >> webapp directory (WEBPATH) in the .basex configuration file. >> >> Hope this helps, feel free to ask for more, >> Christian >> >> [1] http://docs.basex.org/wiki/Startup#BaseX_HTTP_Server >> ___________________________ >> >> > I am running the 7.5 snapshot now, which has been a bit easier to work >> with, >> > but I still end up stuck in the same place. >> > >> > Ultimately, I would like to be able to: >> > run basex from a cli >> > offer REST >> > be able to interact with the db via python without using REST (so I >> can >> > perform maintenance with it off and maintain separation of duties) >> > and have all of these actions performed against the same database >> > >> > I know client spawns a different instance, so I have no plans to use >> it. As >> > far as I can tell, I should be able to do all of this. I can execute >> basex >> > and perform operations, I should (haven't tested yet) be able to use >> python >> > to communicate via 1984, and I have rest running on 8984. However, I >> cannot >> > seem to get REST to recognize the existing database. >> > >> > In my set up, the DB created using basex is at /ats/BaseXData. The >> actual >> > xml files are at /ats/xml/[folders], and my install of basex is at >> > /ats/basex. Looking at the web.xml, it originally read WEB-INF/Data as >> the >> > dbapth parameter. I have tried /ats/BaseXData, ../../ats/BaseXData, and >> > other variants without any luck (stopping and starting basexhttp after >> each >> > change). I'm guessing this is more of a jetty question, but I don't >> seem to >> > get anything useful when looking for information on setting absolute >> paths >> > in a web.xml, which is where I think I'm hitting the wall. >> > >> > Thank you again! >> > >> > Michael Mendez >> > >> > >> > >> > >> > >> > On Tue, Oct 23, 2012 at 7:47 AM, Christian Grün < >> christian.gruen at gmail.com> >> > wrote: >> >> >> >> Dear Michael, >> >> >> >> sorry for the late feedback. Along with BaseX 7.5, several changes >> >> have been performed in the web application context, so I would like to >> >> hear if you have already tried our latest snapshot [1], and if the >> >> problems are resolved with that version. The new version will be >> >> released pretty soon, which means there will only be minor changes in >> >> the code. If you are running BaseX as web application, the .basex can >> >> be safely ignored. >> >> >> >> Christian >> >> >> >> [1] http://files.basex.org/releases/latest/ >> >> ___________________________ >> >> >> >> On Fri, Oct 19, 2012 at 5:21 PM, Michael Mendez >> >> <michaelgmendez at gmail.com> wrote: >> >> > I have an existing install of basex running on a centos machine. The >> >> > install >> >> > runs fine, I am able to edit .basex files to point to the main >> >> > database, >> >> > and can run the client from anywhere and connect once I make .basex >> >> > changes. >> >> > >> >> > I also have jetty6 running (on the same box) with the basex war >> package >> >> > (7.3), which also runs, is accessible, and returns valid rest >> responses. >> >> > >> >> > My issue is the rest response shows no resources available, which as >> far >> >> > as >> >> > I can tell means it is not connecting to my existing database but >> >> > creating >> >> > (or created) it's own. Based on the documentation on the site, I have >> >> > changed the web.xml's dbpath variable to the existing BaseXData >> path. I >> >> > have >> >> > used the same value I used in the .basex files, repackaged the .war, >> and >> >> > restarted jetty, with no success. >> >> > >> >> > Other changes, like to the index.html in the war, will show, so I >> know I >> >> > am >> >> > rebuilding the war and viewing those changes correctly. >> >> > >> >> > What do I need to change to make the servlet of basex see a database >> >> > folder >> >> > already available? >> >> > >> >> > I have posted this question on stackoverflow as well: >> >> > >> >> > >> http://stackoverflow.com/questions/12976335/basex-servlet-doesnt-see-existing-database >> >> > >> >> > Here is my web.xml: >> >> > >> >> > >> >> > <?xml version="1.0" encoding="UTF-8"?> >> >> > <web-app >> >> > xmlns="http://java.sun.com/xml/ns/javaee" >> >> > xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" >> >> > xsi:schemaLocation="http://java.sun.com/xml/ns/javaee >> >> > http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" >> >> > version="2.5"> >> >> > >> >> > <display-name>ATS</display-name> >> >> > <description>REST Services for XML data</description> >> >> > >> >> > <!-- The following parameters may also be passed on as system >> >> > properties: >> >> > --> >> >> > >> >> > <!-- Operation mode: by default, the value is "local": the servlets >> >> > will >> >> > work with a local database context. If "server" is specified, >> a >> >> > database >> >> > server instance will be started after the first call of a >> >> > service. >> >> > --> >> >> > <context-param> >> >> > <param-name>org.basex.mode</param-name> >> >> > <param-value>local</param-value> >> >> > </context-param> >> >> > <context-param> >> >> > <param-name>org.basex.server</param-name> >> >> > <param-value>local</param-value> >> >> > </context-param> >> >> > >> >> > <!-- Login data: by default, no user and password is specified, and >> >> > the >> >> > credentials must be passed on by the client. Please check by >> >> > yourself >> >> > if it is safe to store your credentials in this file. --> >> >> > <context-param> >> >> > <param-name>org.basex.user</param-name> >> >> > <param-value>admin</param-value> >> >> > </context-param> >> >> > <context-param> >> >> > <param-name>org.basex.password</param-name> >> >> > <param-value>admin</param-value> >> >> > </context-param> >> >> > >> >> > <!-- All database main options, which are usually stored in the >> .basex >> >> > configuration file (DBPATH, DEBUG, etc.), can be specified as >> >> > well by >> >> > prefixing the key with "org.basex.". If an option references a >> >> > relative >> >> > path, it will be prefixed with the servlet root path. >> >> > <context-param> >> >> > <param-name>org.basex.dbpath</param-name> >> >> > <param-value>/ats/BaseXData/</param-value> >> >> > </context-param> >> >> > <context-param> >> >> > <param-name>org.basex.httppath</param-name> >> >> > <param-value>.</param-value> >> >> > </context-param> >> >> > <context-param> >> >> > <param-name>org.basex.repopath</param-name> >> >> > <param-value>http</param-value> >> >> > </context-param> >> >> > <context-param> >> >> > <param-name>org.basex.lang</param-name> >> >> > <param-value>English</param-value> >> >> > </context-param> >> >> > <context-param> >> >> > <param-name>org.basex.debug</param-name> >> >> > <param-value>true</param-value> >> >> > </context-param> >> >> > <param-value>true</param-value> >> >> > </context-param> >> >> > --> >> >> > >> >> > <!-- REST Service (can be deactivated by removing this entry) --> >> >> > <servlet> >> >> > <servlet-name>REST</servlet-name> >> >> > <servlet-class>org.basex.http.rest.RESTServlet</servlet-class> >> >> > </servlet> >> >> > <servlet-mapping> >> >> > <servlet-name>REST</servlet-name> >> >> > <url-pattern>/rest/*</url-pattern> >> >> > </servlet-mapping> >> >> > </web-app> >> >> > >> >> > >> >> > >> >> > Thank you for your time! >> >> > >> >> > >> >> > >> >> > _______________________________________________ >> >> > BaseX-Talk mailing list >> >> > BaseX-Talk at mailman.uni-konstanz.de >> >> > https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk >> >> > >> > >> > >> > >

⚡Generated with XQuery