Build and run FP in Eclipse
From ETaxonomy
1. Install Java. My Java is:
> java version "1.6.0_20" OpenJDK Runtime Environment (IcedTea6 1.9.8) (6b20-1.9.8-0ubuntu1~10.04.1) OpenJDK 64-Bit Server VM (build 19.0-b09, mixed mode)
However, there is also Sun Java on this machine.
2. Install Tomcat. I installed a user-space version, because Ubuntu's package splits tomcat into two places, and Eclipse's launcher can't cope (at least, my previous Eclipse installation had trouble). I have 6.0.32.
- Ubuntu and others do this to support multiple tomcat's on the same server. The older way is probably OK if you have only one tomcat server. --Bob Morris 15:11, 19 July 2011 (EDT)
3. Install Eclipse. I have Indigo.
4. Install Subclipse from: http://subclipse.tigris.org/update_1.6.x
Install all three packages. Then configure Subclipse to use the SVNKit client rather than JavaHL: Window->Preferences->SVN, SVN interface.
5. Pull the "FP-Network" project from the SourceForge repostory into your Eclipse workspace: File->New->Project... SVN, Checkout Projects from SVN. Repository Location: https://filteredpush.svn.sourceforge.net/svnroot/filteredpush
Expand the "FP-Network" folder. Select "trunk," and click "Finish." This creates a project in your workspace called "FilteredPush."
6. Pull the "FP-Web" project from the SourceForge repository: Use the "trunk" folder under the "FP-Web" folder. This creates a project in your workspace called "FilteredPushWeb."
7. Pull the "FP-WebUI project from the SourceForge repository: Use the "trunk" folder under the "FP-Web" folder. This creates a project in your workspace called "JSF2FilteredPush."
8. Get Solr: http://www.apache.org/dyn/closer.cgi/lucene/solr/
Install the solrj jar somewhere you can reference it. Mine is ~/lib/solrj.jar.
Add that solrj jar to the FilteredPush project's classpath in Eclipse.
9. Edit etc/triage.wsdl line 65 to set the value of attribute "parts" to "data" in the element <soap:body>. FilteredPush should now show now compile.
10. Create a new server config in Eclipse. In the "Server" window, right-click and select "New." Expand the server type "Apache" and select "Tomcat v6.0 Server." Browse to your Tomcat installation directory. Click "Next." Add both FilteredPushWeb and JSF2FilteredPush to the list of configured resources.
11. Configure the JSF2FilteredPush project's build path to edit the locations of the following missing jars (I think you can remove the reference to the primefaces sources jar):
./JSF2FilteredPush/WebContent/WEB-INF/lib/jsf-api-2.0.2-FCS.jar ./JSF2FilteredPush/WebContent/WEB-INF/lib/jsf-impl-2.0.2-FCS.jar ./JSF2FilteredPush/WebContent/WEB-INF/lib/jsp-api.jar ./JSF2FilteredPush/WebContent/WEB-INF/lib/jstl-1.2.jar ./FilteredPushWeb/WebContent/WEB-INF/lib/poi-3.5-FINAL/poi-3.5-FINAL-20090928.jar ./JSF2FilteredPush/WebContent/WEB-INF/lib/primefaces-2.1.jar
At this point there should be no build errors in any of the projects. If there are, try closing the project that still shows errors, and opening it again.
13. Install jax-ws: http://jax-ws.java.net/
I got 2.2.3 and unzipped it to my home directory, there is now a jaxws-ri directory there.
14. Configure Tomcat to use the Java Endorsed Standards Override mechanism: in $CATALINA_HOME, create a directory named "endorsed." Put the two jars jaxws-api.jar and jaxb-api.jar into it (they are in jaxws-ri/lib; don't put any other jars from that dir into the endorsed dir).
You can now run the code with the Eclipse Tomcat launcher. See
http://localhost:8080/jaxws-triage/triageservice?
and
http://localhost:8080/JSF2FilteredPush/
However, the JSF2FilteredPush application assumes a solr service is running somewhere, and we haven't set that up yet.
Setting Up Solr
Now let's set up Solr in Tomcat.
http://wiki.apache.org/solr/SolrTomcat
I'm going to put solr home in my home dir...
~/solr/data
And add to my .bashrc file:
export JAVA_OPTS="$JAVA_OPTS -Dsolr.solr.home=/home/user/solr"
And copy the example solr dir to the solr home:
> cp -r solr/apache-solr-3.3.0/example/solr/* ~/solr/
And put the jar into my tomcat:
> cp solr/apache-solr-3.3.0/dist/apache-solr-3.3.0.war tomcat6/apache-tomcat-6.0.32/webapps/solr.war
Let's start up Tomcat and see if it works.
Yay!
Setting up a MySQL data source to be indexed by Solr
There is a gbifspecimens database on firuta, and one on Zhimin's workstation. I used the one on Zhimin's workstation.
> mysqldump --databases gbifspecimens --tables object raw_occurrence_data --where="1 limit 100" -u user -p > gbif_sample.sql
Set up a MySQL database on your localhost, create a database named "specimens," create a user named "fp_user," and grant that user privilges. Then:
> mysql -u fp_user -p specimens < gbif_sample.sql
There we go. Now let's index it.
Setting up the DataImportHandler for Solr
See See http://wiki.apache.org/solr/DIHQuickStart.
Also see, on firuta, see
/disk03/webtmp/apache-solr-1.4.1/example/solr/conf/solrconfig.xml /disk03/webtmp/apache-solr-1.4.1/example/solr/conf/schema.xml // MAUREEN PUT A SECTION IN HERE ON UPDATING THIS FILE /home/wangzm/data-config.xml
As in the DIH tutorial, I edited solrconfig.xml, with
<str name="config">fp-data-config.xml</str>
Created the file fp-data-config.xml just like Zhimin's; substituted my connection info.
As in the DIH tutorial, I edited solrconfig.xml, with
<str name="config">fp-data-config.xml</str>
Created the file fp-data-config.xml; substituted my connection info.
Have to make the solr home lib dir:
> mkdir ~/solr/lib > cp -i ~/workspace-fp/FilteredPush/lib/mysql-connector-java-5.1.6-bin.jar ~/lib/ > ln -s mysql-connector-java-5.1.6-bin.jar mysql-connector-java.jar > cd ~/solr/lib > ln -s /home/user/lib/mysql-connector-java.jar mysql-connector-java.jar
And to use the Data Import Handler,
> cd ~/lib > cp ../solr/apache-solr-3.3.0/dist/apache-solr-dataimporthandler-3.3.0.jar . > ln -s apache-solr-dataimporthandler-3.3.0.jar apache-solr-dataimporthandler.jar > cd ~/solr/lib > ln -s /home/user/lib/apache-solr-dataimporthandler.jar apache-solr-dataimporthandler.jar
And start up Tomcat and run
http://localhost:8080/solr/dataimport?command=full-import
Dang that was fast.
Update config files to point to new Solr
FilteredPush: src/triageconf.xml line 67
FilteredPushWeb: src/triageconf.xml line 59
JSF2FilteredPush: JavaSource/org/etaxonomy/filteredpush/web/SolrSearch.java line 21