Archive for the ‘Maven’ Category

Set Jetty buffer size (Maven)

March 11th, 2010

Working with large cookies and jetty, you may have faced this error :

2010-03-11 18:18:31.275:WARN::HttpException(413,FULL head,null)

This is because jetty allows only 4ko for HTTP request and response headers. Using large cookies is enough to reach the limit.

(more…)

Fixing Struts2 initialization error on Jetty restart

August 12th, 2009

[ERROR] Error reconfiguring/restarting webapp after change in watched files
Caught exception while loading file struts-default.xml – [unknown location]

Caused by: java.lang.ClassCastException: org.apache.xerces.parsers.XIncludeAwareParserConfiguration cannot be cast to org.apache.xerces.xni.parser.XMLParserConfiguration

This issue seems to only occur with Java 6 and is related to the Xalan version included in this JDK.

Add xalan to your pom or in an endorsed/shared directory and the problem goes away.

<dependency>
<groupId>xalan</groupId>
<artifactId>xalan</artifactId>
<version>2.7.1</version>
</dependency>

More details there : JIRA item.

Fixing ‘could not write file’ issue with Jetty on Windows

June 12th, 2009

Xebia has published a very nice article (Maven, jetty plugin et section mappée – French) explaining how to fix the long-standing locking file issue affecting Jetty / Maven users on Windows.

On this platform, Jetty locks all .js or .css files, making it impossible to change their content while the server is still running. This is a big loss of time because you always have to stop/restart jetty to update one of these files.

Note: this issue does not occur on Linux or Mac OSX so I personnaly don’t really care, but for the ones still running on Windows, the post provides 2 possible fixes :

  • 1 – Changing the connector : this one did not work for us, Jetty was no longer starting (Class not found).
  • 2 – Overriding the defaut web context (webdefault.xml) : it does the trick, Great !

As a result, this is the steps that worked for us :

  • Get webDefault.xml from the jetty jar and add it to your project. Package is org.mortbay.jetty.webapp
  • Change useFileMappedBuffer to false :

    <servlet>
    ...
    <init-param>
    <param-name>useFileMappedBuffer</param-name>
    <param-value>false</param-value>
    </init-param>
    ...
    </servlet>

  • Add this new webDefault.xml to Jetty config :

    ...
    <plugin>
    <groupId>org.mortbay.jetty</groupId>
    <artifactId>maven-jetty-plugin</artifactId>
    <version>6.1.14</version>
    <configuration>
    <webDefaultXml>
    src/main/etc/webdefault.xml
    </webDefaultXml>
    </configuration>
    </plugin>
    ...

  • Restart jetty…. files can be edited. :-)

See original post for additionnal details.

Building RCP plugins or products with Maven2

May 29th, 2009

This is something I never really took the time to try.

At first this seems rather complicated because of the duplication of dependencies in both pom.xml and MANIFEST.MF and because RCP plugins are usually not deployed to maven public repositiories.

Tycho now seems the way to go but I’m looking for advices from my readers.

How do you build RCP products with maven2 ?

Workaround for maven/svn issues on OSX Leopard

December 7th, 2008

–non-interactive flag prevents svn from getting credentials from OSX keystore. As a result you cannot authenticate on password protected svn servers.

Add this script ahead of svn in your classpath and you will be able to use the maven-release-plugin again on Leopard :

#!/bin/sh
if [ "$1" = "--non-interactive" -o "$1" = "--username" ]; then
shift
fi
if [ "$1" = "--non-interactive" -o "$1" = "--username" ]; then
shift
fi
/usr/bin/svn "$@"

Script taken from http://blogs.exist.com/bporter/2008/02/25/working-around-non-interactive-problems-in-leopards-subversion/