Installing Solr 3.5 under Tomcat 7

Solr is a open source Enterprise Search Engine. It can be deployed as war file in servlet containers like tomcat or jetty.

This short howto show you run solr with the current Tomcat 7 version:

  1. Download Solr as Zip
  2. Unzip it e.g. in /usr/share/ with folder structure
    1. mv /usr/share
    2. cd /usr/share
    3. unzip
    4. result is a folder /usr/share/apache-solr-3.5.0
  3. Create a new folder e.g /usr/share/solr as base folder for the configuration
    1. cp -a /usr/share/apache-solr-3.5.0/example/solr /usr/share/solr
    2. cp /usr/share/apache-solr-3.5.0/dist/*.war /usr/share/solr
    3. ln -s /usr/share/solr/apache-solr-3.5.0.war /usr/share/solr.war
    4. mkdir /usr/share/solr/data< for index data/li>
    5. mkdir /usr/share/solr/lib for additional jars
    6. cp /usr/share/apache-solr-3.5.0/dist/apache-solr-velocity-3.5.0.jar /usr/share/solr/lib
    7. cp -a /usr/share/apache-solr-3.5.0/contrib/ /usr/share/solr/
    8. nano /usr/share/solr/conf/solrconfig.xml and change the lib settings
    // ...
    1. chown -R tomcat:tomcat /usr/share/solr if tomcat server runs as user tomcat
  4. Add URIEncoding to tomcat connector settings
    1. nano /usr/share/tomcat7/conf/server.xml
    2. search for the connector on port 8080
    3. add the URIEncoding like this:
  5. Create a tomcat configuration file for solr (CATALINA_HOME is /usr/share/tomcat7)
    1. cd /usr/share/tomcat7/conf
    2. mkdir Catalina (if not exists)
    3. cd Catalina
    4. mkdir localhost (if not exists)
    5. cd localhost
    6. nano solr.xml
  6. Paste the following configuration and save the file


  1. Set properties for tomcat and solr inside /usr/share/tomcat7/bin/
  2. Paste the following configuration and save the file
export JAVA_OPTS="$JAVA_OPTS -Dsolr.solr.home=/usr/share/solr"
export JAVA_OPTS="$JAVA_OPTS -Dsolr.velocity.enabled=true"
export JAVA_HOME="/usr/lib/jvm/default-java"
  1. (Re)start tomcat
    1. /etc/init.d/tomcat7 restart
  2. Open browser and go to http://YOUR_SERVER_HOSTNAME:8080/solr/admin/ assuming that tomcat runs under default port 8080

I use the provided sample xml files to see if import and query functionality works:

  1. cd /usr/share/apache-solr-3.5.0/example/exampledocs
  2. nano
  3. change the URL parameter to your environment e.g. to URL=http://localhost:8080/solr/update
  4. ./ *.xml
  5. Open the admin ui under http://YOUR_SERVER_HOSTNAME:8080/solr/admin/
  6. click the search button

see my follow up post for Configuring solr, tomcat 7 with mod_jk and apache 2.2

Using Cargo for Maven War Deployments to Tomcat 6.x

JEE based projects with maven build artifacts like war or ear files is the cargo plugin the right choice for automatic deployments during the build process.

First step is to define in the build section of your pom.xml the cargo plugin:


Notice the variables with the url and the credentials. The will filled with the used profile section for the build:


The activeByDefault settings marks the remote section as default profile if nothing is set by command line parameters.


mvn org.codehaus.cargo:cargo-maven2-plugin:redeploy

you first undeploy the current application and then deploy the new build application to the remote tomcat instance. The command line parameter-Ptomcat6x_ide force maven to use the local tomcat instance for deployments.

mvn -Ptomcat6x_ide org.codehaus.cargo:cargo-maven2-plugin:redeploy

Hudson or Jenkins as continuous integration server can then be setup to use a primary project with the goal “clean deploy” to have a full test and maven repo deployment on success. The seconday project have the goal “clean package org.codehaus.cargo:cargo-maven2-plugin:redeploy -Dmaven.test.skip=true”. Inside the configuration of the primary job is the section with post build actions. Define here the secondary project to be build only on success of the primary build. Deployments can go wrong and should not have any effect on the primary build. Build trigger for the primary project is source code changes checked every minute (“* * * * *” as time plan). Changes by each developer force a complete junit and integration test of the module and new deployed artifacts inside the maven repo like nexus for the rest of the team. A little bit later is then the new application ready to use. With different profiles is it possible to define DEV,QA and PROD target server inside one maven project pom.

Tomcat needs credentials of a user with explicit rights granted for successful remote deployments. See the following excerpt of the tomcat-user.xml inside the conf folder of your tomcat instance:


Centos 6.2 with Firefox 9 and Google Chrome 16

Centos recently published v6.2


Out of the box is Firefox 3.x and no Google Chrome installed.

Steps to install Google Chrome 16 (as root)

Steps to install Firefox 9 (as before as root).

To install the Virtual box Guest Additions:

  1. yum update
  2. yum install gcc
  3. yum install kernel-devel
  4. Mount Guest Additions iso image
  5. Run autostart on the cd
  6. Enter root password
  7. After install reboot vm


Samsung Galaxy S2 with vodafone firmware 2.3.5 and no gps…

I had recently updated my Samsung Galaxy S2 via Kies to Android 2.3.6 with vodafone branding. So far seems to be all working but GPS based Apps fails because of missing satellite fix. Looking around at twitter i found one tweet and with this several forums:

Vodafone UK

Android Hilfe (german)

Vodafone Germany (german): 1 / 2

The short term solution is to install the “GPS Test” app from the market and do the following steps:

  1. Hold the power button  (optional)
  2. Disable data transfer (optional)
  3. Enable GPS
  4. Start GPS Test
  5. Go to settings
  6. Push “Clear AGPS” button
  7. Push “Update AGPS” button
  8. Press home button
  9. Start GPS based app like Google Maps…
Vodafone UK had a seperate topic to notify customers with updates to the problem.
Other solution for vodafone customers is to root their phone, make an debranding and update to latest official firmware without any guarantee. SGS2 without branding seems to be not affected by that bug.
Update 03.12.2011:
Vodafone fixed the bug on server/provider side. Seems to be now working.





Control Hudson or Jenkins from Eclipse Indigo 3.7

For the latest eclipse release 3.7 called indigo is a plugin available to watch and control your build server based on hudson or jenkins. It is part of mylyn 3.5 as a view called “Builds”. See here for more information about the new features of mylyn 3.5. Their is as well a commercial plugin suite called tasktop available.

Howto install:

  1. Go to help -> install new software
  2. Click on “Available software sites”
  3. Click on add with name “mylyn” and url “”
  4. Click ok to go back to site list
  5. Click ok to go back to available software
  6. Choose under “Work with” mylyn
  7. Choose under “Mylyn integrations” the point “Mylyn Builds Connector: Hudson/Jenkins (Incubation)”
  8. Choose under “Mylyn SDKs and Frameworks” the point  “Mylyn Builds (Incubation)”
  9. Click on next
  10. Go through install process and restart eclipse
  11. Choose from menu “Window” -> “show view”
  12. Choose “Mylyn” -> “Builds”
With the blue server icon on the left side of the title bar you can add a new build server. Choose “Hudson” inside the wizard and click next. Enter the url of your jenkins server and enter a label. Click on refresh at the right side under build plans. Choose your favorite builds and click on finish. After that you should have a view similar to the one above. You can start a new build and get updates as notification during the build process.

tech stuff, development news…