The Holy Java

Building the right thing, building it right, fast

Posts Tagged ‘jetty’

Fixed: Embedded Jetty Fails To Unpack With FileNotFoundException: Not a directory

Posted by Jakub Holý on October 4, 2013

I have built an executable .war with an embedded Jetty and all the dependencies packed in using the Maven Shade and War plugins. When I tried to run it (java -jar <my war>.war) then I got a strange FileNotFoundException during the unpack phase. It was strange because the unpack code actually checks whether a file’s parent directory exists and creates it if it doesn’t.

The problem was that I use OS X which has a case-insensitive filesystem. A directory contained both the file LICENSE and the directory license/. When Jetty tried to unpack license/LICENSE.base64.txt, the check for the parent directory (license/) incorrectly succeeded (because it checked new File("[..]/license/LICENSE.base64.txt").getParentFile().exists() and that returned true because the file LICENSE already was there, and it wasn’t distinguished from the actual directory license; .isDirectory() would have at least failed.) The workaround was to exclude the offensive file from the archive:

Read the rest of this entry »

Posted in Languages | Tagged: , , | Comments Off

Jetty-maven-plugin: Running a webapp with a DataSource and security

Posted by Jakub Holý on September 10, 2010

This post describes how to configure the jetty-maven-plugin and the Jetty servlet container to run a web application that uses a data source and requires users to log in, which are the basic requirements of most web applications. I use Jetty in development because it’s fast and easy to work with. Read the rest of this entry »

Posted in j2ee, Languages, Tools | Tagged: , , , , , , | Comments Off