lucene-solr-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Erik Hatcher <e...@ehatchersolutions.com>
Subject Re: Simplest way to load a custom RequestHandler in Jetty?
Date Tue, 29 Aug 2006 02:50:47 GMT

On Aug 28, 2006, at 9:25 PM, Chris Hostetter wrote:
> things I've already tried...
>
>   * java -cp .:my.jar -jar start.jar
>   * putting my.jar in the example/lib directory
>   * putting my.jar in the example/ext directory (this has a differnet
>     problem - the jar is loaded before the webapp so it can't resolve
>     dependencies like "SolrRequestHandler")
>   * modifing the jetty.xml to include something like this...
>   <Call name="addWebApplication">
>     <Arg>/hoss</Arg>
>     <Arg>./webapps/solr.war</Arg>
>
>     <Set name="extractWAR">true</Set>
>     <Set name="defaultsDescriptor"><SystemProperty  
> name="jetty.home" default="."/>/etc/webdefault.xml</Set>
>     <Set name="classLoaderJava2Compliant">false</Set>
>     <Call name="addClassPath">
>       <Arg><SystemProperty name="jetty.home" default="."/>my.jar</Arg>
>     </Call>
>   </Call>
>
>   ...i got that last idea from here, based on the timeline, this fix
> should be in the Jetty5.1.11 that we're using, but it doesn't seem  
> to work
> for me.

I don't think Jetty supports hot reload (correct me if I'm wrong).   
You could pull this off with Tomcat though.  I did that kind of stuff  
for lots of Tapestry talks with Tomcat running and setting my IDE to  
compile classes right into WEB-INF/classes, waiting for the context  
to reload and hitting refresh in the browser.

> Has anyone out there gotten Jetty to load their custom  
> RequestHandlers,
> Analyzers, or Similarities? ... even if you haven't do you have any
> suggestions on how to do it cleanly? (ie: without deconstructing  
> the war
> and injecting my jar)

Why not deconstruct the WAR?   Here's how I have my development  
environment (and production too) set up with a little bit of Ant, and  
solr.war checked into our repository as lib/solr.war.  It only takes  
me a few seconds to go from saving a change to a .java file to being  
up and running in Solr:

   <target name="unwar-solr">
     <unwar src="lib/solr.war" dest="${build.dir}/solr"/>
     <copy file="lib/lucene-similarity-2.1-dev.jar" todir="$ 
{build.dir}/solr/WEB-INF/lib"/>
   </target>

   <target name="compile" depends="unwar-solr">
     <mkdir dir="${build.dir}/classes"/>

     <javac
      srcdir="src/java"
      destdir="${build.dir}/classes"
      debug="on">
       <classpath>
         <path refid="classpath"/>
         <pathelement location="${build.dir}/solr/WEB-INF/lib/lucene- 
core-nightly.jar"/>
       </classpath>
       <compilerarg value="-Xlint:unchecked"/>
     </javac>


     <javac
      srcdir="src/solr"
      destdir="${build.dir}/solr/WEB-INF/classes"
      debug="on">
       <classpath>
         <pathelement location="${build.dir}/solr/WEB-INF/lib/classes"/>
         <pathelement location="${build.dir}/solr/WEB-INF/lib/lucene- 
core-nightly.jar"/>
         <pathelement location="lib/lucene-similarity-2.1-dev.jar"/>
       </classpath>
     </javac>
   </target>

   <target name="dist" depends="compile">
     <mkdir dir="${dist.dir}"/>

     <!-- this is our configuration directory -->
     <copy todir="${dist.dir}/solr">
       <fileset dir="solr"/>
     </copy>

     <!-- copy in the stuff just built -->
     <copy todir="${dist.dir}/solr/webapps/solr">
       <fileset dir="${build.dir}/solr"/>
     </copy>
   </target>


Mime
View raw message