After a couple of failed attempts on my own, Greg gave me some tips on what needs to be done to create a new instance of an exist app within tomcat. Here are my notes of the overall process
1) Get new instance of eXist into tomcat environment
- Get the exist folder from the most recent release (or build it yourself).
- Rename it (e.g. Francotoile21)
- Shutdown tomcat (cd to bin directory, ./shutdown.sh)
- Put Francotoile21 folder into the webapps folder
- startup tomcat (cd to bin directory, ./startup.sh)
- browse to http://localhost:8080/manager, you should see francotoile21 in the list
- browse to http://localhost:8080/francotoile21/index.xml, you should see the default exist home page
2) Get your stuff into the new exist instance
- you'll probably want to clear out all the rubbish that comes with the default exist instance: shutdown tomcat, delete everything but the WEB-INF file in your francotoile21 folder, restart tomcat.
- use the exist Admin client to create the structure for your site and populate it with your files. You can start the client from the exist instance you've just created by browsing to:
http://localhost:8080/francotoile21/webstart/existAdminClient.jnlp
- in the eXist admin client, ensure that permissions on the xql files and folders are rwxr-xr-x, permissions on all other files are rwxr--r-- The owner and group should have the default values (typically admin and dba).
3) If your entire site is in the database (rather than files in the filesystem) you need to redirect requests based on the server name (e.g.localhost:8080/francotoile21) to a specific collection within the database (i.e. so exist knows where to look for your site's files).
- Shutdown tomcat
- In the file tomcat/webapps/francotoile21/WEB-INF/controller-config.xml find this line:
<root pattern=".*" path="/"/>
and modify it to the collection containing the root of your site, e.g.
<root pattern=".*" path="xmldb:exist:///db/site"/>
- Save the file and startup tomcat
You should now be able to browse to a page stored in the new eXist instance within tomcat, e.g.
localhost:8080/francotoile21/search.xql
1. ES met with Pierre for recording, on Friday, May 25. All 8 videos have been edited. 2 have been chosen to go on the site. Transcripts still to be done.
2. The next recording session was supposed to happen on Friday, June 1. However the subject cancelled our meeting. To be rescheduled later in the month (i.e. mid-June 2012).
3. 15 new transcripts have been added to Oxygen. CC has agreed to upload them to the site. To be continued.
After much testing and experimenting, I think I've got the search page working in eXist 2.1 (running under jetty). The newer version of eXist (and/or the lucene extensions) handle default or implicit namespaces differently.
Original code looked something like this:
for $match in $utter//exist:match
let $summary := kwic:get-summary($expanded, $match, <config xmlns="" width="40"/>)
for $line in $summary//self::p
return
The p element is introduced by the kwic:get-summary function, and the question is what namespace that element is deemed to be in. In the older version of eXist, the code above worked. In eXist 2.1, that code returned nothing. I don't know what namespace that p is in, so Martin suggested the wildcard namespace:
for $match in $utter//exist:match
let $summary := kwic:get-summary($expanded, $match, <config xmlns="" width="40"/>)
for $line in $summary//self::*:p
return
and that worked.
I had to work through similar issues with the span elements that kwic embeds within the p element. They too are in some limbo namespace so my code had to include the wildcard namespace selector. In addition, the span outputted to the page included an xmlns="" attribute, and that caused the css to fail to select it.
Original code (worked in eXist 1.4)
for $line in $summary//self::p
let $before := $line/span[@class='previous']
let $match := $line/span[@class='hi']
let $after := $line/span[@class='following']
return
<li>
<a href="player.xql?id={$id}&start={$startTime}" title="{$start}"> {$before} {$match} {$after} </a>
</li>
Modified code (works in eXist 2.1)
for $line in $summary//self::*:p
let $before := $line/*:span[@class='previous']
let $match := $line/*:span[@class='hi']/text()
let $after := $line/*:span[@class='following']
return
<li>
<a href="player.xql?id={$id}&start={$startTime}" title="{$start}"> {$before} <span class="hi">{$match}</span> {$after} </a>
</li>
As the span is coming from the lucence kwic extension, it will be only text, so I don't think explicitly grabbing only the text should cause me any problems, and it allows me to then code in the containing span, which renders properly on the page.
I discovered that I can append an option to the ft query that allows wildcards at the start of the search string. I added a searchClauseOptions variable
let $searchClauseOptions := '<options><leading-wildcard>yes</leading-wildcard></options>'
and then passed that in as an argument to the search clause:
fn:concat('[tei:text/tei:body[ft:query(.,"', $searchterm, '",', $searchClauseOptions, ')]]')
There's a lot of escaping of string delimiters as that search clause itself ends up as a string which is eval'd to generate the results.
The system/config/db/site/data/collection.xconf file controls which lucene analyzer to use when indexing the data collection. It was set to use the WhitespaceAnalyzer. When I changed that to use the StandardAnalyzer instead and re-indexed the files, then the upper-case/lower-case issues went away.
I've done a bit of testing and the change does not seem to have introduced any problems, so I'm going to stick with it.
I also ran across the SnowballAnalyzer, which looks interesting, but I'll postpone investigating that until I get eXist working within Tomcat, as the arrangement with Jetty is annoying - particularly the implications for SVN.
I poked around the log files for a while to see what I could see about the problems launching eXist 2.1 in Tomcat. A guy on the eXist list posted the following in response to me posting the log files showing the errors when I tried to launch exist 2.1 in Tomcat. I haven't yet taken any action on it.
From this [see below] I read that one of exist-db extensions (betterFORM) tries to initialize the SAXON xslt library without success…. a method is missing.
Since the error is not about a missing class, but about a missing java method , I think a different (older or newer) version of saxon.jar is installed.
The solution is….. either to change saxon.jar (endorsed directory or somewhere else) to the version expected by betterFORM (actually bF depends on version 9.2.x.y ; for a newer version the bF code needs to be changed), or to to disable bF in the configuration files [need to check; it is in web.xml I think]
The localhost log includes this:
May 30, 2012 9:20:13 AM org.apache.catalina.core.StandardContext filterStart
SEVERE: Exception starting filter XFormsFilter
javax.servlet.ServletException:
de.betterform.xml.config.XFormsConfigException:
java.lang.reflect.InvocationTargetException
at de.betterform.agent.web.filter.XFormsFilter.init (http://web.filter.XFormsFilter.init)(XFormsFilter.java:71)
and
Caused by: de.betterform.xml.config.XFormsConfigException:
java.lang.reflect.InvocationTargetException
at de.betterform.xml.config.Config.initSingleton(Config.java:135)
Caused by: java.lang.NoSuchMethodError:
net.sf.saxon.sxpath.IndependentContext.setFunctionLibrary(Lnet/sf/saxon/functions/FunctionLibrary;)V
Encountered various problems with the lucene indexing and reporting in Francotoile, so decided to upgrade from eXist 1.5 to 2.1 in hope that improvements to lucene between those two versions would solve the problems.
I am successfully running an eXist instance on
a Mac running OS 10.7.4
java version 1.6.0_31
Java(TM) SE Runtime Environment (build 1.6.0_31-b04-415-11M3635)
apache tomcat 7.0.21
eXist 1.5.0
I tried downloading and running exist-2.1-dev-rev16458 and am unable.
The catalina log says
"org.apache.catalina.core.StandardContext startInternal
SEVERE: Error filterStart"
If I use the tomcat manager to start exist 2.1 I get
"FAIL - Application at context path /exist21 could not be started"
and the same error in the catalina log
I installed a newer version of tomcat (7.0.27) on that same computer and got the same results when I tried to launch eXist 1.5 (worked) and eXist 2.1 (failed), so I don't think that's the issue.
I then went to a Mac running OS 10.6.8
java version 1.6.0_31
JRE build 1.6.0_31-b04-415-10M3646
apache tomcat 7.0.27
I tried to run exist-2.1-dev-rev16458 and that worked, so it appears to be an issue with the JRE or (less likely) the OS on the first Mac.