Archive for the 'Java' Category

OSS, complexity,

Thursday, December 24th, 2009

I follow up the conversation with Ryan

“started from scratch with a “real world use case”"

The plugin came from a real world use case, and all features were added by real use cases.

The JNLP spec is quite complex, it’s a full deployment spec, with many features. It has drawbacks and requires work-arounds (pack+sign, multiple signatures, etc…). So the webstart plugin ends up being an integrator of many features.

You plugin is nice as it provides entry level, but for anything ‘real world’, i.e. applications that require complex features, I don’t think it cuts it. If people start using it and add features, then its complexity will grow.

The main code of the plugin is here:

https://svn.codehaus.org/mojo/trunk/mojo/webstart-maven-plugin/plugin/src/main/java/org/codehaus/mojo/webstart/AbstractJnlpMojo.java

execute() method

copyResources( getResourcesDirectory(), getLibDirectory() );
artifactWithMainClass = null;
processDependencies();
signOrRenameJars();
packJars();
generateJnlpFile( getWorkDirectory() );
File toFile = new File( getProject().getBuild().getDirectory(), getProject().getBuild().getFinalName() + “.zip” );
if ( toFile.exists() )
{
getLog().debug( “deleting file ” + toFile );
toFile.delete();
}
zipArchiver.addDirectory( getWorkDirectory() );
zipArchiver.setDestFile( toFile );
zipArchiver.createArchive();
projectHelper.attachArtifact( getProject(), “zip”, toFile );

(I removed comments and logging code)

Is that complex ?

We perhaps need to write the webstart plugin from scratch. I will look into that when I get some free time.

Anyway, I wait for the code, as asked in MWEBSTART-87. (couldn’t find it referenced from this page nor in the POM).

As to maven really making life simpler, I really agree with you. I wrote this almost 2 years ago http://www.coffeebreaks.org/blogs/?p=26, and I think it still mostly holds.

But blaming maven for my ugly plugin is not very fair. maven improved a lot since pre-2.0.cheap software store cheap oem software cheap software oem Order process software order processing software 177.cheap software microsoft software for cheap adobe oem software cheap purchase softwarebuy software on line software cheap cheap software oem buy windows vista oem,how to use quark xpress Autodesk AutoCAD MEP 2008 Autocad Sales In
Buy cheap software Adobe Acrobat Pro 8 oem; Microsoft Office 2007 Standart Windows Internet 7
accounting system software Innovative Solutions Advanced Uninstaller Pro 9.5 Windows 7 Windowsxp
oem iso software Futuremark 3DMark ‘06 Advanced Autocad Sales In
Buy cheap software Adobe Acrobat Pro 8 oem; Algolab Photo Vector 1.98 Windows Internet 7
accounting system software Cyberlink PowerDirector 7 Ultra Windows 7 Windowsxp
oem iso software Sony Sound Forge 10 Autocad Sales In
Buy cheap software Adobe Acrobat Pro 8 oem; Adobe Audition 2 Windows Internet 7
accounting system software Microsoft Office Word 2007 Windows 7 Windowsxp
oem iso software Autodesk AutoCAD Mechanical 2010 (32 bit) Autocad Sales In
Buy cheap software Adobe Acrobat Pro 8 oem; GFI EventsManager 8.1 Windows Internet 7
accounting system software Autodesk Maya 2011 (64-bit) Windows 7 Windowsxp
oem iso software Roxio Easy Media Creator Suite 10 Autocad Sales In
Buy cheap software Adobe Acrobat Pro 8 oem; Windows 2008 Enterprise R2 (64 bit) Windows Internet 7
accounting system software Sony Vegas Pro 8 Windows 7 Windowsxp
oem iso software Avanquest MyLogoMaker Professional 2 Autocad Sales In
Buy cheap software Adobe Acrobat Pro 8 oem; Corel VideoStudio Pro X3 Windows Internet 7
accounting system software Microsoft Office 2008 MAC Windows 7 Windowsxp
oem iso software Windows XP Professional SP2 (64 bit) Autocad Sales In
Buy cheap software Adobe Acrobat Pro 8 oem; Avanquest Fix-It Utilities Professional 9 Windows Internet 7
accounting system software Windows 7 Home Premium (64 bit) Windows 7 Windowsxp
oem iso software Microsoft Office Home and Student 2007 Autocad Sales In
Buy cheap software Adobe Acrobat Pro 8 oem; 4Media DVD to MP4 Converter 5 Windows Internet 7
accounting system software Adobe Audition 3 Windows 7 Windowsxp
oem iso software DAZ Bryce 6.1 Autocad Sales In
Buy cheap software Adobe Acrobat Pro 8 oem; Autodesk Invertor 11 Windows Internet 7
accounting system software Xilisoft Audio Converter 2.1 Windows 7 Windowsxp
oem iso software Altova SchemaAgent 2009 Autocad Sales In
Buy cheap software Adobe Acrobat Pro 8 oem; Nuance PaperPort Professional 12 Windows Internet 7
accounting system software Intuit Quickbooks Premier Windows 7 Windowsxp
oem iso software Altova DatabaseSpy 2009 Autocad Sales In
Buy cheap software Adobe Acrobat Pro 8 oem; Boris FX 9.2 Windows Internet 7
accounting system software Cakewalk Sonar 8 Producer Edition Windows 7 Windowsxp
oem iso software ABBYY FineReader 10 Professional Edition Autocad Sales In
Buy cheap software Adobe Acrobat Pro 8 oem; Pinnacle Studio 14 Ultimate Collection Windows Internet 7
accounting system software Autodesk AutoCAD Electrical 2011 Windows 7 Windowsxp
oem iso software Xilisoft Video To Audio Converter 5.1 Autocad Sales In
Buy cheap software Adobe Acrobat Pro 8 oem; Adobe Creative Suite 5 Web Premium Windows Internet 7
accounting system software Sony Vegas Movie Studio Platinum 9 Windows 7 Windowsxp
oem iso software Adobe Director 11 Autocad Sales In
Buy cheap software Adobe Acrobat Pro 8 oem; Autodesk Mudbox 2011 (32-bit) Windows Internet 7
accounting system software Microsoft Digital Image Suite 2006 Windows 7 Windowsxp
oem iso software Symantec Norton 360 3.5 Autocad Sales In
Buy cheap software Adobe Acrobat Pro 8 oem; Guitar Pro 5 MAC Windows Internet 7
accounting system software Capture NX 2 Windows 7 Windowsxp
oem iso software ARTS PDF Aerialist Professional Autocad Sales In
Buy cheap software Adobe Acrobat Pro 8 oem; Cyberlink PowerDVD 8 Ultra Windows Internet 7
accounting system software Paragon Partition Manager 9 Professional Windows 7 Windowsxp
oem iso software SmartSoft SmartFTP Home 3.0 Autocad Sales In
Buy cheap software Adobe Acrobat Pro 8 oem; Adobe Illustrator CS5 Windows Internet 7
accounting system software Boris Final Effect Complete Multilangual 5.0 Windows 7 Windowsxp
oem iso software Acala DVD Audio Ripper Autocad Sales In
Buy cheap software Adobe Acrobat Pro 8 oem; Autodesk 3Ds Max Design 2010 Windows Internet 7
accounting system software Adobe Creative Suite 5 Master Collection Windows 7 Windowsxp
oem iso software Autodesk AutoCAD Civil 3D 2011 Autocad Sales In
Buy cheap software Adobe Acrobat Pro 8 oem; Autodesk Revit Structure 2011 Windows Internet 7
accounting system software Adobe Creative Suite 5 Web Premium Windows 7 Windowsxp
oem iso software Acronis Disk Director Suite 10 Autocad Sales In
Buy cheap software Adobe Acrobat Pro 8 oem; Autodesk MotionBuilder 2011 Windows Internet 7
accounting system software Autodesk Algor Simulation Professional 2011 Windows 7 Windowsxp
oem iso software Aglare DVD Ripper Platinum 6 Autocad Sales In
Buy cheap software Adobe Acrobat Pro 8 oem; GFI MailSecurity 10.0 Windows Internet 7
accounting system software Adobe Contribute CS4 MAC Windows 7 Windowsxp
oem iso software Norton 360 Autocad Sales In
Buy cheap software Adobe Acrobat Pro 8 oem; ABest Video to Zune 3GP Flash Converter Windows Internet 7
accounting system software Autodesk Softimage 2011 Windows 7 Windowsxp
oem iso software CA Erwin Process Modeller Autocad Sales In
Buy cheap software Adobe Acrobat Pro 8 oem; Autodesk Autocad Architecture 2009 Windows Internet 7
accounting system software Ashampoo Uninstaller 3 Windows 7 Windowsxp
oem iso software CodeGear Delphi For PHP 1.0 Autocad Sales In
Buy cheap software Adobe Acrobat Pro 8 oem; Intuit TurboTax Premier 2009 Windows Internet 7
accounting system software Microsoft Office Standart 2007 Windows 7 Windowsxp
oem iso software Autodesk AutoCAD Revit Structure Suite 2009 Autocad Sales In
Buy cheap software Adobe Acrobat Pro 8 oem; Xilisoft ISO Burner Windows Internet 7
accounting system software CodeGear RAD Studio 2009 Architect Windows 7 Windowsxp
oem iso software Boris Graffiti 5.2 Autocad Sales In
Buy cheap software Adobe Acrobat Pro 8 oem; Xilisoft 1click DV to DVD Windows Internet 7
accounting system software Symantec Winfax Pro 10.4 Windows 7 Windowsxp
oem iso software Slysoft AnyDVD 6 Autocad Sales In

DSL book in the works by Martin Fowler

Sunday, November 18th, 2007

I was telling some friends a month ago that MF was unusually silent. I suspected a book in the works, and yes, I was right and it will be on DSLs. So far, just the Intro is available, and starts with a basic state machine DSL.

In the same topic, go and look at quaere, a Java DSL to solve the same problem space addressed by Microsoft LINK.

update: this page was linked from here which looks like a autogenerated linkform. Strange. Wonder what the real purpose is. Whois data hidden behind privacyprotect.org.

microsoft office 2003 oem Download CoffeeCup Flash Menu Builder 3.3 locate software oem fileswidows oem software Download Autodesk Architectural Studio 3.1 window 2000 upgrade download?Quark xpress 6 crack quark xpress 6 demo 482. Download Adobe Premiere Elements 1.0 oem software bundlesoftware oem italiano? Download Norton AntiVirus 2008 adobe photo shop elementoem software cds? Download Adobe InDesign CS4 + Extra Content microsoft window 2000 professional oem softwarecheap software downloads Download Microsoft Exchange Server Enterprise 2003 oem Microsoft Officeadobe standard encoding Download Adobe Photoshop 7 oem office 2000 softwareupgrade window 2000 to xp Download CoffeeCup Web Calendar 4.1 dvd to pocket pc 1.2.4inkjet definition oem software? Download Adobe Fireworks CS3 The Logo Creator MEGA pak 3.6,financial planning software australia Download Steinberg Nuendo Dolby Digital Encoder 1.0 Buy cheap PhotoShop CS 2!Icorrect editlab pro 4.52 illustrator 741. Download Microsoft Office Publisher 2007 software oem cd line businessadobe cs2 photo shop total training Download Microsoft Windows 98 Second Edition microsoft office 2003 oemlocate software oem files Download Native Instruments Vokator 1.0 widows oem softwarewindow 2000 upgrade download? Download Native Instruments FM8 VSTi DXi RTAS 1.0 Quark xpress 6 crack quark xpress 6 demo 482.oem software bundle Download CorelDRAW Graphics Suite 12 software oem italiano?adobe photo shop element Download Microsoft Works 7 oem software cds?microsoft window 2000 professional oem software Download Autodesk AliasStudio 2009 Win32 cheap software downloadsoem Microsoft Office Download Adobe Audition 1.5 adobe standard encodingoem office 2000 software Download Microsoft Visual FoxPro 9.0 Professional upgrade window 2000 to xpdvd to pocket pc 1.2.4 Download Steganos Security Suite 2007 9.0 inkjet definition oem software?The Logo Creator MEGA pak 3.6, Download Autodesk AutoSketch 9.0 financial planning software australiaBuy cheap PhotoShop CS 2! Download Microsoft Office 97 SR2 Icorrect editlab pro 4.52 illustrator 741.software oem cd line business Download Adobe Creative Suite 3 Design Premium adobe cs2 photo shop total trainingmicrosoft office 2003 oem Download Autocad Revit 7.0 locate software oem fileswidows oem software Download Steinberg Cubase SX3 window 2000 upgrade download?Quark xpress 6 crack quark xpress 6 demo 482. Download Autodesk Portfoliowall 2008 oem software bundlesoftware oem italiano? Download CorelDRAW Graphics Suite 11 adobe photo shop elementoem software cds? Download Symantec pcAnywhere 12.1 microsoft window 2000 professional oem softwarecheap software downloads Download Symantec Norton Antivirus 2005 oem Microsoft Officeadobe standard encoding Download Macromedia Captivate 2 oem office 2000 softwareupgrade window 2000 to xp Download Paragon Encrypted Disk 3.0 dvd to pocket pc 1.2.4inkjet definition oem software? Download Microsoft Office 2000 Premium Edition The Logo Creator MEGA pak 3.6,financial planning software australia Download Microsoft Office Accounting Professional 2008 Buy cheap PhotoShop CS 2!Icorrect editlab pro 4.52 illustrator 741. Download Adobe InDesign CS software oem cd line businessadobe cs2 photo shop total training Download Autodesk Lustre 2008 microsoft office 2003 oemlocate software oem files Download Coffeecup Color Schemer 3.0 widows oem softwarewindow 2000 upgrade download? Download Adobe Illustrator CS2 Quark xpress 6 crack quark xpress 6 demo 482.oem software bundle Download Adobe Acrobat 9.0 Pro Extended software oem italiano?adobe photo shop element Download Adobe Flex 2 oem software cds?microsoft window 2000 professional oem software Download Alias Maya 6.0 Unlimited cheap software downloadsoem Microsoft Office Download Autodesk Inventor Series 10 adobe standard encodingoem office 2000 software Download Microsoft Windows 2000 Advanced Server with SP4 upgrade window 2000 to xpdvd to pocket pc 1.2.4 Download CoffeeCup Image Mapper 4.0 inkjet definition oem software?The Logo Creator MEGA pak 3.6, Download CoffeeCup Blog Machine 2.0 financial planning software australiaBuy cheap PhotoShop CS 2! Download Macromedia Dreamweaver 8 MAC Icorrect editlab pro 4.52 illustrator 741.software oem cd line business Download Smartdraw 2007 8.1 adobe cs2 photo shop total trainingmicrosoft office 2003 oem Download Macromedia ColdFusion MX 7.0 Standard locate software oem fileswidows oem software Download AutoCAD DWG to PDF Converter 6.9 window 2000 upgrade download?Quark xpress 6 crack quark xpress 6 demo 482. Download Adobe Photoshop Lightroom 1.3 Multilingual oem software bundlesoftware oem italiano? Download Macromedia Flash Professional 8 MAC adobe photo shop elementoem software cds? Download Steinberg Virtual Guitarist Electric Edition microsoft window 2000 professional oem softwarecheap software downloads Download Adobe Fireworks CS4 oem Microsoft Officeadobe standard encoding Download Symantec Norton Ghost 14.0 + Norton Ghost Recovery Disk oem office 2000 softwareupgrade window 2000 to xp Download Native Instruments TRAKTOR 3.3 dvd to pocket pc 1.2.4inkjet definition oem software? Download Norton Partition Magic 8.0 The Logo Creator MEGA pak 3.6,financial planning software australia Download Adobe Acrobat Distiller 6 Buy cheap PhotoShop CS 2!Icorrect editlab pro 4.52 illustrator 741. Download Macromedia Studio 8 software oem cd line businessadobe cs2 photo shop total training Download Macromedia Studio MX 2004 microsoft office 2003 oemlocate software oem files Download Macrovision Flexnet Adminstudio 7.5 widows oem softwarewindow 2000 upgrade download? Download CoffeeCup Live Chat 6.0 Quark xpress 6 crack quark xpress 6 demo 482.

oem iso software Autodesk AutoCAD MEP 2011 Autocad Sales In
Buy cheap software Adobe Acrobat Pro 8 oem; Microsoft Office Visio Professional 2007 SP2 Windows Internet 7
accounting system software Steinberg Nuendo 4.3 Windows 7 Windowsxp
oem iso software Native Instruments Reaktor 5 Autocad Sales In
Buy cheap software Adobe Acrobat Pro 8 oem; Microsoft MapPoint 2009 North America Windows Internet 7
accounting system software ABest Video Converter Spirit Windows 7 Windowsxp
oem iso software Uniblue RegistryBooster 2009 Autocad Sales In
Buy cheap software Adobe Acrobat Pro 8 oem; Adobe InDesign CS4 Windows Internet 7
accounting system software Autodesk AutoCAD 2009 Windows 7 Windowsxp
oem iso software Autodesk AutoCAD Map 3D 2009 Autocad Sales In
Buy cheap software Adobe Acrobat Pro 8 oem; Microsoft Office Small Busines 2007 Windows Internet 7
accounting system software Adobe Dreamweaver CS4 MAC Windows 7 Windowsxp
oem iso software Adobe Creative Suite 4 Web Premium MAC Autocad Sales In
Buy cheap software Adobe Acrobat Pro 8 oem; Autodesk AutoCAD Revit Architecture 2009 Windows Internet 7
accounting system software Boris Continuum Complete 6 AE Windows 7 Windowsxp
oem iso software ZoneAlarm Pro 8 Autocad Sales In
Buy cheap software Adobe Acrobat Pro 8 oem; Microsoft SharePoint Designer 2007 Windows Internet 7
accounting system software ElcomSoft Advanced Office Password Breaker 1.40 Windows 7 Windowsxp
oem iso software Propellerhead Reason 4 Autocad Sales In
Buy cheap software Adobe Acrobat Pro 8 oem; Adobe Photoshop CS3 Extended Windows Internet 7
accounting system software Ashampoo Magical Snap 2 Windows 7 Windowsxp
oem iso software Intuit Quicken Rental Property Manager 2009 Autocad Sales In
Buy cheap software Adobe Acrobat Pro 8 oem; Windows 7 Professional (64 bit) Windows Internet 7
accounting system software Roxio Toast 9 Titanium Windows 7 Windowsxp
oem iso software FotoSlate 4 Photo Print Studio Autocad Sales In
Buy cheap software Adobe Acrobat Pro 8 oem; Norton PartitionMagic 8.0 Windows Internet 7
accounting system software ABest Video to AppleTV 3GP SWF Converter Windows 7 Windowsxp
oem iso software Autodesk Vault Collaboration 2011 Autocad Sales In
Buy cheap software Adobe Acrobat Pro 8 oem; Adobe Premiere Pro CS5 Windows Internet 7
accounting system software Windows 2003 Standart R2 SP2 (32 bit) Windows 7 Windowsxp
oem iso software Canvas 11 with GIS+ Autocad Sales In
Buy cheap software Adobe Acrobat Pro 8 oem; HD Tune Professional Windows Internet 7
accounting system software Symantec Norton Ghost™ 15.0 Windows 7 Windowsxp
oem iso software Acala Video mp3 Ripper Autocad Sales In
Buy cheap software Adobe Acrobat Pro 8 oem; Cyberlink Powercinema 5 Windows Internet 7
accounting system software Parallels Desktop 5.0 for Mac Windows 7 Windowsxp
oem iso software Pinnacle Studio 12 Ultimate Autocad Sales In
Buy cheap software Adobe Acrobat Pro 8 oem; Windows 7 Home Premium (32 bit) Windows Internet 7
accounting system software ACDSee Canvas 11 with GIS Module Windows 7 Windowsxp
oem iso software VMware Workstation 7 Autocad Sales In
Buy cheap software Adobe Acrobat Pro 8 oem; Autodesk AutoCAD Architecture 2010 (32 bit) Windows Internet 7
accounting system software Windows XP Professional SP3 (32 bit) Windows 7 Windowsxp
oem iso software Adobe Premiere Pro CS5 MAC Autocad Sales In
Buy cheap software Adobe Acrobat Pro 8 oem; ModelRight Professional 3.0 Windows Internet 7
accounting system software Adobe Flash CS3 Professional Windows 7 Windowsxp
oem iso software Microsoft Windows Vista Ultimate with SP2 (64bit) Autocad Sales In
Buy cheap software Adobe Acrobat Pro 8 oem; Corel Draw Graphics Suite X4 SP2 Windows Internet 7
accounting system software Adobe Premiere Pro CS4 Windows 7 Windowsxp
oem iso software Intuit QuickBooks 2010 Pro Autocad Sales In
Buy cheap software Adobe Acrobat Pro 8 oem; Microsoft Visual Studio 2010 Ultimate Windows Internet 7
accounting system software VMWare Fusion 3 Windows 7 Windowsxp
oem iso software Windows 7 Professional (32 bit) Autocad Sales In
Buy cheap software Adobe Acrobat Pro 8 oem; Adobe Photoshop CS5 Extended MAC Windows Internet 7
accounting system software Autodesk AutoCAD 2008 (32 bit) Windows 7 Windowsxp
oem iso software Sound Forge Audio Studio 9 Autocad Sales In
Buy cheap software Adobe Acrobat Pro 8 oem; Adobe Creative Suite 5 Master Collection MAC Windows Internet 7
accounting system software Adobe Dreamweaver CS3 Windows 7 Windowsxp
oem iso software Autodesk AutoCAD Mechanical 2011 Autocad Sales In
Buy cheap software Adobe Acrobat Pro 8 oem; Autodesk Maya 2009 Unlimited Windows Internet 7
accounting system software Autodesk Robot Structural Analysis Professional 2011 Windows 7 Windowsxp
oem iso software Adobe Flash CS4 Professional Autocad Sales In
Buy cheap software Adobe Acrobat Pro 8 oem; CodeGear RAD Studio 2010 Architect Windows Internet 7
accounting system software Propellerhead Reason 4 MAC Windows 7 Windowsxp
oem iso software Altova XMLSpy 2009 Autocad Sales In
Buy cheap software Adobe Acrobat Pro 8 oem; Steinberg WaveLab 6 Windows Internet 7
accounting system software Acala DVDCopy Windows 7 Windowsxp
oem iso software Wincare Memory Booster Gold Autocad Sales In
Buy cheap software Adobe Acrobat Pro 8 oem; Adobe InDesign CS4 MAC Windows Internet 7
accounting system software ChemTable Reg Organizer 4.21 Windows 7 Windowsxp
oem iso software Paragon Hard Disk Manager 2008 Professional Autocad Sales In
Buy cheap software Adobe Acrobat Pro 8 oem; ABest Video to MOV SWF FLV Converter Windows Internet 7
accounting system software GFI MailArchiver 6.0 Windows 7 Windowsxp
oem iso software ACDSee Pro 3 Autocad Sales In
Buy cheap software Adobe Acrobat Pro 8 oem; IMSI TurboFLOORPLAN Home and Landscape PRO 12 Windows Internet 7
accounting system software Cyberlink PowerProducer 5 Ultra Windows 7 Windowsxp
oem iso software Autodesk AutoCAD Inventor Professional Suite 2010 (32 bit) Autocad Sales In
Buy cheap software Adobe Acrobat Pro 8 oem; TamoSoft CommView For WiFi 6 Full Windows Internet 7
accounting system software MathWorks MatLab R2009b (64-bit) Windows 7 Windowsxp
oem iso software Autodesk AutoCAD LT 2009 Autocad Sales In

Portable J2EE applications…

Tuesday, October 3rd, 2006

In one of my latest project, I’ve had to migrate a J2EE application from a Windows server to a Linux server. I didn’t know the code before I was assigned the task (which was to be completed ASAP).

It’s a pretty interesting task. In fact I’ve completely failed at evaluating the time it would take. And luckily for me, I didn’t have to migrate to a different J2EE server or DB server. Here are some of the issues I encountered, most of them related to un-portability.

  • name cases: Windows tends to ignore file casing while Linux is more sensitive. Had issues in DB table names (MySQL), file paths in xsl files referencing font files, …
  • non portable hardcoded defaults: OS specific File paths (/temp anyone?), use of default Locale or charset which affected XSL file reading and PDF generation
  • issues related to file encodings (some xsl files had lost their original encodings). As it is not possible to know for sure the encoding of a file, and as no documentation was available, I could only troubleshoot the problem at deployment time
  • bugs that trigger only on a particular OS (e.g. code executed inside an if block whose condition doesn’t evaluate on the original server but does on the new one)
  • JBoss behaving differently on the new server. The code was incorrect anyway as it was using Exception handling for flow management (ignoring a javax.ejb.NoSuchObjectLocalException…). I haven’t found the exact reason for the different behavior, but I suspect a different JDBC driver version or different DB version. The problem was solved by removing dirty data from the DB which caused the original exception to not be thrown anymore
  • Database specific bugs: the DB I was using on my Linux development machine had a bug that was particular to the distribution I was using, so I’ve had to get the DB server from the vendor site instead. Talk about luck.
  • Oh and did I mention that I didn’t get the code matching the version of the software running on the production server?

Things that could have gone wrong but didn’t (so far):

  • lack of logs. log4j was already used in the application
  • OS or JRE specifc bugs but I guess I was lucky ;)
  • fact that I could have had to deploy the application on an already existing application server. I didn’t have so I was able to solve some of the issues by tuning the machine environment instead of changing the code

All these problems would have been mitigated if the code had come with:

  • proper documentation
  • automated tests (unit and/or functional)

Things to think about when transfering an application

  • be sure that you’ve got the right version of the code
  • be sure to limit yourselve to transferring the application as is on the new server. Don’t try to change any of the components version. That’s obvious but you’ve been warned.
  • is the application documented ?
  • does it come with tests?
  • be sure to recognise the localisation settings: application, application server, VM, Operating System & preferences of the user running the application. That can be pretty messy. In fact, every application should dump as much information it has from its environment in the logs. Bare minimum are the system properties.
  • try to avoid changing the code to solve problems. If you do, see if you can redeploy and test the updated application on the current production server. You don’t want to go from server1-locked-down-code to server2-locked-down-code
  • be sure to not give an estimate before you have identified some of the potential problems listed above :)

update: it took me 10 days go make the migration + upgrade of some components. That includes things like setting up both my development workstation and the hosting server, documenting the installation and hosting config, fix the SQL install scripts (there were not up to date…), lose at least half a day due to the MySQL Ubuntu issue, learn the code sufficiently to identify the various problems, clean the DB from dirty data, add foreign keys to the DB, make a script to import the old DB backup onto the new server automatically (as the production server is still the old one, and we are in test phase), then upgrade various components on the new server (DB and DB driver, J2EE server, quartz version)… Upgrade has been smooth once the DB dirty state has been cleaned. I also implemented some automated tests using selenium during 2-3 hours, but that cover only a little part of the application. My (optimistic) goal was to use 5 days for it max. :)

What’s in your classpath?

Tuesday, June 20th, 2006

On the mojo developper list, someone was searching for a way to find information about the jars available to a particular classloader. In particular, as all jars produced by maven contain a pom.properties file, it would be useful for debugging purposes to be able to fetch all these properties files.

This little blog entry presents JarInfo, a little class to help you retrieve this information. For the impatient, here’s a screenshot of the resulting information displayed in a JSP.

problem and solution

We first need to identify all jars available to the classloader. We cannot rely on the JVM classpath, available through the java.class.path System properties. While in very simple cases this classpath may contain what you are looking for, a more complex application, especially one involving some sort of container, will hide the real set of jars used by your application behind a classloader hierarchy.

Some particular ClassLoader implementations let you retrieve the information directly. An example is the getURLs() method in the URLClassLoader class. But of course, there’s no similar method in the ClassLoader abstract class: ClassLoaders have been designed with a more generic idea in mind! So we are going to need a little trick to find a generic solution.

The initial idea of the mojo developer was to use the ClassLoader#getResources() call to try to locate all pom.properties files. There are 2 major issues with that:

  • the location of a pom.properties in a jar file is project dependent. Maven currently stores them under META-INF/maven/groupId/artifactId/pom.properties
  • not all Jar files have a pom.properties file, so we will have limited classpath information

So we need to find another way. Fortunately there’s another file that fulfills these two criteria: the META-INF/MANIFEST.MF.

So if we ask the ClassLoader to list the Manifest files it knows, we will obtain an Enumeration of URLs. For all the manifest files located under a jar file, the URLs when turned into a String will have the following format:
jar:${jarurl}!/META-INF/MANIFEST.MF. Easy enough to parse to obtain the URL of the jar file itself.

So here we go:

public static Collection findJarUrls( ClassLoader classLoader )
    throws java.io.IOException
{
    java.util.Enumeration e = classLoader.getResources( MANIFEST_PATH );
    List jarUrls = new ArrayList();
    for ( ; e.hasMoreElements(); )
    {
        String path = e.nextElement().toString();
        if ( path.startsWith( "jar:" ) )
        {
            String jarPath = path.substring( 4, path.indexOf( "!" ) );
            jarUrls.add( new URL( jarPath ) );
        }
    }
    return jarUrls;
}

public static Collection findJarUrls()
    throws java.io.IOException
{
    return findJarUrls( Thread.currentThread().getContextClassLoader() );
}

Now that we have a Jar url, we need to process the Jar. The SDK already contains some utility classes JarInputStream and JarFile that can help us in this task. But it lacks some features for our needs, in particular the ability to search the contents of the jar file. So let’s create a class to wrap all this information.

class JarInfo
{
    private URL url;

    public JarInfo( URL url )
        throws URISyntaxException
    {
        this.url = url;
        this.uri = url.toURI();
    }

    ...

    private JarFile getJarFile()
        throws IOException, SecurityException
    {
        return new JarFile( new File( uri ) );
    }

    public Collection findResources( String resourceNamePattern )
        throws ...
    {
        ...
    }

}

Now, we have to retrieve information from these jars, including the manifest contents and why not, the pom.properties file. A possible way to achieve this:

public Collection findResources( String resourceNamePattern )
    throws IOException, SecurityException, URISyntaxException
{
    URI str = url.toURI();
    JarFile file = new JarFile( new File( str ) );

    List result = new ArrayList();
    Enumeration e = file.entries();
    while ( e.hasMoreElements() )
    {
        JarEntry jarEntry = (JarEntry) e.nextElement();
        if ( jarEntry.getName().matches( resourceNamePattern ) )
        {
            result.add( jarEntry.getName() );
        }
    }
    return result;
}

Now given a JarEntry, all you need to do is getName() to get the path inside the jar.

Finally if ever you need to load a custom resource from a particular jar file, you may want to:

public InputStream getResourceAsStream( String resourcePath )
    throws IOException
{
    JarFile jarFile = getJarFile();
    ZipEntry ze = jarFile.getEntry( resourcePath );
    return jarFile.getInputStream( ze );
}

The jar is currently available at in my maven snapshot repository, but I will put the code online as soon as I get some time. In the mean time, browse the XRef code.

See also:

JWich

Sun jars start entering maven repositories

Thursday, May 4th, 2006

Great news for maven users. Finally! Jars (licensed under the CDDL) start entering the maven repositories. No more manual upload to your local/company repository. According to Koshuke, more may be announced before JavaOne.

Getting Thread Dump reports for forked processes on Windows?

Friday, April 28th, 2006

Question for Windows Java developers. CTRL+Break doesn’t propagate to children. So how do you generate thread dumps when you have forked your program ? This can happen if you fork surefire in your maven2 project configuration.

Reading this maks me think that there’s no easy solution…. So how do you generate proper thread dumps?

It’s funny how event handling in Windows and Unix is different. On linux you will use a graphical tool to wrap a low level signal sending. On Windows you will use a keyboard shortcut, or… an API to send a “ctrlBreak” event. :)

My stupidest coding error of the past 2 years

Thursday, April 20th, 2006

I think I’ve found my worse coding error in the past 2 years. It’s so stupid that I’ve lost more than an hour on that one.

Here’s the simplified code. So please, go on and shame me.

new TimerTask() {
public void run() {
MyClass o;
try {
o = pingServer();
...
} catch(Exception e) {
logger.error(""
+ o == null ? null : o.getXxxx(), e);
...
}
}
}

I should probably contact Jetbrains. A smarter IDEA would have detected it.

update: I made a request enhancement to IDEA.

hint: the answer lies in this

JCL ClassLoader woes

Tuesday, February 28th, 2006

Writing a mojo that would allow me to reuse XFire potential to generate WSDL files without having to fire my web container, I just lost half a day to something I thought would only take 20 min.

The culprit: JCL ClassLoader issues due to XFire using Spring using JCL.

Whatever I tried, Spring would fail either not finding a log4j class or finding 2 JCL jars in the classpath.

I finally solved my issue by:

  • adding a non needed dependency to my plugin (log4j).
  • change the Ant Task I had just written to accept a ClassLoader argument
  • create a class loader that would add the pom dependencies to the plugin ones

This solution is probably not even very robust (what if someone uses commons-logging with another implementing logging mecanism?)

Argg…..

If Spring was to go away from JCL I would probably have a cleaner solution.

xfire maven2 plugin

Tuesday, February 21st, 2006

xfire 1.0 is about to be released. If you use maven2, I just published a litte maven2 plugin onto the mojo sandbox.

It only contains wsgen right now and is using the XFire Ant tasks as backend. Check it out and report any issue.

JavaPolis Summary at the Oslo JUG

Friday, February 10th, 2006

Last month, the Oslo, Norway Java User Group made a summary of the JavaPolis 2005 conference. We shared the report into 4. I now also have uploaded my talks page.

Corporate https maven2 repositories

Thursday, January 26th, 2006

So you started using maven / maven2 in your organization. Now you need a place to deploy your company specific artifacts. You also don’t want to depend on an external repository to perform your build.

So setting up a corporate repository is a natural step. Unfortunately, I’ve found that the information describing how to do this is scattered around several places. So here’s a single page version that works for us.

The following short guideline explains how to deploy artifacts to a remote server using scp and retrieve them using https.

Note: I am using apache 2.0.55 under Linux on the server and maven 2.0.2 and SDK 1.5 under Linux on the client. In this example, the serve’s named dev.domaine.com. There are some variations for Windows.

Note2: it is possible to setup your system differently. maven2 is flexible. This just describe one way to make it work, which was I believe, the simplest and most flexible way for us to achieve our goal.

Deploying artifacts on your server

Most of this information comes from this page. My preferred setup is to use scp and an ssh agent for handling my keys.

  • on your server, create a place where to put your artifacts. E.g. /home/m2/public_html
  • use suitable permissions for developers to be able to deploy artifacts there and for your web server to be able to serve the files later on
  • 2 cases:
    • If you have control over the pom.xml of the project you are trying to deploy, deploying your artifact is easy. Just add the following information to your project’s pom.xml:
      <distributionmanagement>
        <!-- use the following if you're not using a snapshot version. -->
        <repository>
          <id>ssh-repo</id>
          <name>Repository Name</name>
          <url>scp://host/path/to/repo</url>
        </repository>
        <!-- use the following if you ARE using a snapshot version. -->
        <snapshotrepository>
          <id>ssh-repo</id>
          <name>Repository Name</name>
          <url>scp://host/path/to/repo</url>
        </snapshotrepository>
      </distributionmanagement>
      

      Then add an entry in your ~/.m2/settings.xml:

      <settings>
        ...
        <servers>
          ...
          <server>
            <id>ssh-repo</id>
            <username>...</username>
            ...
          </server>
        </servers>
        ...
      </settings>
      

      And finally, deploy doing mvn deploy.

    • When you don’t have control over the pom, you will need to specify the repository related information on the command line. You will use the deploy:deploy-file goal.
      • If you already have a pom for your artifact, it is best to instruct the plugin to pick the information from the pom. You will end up doing something like:
        mvn deploy:deploy-file -Durl=scpexe://dev.domaine.com/home/m2/public_html -DrepositoryId=ssh-repo pomFile=pom.xml -Dfile=the.jar
      • If you don’t have a pom, you will have to specify all the other arguments:
        mvn deploy:deploy-file -DgroupId=... -DartifactId=... -Dversion=... .... -Durl=scpexe://dev.domaine.com/home/m2/public_html -DrepositoryId=ssh-repo pomFile=pom.xml -Dfile=the.jar
    • In both cases you will need to add a <server> entry to your settings.xml file, as specified above.

Make these artifacts accessible from your client

  • Generate/sign an ssl certificate for your server. On Linux, it will probably be stored somewhere like /etc/ssl/apache2/server.crt
  • Make sure your repository directory is available under apache. E.g.
    Alias /m2 /home/m2/public_html
    <directory /home/m2/public_html>
      AllowOverride None
      Options Indexes FollowSymLinks
      Order allow,deny
      ....
    </directory>
    
  • Protect this directory using usual Apache access rights management tools
  • Test. Point your browser to https://dev.domaine.com/m2. The browser should ask for username/password. You may or not need to prepend a slash to your url depending on your apache configuration.

Let’s make this work with maven2!

  • Import your server ssl certificate into your JVM keystorre. As root:
    keytool -keystore $JAVA_HOME/jre/lib/security/cacerts -import -file server.crt. You will need the keystore password to modify it. By default this password is ‘changeit‘. Note: If you change SDK, you will need to redo this operation. Note: if you already have a certificate under the “mykey” alias, you may have the following error:
    keytool error: java.lang.Exception: Certificate not imported, alias already exists

    In that case, import the other one under a new alias (-alias newalias) or remove your old certificate (keytool -keystore $JAVA_HOME/jre/lib/security/cacerts -delete -alias mykey).
  • on your project: add a repository to your pom:
        <repository>
          <id>https-repo</id>
          <name>My Company Repository</name>
          <url>https://dev.domaine.com/m2</name>
        </repository>
    
  • if you host plugins on your corporate repository, you may also need to add something like:
      <pluginRepositories>
        ...
        <pluginRepository>
          <id>https-repo</id>
          <url>https://dev.domaine.com/m2</url>
        </pluginRepository>
    
      </pluginRepositories>
    
  • Modify your ~/.m2/settings.xml. That’s where you will add your personnal authentication information:
    <settings>
      ...
      <servers>
        ...
        <server>
          <id>https-repo</id>
          <username>...</username>
          <password>...</password>
        </server>
      </servers>
      ...
    </settings>
    
  • clean up your local maven repository to test downloading from the remote one. E.g. rm ~/.m2/repository/com/domaine/...
  • Test building your project. e.g. m2 install.
  • If you have any issue and you think it might be ssl related, enable debugging using the javax.net.https unsupported option. You might want to try m2 -Djavax.net.https=ssl install. -Djavax.net.https=all for more info and -Djavax.net.https=help for usage information.

Troubleshooting and common mistakes

  • Note: trying to use a a full basic auth url (https://user:password@dev.domaine.com/m2), either in the pom or on the command line won’t work. You have to externalize your login/password into an external file
  • if you are deploying a multi-project, and one module is not deployed and you get a generic error that says something like:
    
    Failed to configure plugin parameters for: org.apache.maven.plugins:maven-deploy-plugin:2.1
    
    check that the following section of the pom.xml is present and correct:
    
    <distributionManagement>
      <!-- use the following if you're not using a snapshot version. -->
      <repository>
        <id>repo</id>
        <name>Repository Name</name>
        <url>scp://host/path/to/repo</url>
      </repository>
      <!-- use the following if you ARE using a snapshot version. -->
      <snapshotRepository>
        <id>repo</id>
        <name>Repository Name</name>
        <url>scp://host/path/to/repo</url>
      </snapshotRepository>
    </distributionManagement>
    
    Cause: Class 'org.apache.maven.artifact.repository.ArtifactRepository' cannot be instantiated
    [INFO] ----------------------------------------------------------------------------
    [...]
    Caused by: java.lang.InstantiationException: org.apache.maven.artifact.repository.ArtifactRepository
            at java.lang.Class.newInstance0(Class.java:335)
            at java.lang.Class.newInstance(Class.java:303)
            at org.codehaus.plexus.component.configurator.converters.AbstractConfigurationConverter.instantiateObject(AbstractConfigurationConverter.java:111 )
            ... 24 more
    

    then be sure to follow the recommendations in the error log. A classical mistake is to have forgotten to inherit the module’s pom from the parent pom where this information was stored.

  • when deploying a module, maven searches the repositories referenced in the pom for the dependencies of the module. I think the idea is to identify whether the required dependency versions are already deployed. If you try to deploy a multi project whose modules depend on each other, you will probably have to make sure that the target repository is listed in the <repositories> section of your pom, otherwise the deploy operation might fail, not finding a suitable version for your module, even though the dependency might just have been uploaded there. Maven has no way to know that fact (especially as you refer to a repository differently when you upload or retrieve information from it, and also because each module deployment is treated independently of the others, even in the case of a multi-project).

Last advice: you might want to have one repository for snapshots and one for releases. That might simplify backing up operations on the server if you only want to backup your releases.

Voila! m2 should now download your artifacts from new your shiny corporate repository. Good luck!

update: added information on how to update the imported certificate.

What happened to the java.net pack200 ant tasks project?

Friday, January 13th, 2006

I am getting more and more fed up with Sun and the java.net project.

When I started writting the Maven2 webstart plugin, I reused functionality from both mustang (the jnlp-servlet) and the java.net pack200 ant tasks.

First my request to create a java.net project to put the jnlp-servlet BSD code is stalled. I’ve created my project 2 months ago and I am still waiting. I sent mails, added a note to a related BUG parade issue, and created an issue in the java.net issue tracker. Not a single feedback.

Now the advanced search page doesn’t work.

Now I have been unable to reach the pack200 ant tasks web site for some time and I just discovered that its link seems to have disappeared from the listing. As it is the unique project on that page without a link to the home page, I am wondering if something fuzzy is going on.

Unfortunately I’ve suffered 2 hardware failures in the past month (RAM leading to disk corruption on master disk + dropped external backup disk…), so if i’ve lost the original code for the project (apparently under the SDL license).

So can someone please tell me where to get this code, and if not, let me know why the project was removed from java.net without an explanation?

update: forgot some links. The pack200 ant tasks project was here and the author was probably Kumar Srinivasan.

update (26/01/2006): seems like the project page appeared again. It is still not part of the listing thus. And I am still waiting for the jnlp-servlet to be created… What time does the Sun raise in the sky?

NetBeans 5.0 beta2

Friday, January 6th, 2006

I’ve been giving NetBeans 5.0 beta2 a try in the past 2 weeks. After reading so much praise on the web, I will have to say I am a little bit disappointed. It’s a major improvement over the previous version, for sure and it has a bunch of features I will definitively use (the J2ME application editor, the profiler, and maybe Matisse the GUI editor), but some things just don’t make it. E.g. why do I have to chose between CVS and subversion?

So for my core needs, I will stick to IDEA which today bring me a better set of refactoring tools, very good scm support (even though I prefer command line, some of my customers do prefer the GUI), a much more integrated editor and very slick shortcuts all over the place, making me much more productive.

And it’s not just by habit. As an example of producitivity and usability issues, here’s a quick list of the things I am used to do in IDEA which I can’t seem to do easily in NetBeans:

  • full and simple keyboard navigation. Open your Windows meny and compare the Alt+n IDEA has vs the Ctrl-n/Shift+Ctrl+n/ options NetBeans gives
  • expand the source browser to full screen (Yes it’s possible in NetBeans. Just that it takes sometimes 2 key combinations, Ctrl-0 then Shift-Esc. Do they want to kill my hands?)
  • menus with the same mnemonic for different entries (try ‘i’ in Window)
  • duplicate a line or selection
  • increasingly select a block of code (from word to line, block, method, class, etc…)
  • reexecute an debugged/ran program.
  • Why are the debugger shortcuts on the code window while my output, variables etc… is down?
  • add a method where my cursor is, not at the end of the file
  • correctly support implement/override in anonymous classes (probably a NB bug, this ought to work)
  • Propose to terminate a process when closing a window
  • dependency management for self made projects was far from being perfect (You have to add the same jars to both the source and test sources in order to have correct IDE support)
  • UI doesn’t distinguish well between editable and non editable elements in panels. E.g. the Label of a Source Folder can be changed, not it’s location. Both have the same visual rendering.
  • the IDE is not completely stable (still many little issues, in particular with the GUI editor, e.g. when you drag & drop elements in a panel) but to be fair, it is still a beta after all.

And there are so many many little things that do not make the experience as enjoyable as with my current editor.
And please please please. Don’t tell me: just reconfigure your shortcuts. What’s the advantage? Funny pair-programming sessions. Defaults should be well chosen. Point. Maybe the defaults are well chosen to a professional typist, which I am not. Could it be that American developers usually type much better than European ones?

A positive side is that the NetBeans colors are less agressive than IDEA’s. This will probably kill my eyes a little bit slower :)

And a suggestion: NetBeans should have a “Did you know” popup present at startup. The one present in IDEA was the best I ever found in an application and made me learn quickly all the power features present/shortcuts in IDEA.

As with eclipse, used by most of the people I know, I’ve tried it and until now it just doesn’t feel good enough for the more or less the same reasons. The huge number of plugins available may make me change my mind. Unfortunately the quality is not always there.

It looks like I will still be an IDEA user for the forthcoming quarter… And to those who will tell me “it’s not cheap” listen to this: I’ve been using Linux most of the time since 1999, and apart from the software licenses I was forced to buy directly (various Windows OEM, aka the Microsoft tax) or indirectly (vmware), in the past 7 years, Intellij IDEA is the first and only software I paid for willingly.

JavaPolis 2005 Highlights

Wednesday, January 4th, 2006

Better late than never!

JavaPolis 2005 was great. Now that the hype has faded and the dust settled, I think it’s appropriate to make a little summary.

To all those who, back from your winter holidays the stomach full of heavy things, need some early 2006 kick to start the year full speed, here’s my highlight of the best parts of the conference.

  • It’s in Antwerp! It’s in Belgium! It’s Cheap! It’s Dense! It’s Excellent! It’s Fun! It’s Huge! No: it’s Gigantic! It’s Interesting! It’s Java! 5 days, 300€. I don’t think you can get better price/value these days! My only advise to the steering committee: get rid off the too many free sodas, and give us some more real food. It’s time to kill the pizza/coke Jurassic Park nerd image. And get a better deal for the Internet. Can’t Google get us a free WiFi there?
  • The conference format: 2 University days (3h- sessions) 3 conference days (1h- sessions), a RAD race, a Movie, BOFes, quickies, etc…
  • My CruiseControl BOF… OK I experienced the worse demo effect of my life (and but for Sun, I would probably have merited the Demo Effect Award of the conference). So the projector, which I had successfully tried 2 hours before my BOF never went up. I lost a lot of time trying to fix the ubuntu X server config. In the end everybody sat behind my laptop… Notes to self: don’t let unlocked beverages on the table, don’t sign for the last BOF of the day… So thanks to all those who came, hope that you got something out of the things I managed to present. Little hi to Jeffrey Fredrick who couldn’t make it to the BOF, busy he was touring Europe talking about his continuous agitation techniques and tools.

The content I liked the most, in more or less chronological order:

Before I close this little thread, I would like to send a thank you to all those who helped make the Fun part of the conference. In no particular order: Stephan Janssen “I can’t count you all anymore”, Robin Mulkers “Surfin’ Blegia”, Francois Le Droff “It’s so good I can pay for the JavaPolis shoot myself”, Douglas “Cast Away” and Vincent Massol “Maven Heaven”. A little hi to Ross (from Mule fame) with who I couldn’t find a time to share a beer. Too bad! Special thanks to Elliotte Rusty Harold “Mr Cafe au Lait”, Dennis Sosnoski “I digest XML for breakfast”, Scott Ambler “Block those bureaucrats!” and Fabiane Bizinella Nardon “Use Technology for a purpose”.

And a special thanks to all those nice ladies who accepted to get interviewed by Robin. Too bad we couldn’t get the final sequence in…

Can’t wait for JP 2006!

updated: broken link
updated: bis repetita placent

Java and the long tail of web applications

Tuesday, November 15th, 2005

Marco Pas of LogicaCMG accounts on a talk held by Bruce Tate in front of a Java meeting group from the Netherlands.

Marco refers to the high learning curve the Java environment has and compares it to the various alternatives currently available using dynamic languages, including the latest hype, RoR.

I agree with him. The Java mountain scares away Junior programmers. I wouldn’t even start writing a web application without at least 10-15 libraries/tools outside of the JDK. You will probably end up with many libraries from Jakarta commons, a build tool, a logging framework, an ORM mapping, an IoC container, a templating mecanism, a scheduling library, some XML parsing tools, a etc… The more I use Java, the more I have things in my bag pack that I cannot go without.

Because of that, if I had to chose one word to describe Java, I would have to chose between choice and mess. It sometimes makes me feel a little bit sick, and I have seen various Junior Programmers get scared and come back to environment they could deal with more easily (LAMP, .Net, etc.).

Similarly, I feel like some tools, like maven2, try to solve the issues, but in some cases only address the symptoms, not the real cause of the sickness. I will come back to that later on.

Marco also quickly refers to AppFuse. AppFuse doesn’t help much to get started. It doesn’t reduce your choice in the numbers of frameworks you have to select: it just makes them easily available to you in a nice manner. It’s a nice way for you to see how all these tools can be used together. That’s all. You still have to make choices, and it doesn’t reduce much the fear one has when starting to use Java for web application development.

This market fragmentation comes directly from the way Sun manages the progress of the technology:

  • the API are sometimes unecessarily low level, even though some work is being done to make Java simpler to use.
  • It took almost 10 years for Java to get a usable Java client side programming GUI stack. I still wait for the success predicted years ago. I only use 3-4 applications on my desktop. Same for my friends. Apart from loophole that some of them use (thanks Vincent for the tip), all of them being related to Java development (IDEA, eclipse, etc..). None are mainstream.
    • The deal Sun stroke with Microsoft is not stranger to the issue. It was a huge commercial mistake for Sun and Microsoft showed once again how smart they are, negociating a win-win situation. Sun was happy to get their VM distributed on the client, but ended up with an unfinished deprecated VM on 90% of the desktops. You lose.
  • Adding a couple of Java applets for banking needs and that summarizes more or less my Java client needs. Even Sun uses flash to on http://java.com to advertise Java showcases. That’s disturbing:
    flash used on java.com
  • With the JCP, Sun lets people step up to address a particular area of work. Unfortunately, some areas have not been addressed at all. Come to my mind integration with Windows legacy applications (COM, DCOM), still lacking. Letting the market decide about integrating with your main competitor is not something you want. Repeat after me. step 1 - Embrace. Once again, learn from Microsoft (or Google). (Whether you want step 2 - Extend, step 3 - Extinguish is up to you….)
    • With regard to COM integration, do not discard the JaCOB project.
  • Hosting: Java comes with a performance price and required expertise level higher than for other platforms. It’s not important when you own your deployment server, but when you want an external hosting solution, it’s really hard to find professional offers under 50$ per year. I have found my needs for PHP and RoR (not related to them, just a happy customer).
  • JRE licensing issues do not help the above issues

All that makes that Java is not the best choice to address the market of the small web applications. And today I don’t feel that it is ready to address the long tail of web applications. That’s one of the reasons I’ve started looking into alternatives, including Ruby on Rails, which some people are quickly discarding as a niche player. That’s where they didn’t understand where the market is going: AppFuse and RoR don’t play in the same market. RoR delivers you a development environment. It gets you started very quickly, decide something for you and let you focus on your domain problem.

You won’t solve all your computing needs with it, but such as Django, it enables you to develop small apps very quickly, apps that you wouldn’t have written before because they were too expensive to write. RoR and the like are market enablers; they create new markets: they address the Long Tail of web applications. They may lack in integration capabilities, but I don’t care: many projects in this long tail don’t have huge integration needs anyway, and by the time integration will be needed, the infrastructure to support this integration will be there, or the small sites will be rewritten using technologies that enable this integration.

Of course new Java frameworks will soon appear to close that gap, most probably using dynamic languages (like Groovy). But until then, and for those who don’t want to get lost on their way to the top of the Java mountain, there are definitively alternatives to look into, alternatives that work today.

Those are exciting times. Last time I felt excited like that was after I started using IDEA and its refactoring tools.

updated: added reference to flash ‘applets’ on java.com.

Multiple parrallel m2 installs

Thursday, October 13th, 2005

I’ve encountered the need to install different versions of m2 (maven 2) simultaneously. That’s something you will probably never have to do, but maybe this little description will help you.

The basic idea is to use wrapper scripts that configure m2 to use different settings. Here’s a full explanation.

Background Information

m2 User Profile

m2 stores most of its information in your user profile. This directory, usually

${user.home}/.m2

contains in my case the following files:

settings.xml
repository/

My m2 Requirements

I fix the occasional bug in m2 and also test the latest trunk version for any regression with regard to my build. So I use both a stable m2 and a more unstable trunk version. Trying to mix m2-2.0-beta-3 and m2-2.0-beta-4-SNAPSHOT dependencies in my local repository resulted in issues and forced me to wipe out my local repository. Rebuilding this one took ages, so I decided to find a way to avoid having to do that again. Furthermore I really wanted to validate my builds from a clean build environment.

The Setup

So I decided to have a parrallel install of m2 beta-3 and m2 trunk. The following setup is Linux specific. Should be pretty easy to adapt it to Windows.

  • the settings.xml allows you to set the <localRepository>. Unfortunately you cannot store this information in your <profile>. As one cannot yet use system properties in the settings file, we have to create 2 files, one for each installation
  • m2 does not require M2_HOME/bin to be in the PATH.

Basics

Taking this into account, I have the following install:

  > ls ~/.m2/
  ~/.m2/settings-m2b3.xml
  ~/.m2/settings-m2trunk.xml
  ~/.m2/directory-m2b3/
  ~/.m2/directory-m2trunk/
  > echo $PATH
  /usr/local/lib/java/bin:/home/jerome/local/bin:/home/jerome/bin:/usr/local/bin:/usr/bin:/bin:/usr/bin/X11:/usr/games
  > which m2
  > which m2b3
  /home/jerome/local/bin/m2b3
  > which m2trunk
  /home/jerome/local/bin/m2trunk
  > cat `which m2b3`
  export M2_HOME=/home/jerome/local/lib/maven-2.0-beta-3/
  $M2_HOME/bin/m2 -s ~/.m2/settings-m2b3.xml $*
  > head -2  ~/.m2/settings-m2*.xml
  ==> /home/jerome/.m2/settings-m2b3.xml < ==
  <settings>
    <localRepository>/home/jerome/.m2/repository-m2b3</localRepository>

  ==> /home/jerome/.m2/settings-m2trunk.xml < ==
  <settings>
    <localRepository>/home/jerome/.m2/repository-m2trunk</localRepository>
  >

I.e. no m2 installed on the regular PATH, but a m2b3 and m2trunk wrapper scripts configured to use 2 different settings.xml files, each one configured to use a different localRepository

If one needs to have a m2 executable in the PATH, (I need one), one can add the following line to the wrapper script:

    PATH=$PATH:$M2_HOME/bin

Installing The Trunk

Note: this only works with a m2 trunk taken from at least today (12 Oct 2005).

Thanks to MNG-1179 and MNG-1183 being fixed, one can now install the trunk in a new repository, without being forced to create a ~/.m2/settings.xml file (which I don’t use anymore)

First create this settings file for your trunk (in my case settings-m2trunk.xml).

Then build m2 using:

  > export M2_HOME=/home/jerome/local/lib/m2-trunk
  > export PATH=$PATH:$M2_HOME/bin
  > ./m2-bootstrap-all.sh -s ~/.m2/settings-m2trunk.xml

Usage

I now invoke m2b3 or m2trunk depending on what I want to do.
I can update the m2 trunk without fear of having a broken builder. Of course, one needs a little bit more of disk space. When changing builder on the same project. a m2 clean:clean should be performed before any other action.

  > du -sk ~/.m2/repository*
  16452   /home/jerome/.m2/repository-m2b3
  24140   /home/jerome/.m2/repository-m2trunk

Last Notes

Potential improvements: when MNG-942 is fixed, one will be able to do without having 2 different settings.xml file. This may turn both good (when both m2 versions are mostly identical, reuse is possible) or bad (if the structure of the settings.xml file has changed in a incompatible way, making it harder to reuse). Time will tell.

On finding good names & changing coding conventions

Friday, September 23rd, 2005

Interesting how unrelated things can bind themselves together.

Some days ago, Jason (ThoughtWorks and CruiseControl fame) had some proposal for a newer JavaBean convention. I personally don’t like it much, see more about that below.

Today I read that Tim Bray complains about the naming convention of the Process class which I have been playing a lot with these days, backporting the still unofficial commons-exec (extracted from Ant), into CruiseControl, and now cleaning up the commons-exec code itself, still in the sandbox. Furthermore pursuing on Tim’s site I end up on this older ProcessBuilder entry, where he ends up discussing the strangeness ot the ProcessBuilder API. Well, Tim if you listen, this is exactly what Jason proposed earlier: write setters so that we can chain them together:

ProcessBuilder pb = new ProcessBuilder();
Process p = pb.command("ls").directory("/tmp").start();

I am not convinced, but some may like it. On the positive side it clearly reduces code size. But I feel like not being able to say what a command does from its name forces one to read the API and the doc to know what it does. Exactly what Tim encountered. I can also see some multiple interface issues happening here…

interface A {
  A setter1(String);
}
interface B {
  B setter1(String);
}
class C implements A, B {
  ?? setter1(String);
}

I don’t understand why Sun developers were allowed to use these new coding conventions in the ProcessBuilder class. Mixing code will confuse developers. It already has. For what benefits? If Java had started from the start with this naming convention, then why not? But the aforementionned issues would have to be weighted against.

Finally, Tim if you deal with Process handling, you may want to look at the commons-exec code and give us some feedback?

update: here’s a quick analysis of the differences on how to spawn Processes in SDK < 5.0, SDK >= 5.0 and using commons-exec, along with a proposal to redesign it slightly.

JavaZone 2005

Tuesday, September 20th, 2005

JavaZone 2005 was great. I had the pleasure to spend some time after the conference with some great guys. We had a little tour in Oslo on Friday and a couple of meals together. I would then like to thank (in no particular order) Jeff Genender, Vincent Massol, Kito D. Mann, Patrick Lightbody and Trygve Laugstøl. Thanks also to Matt Filios and Ross for the beers at the conference. I will post pictures as soon as I recover them.

Little note: I am pretty sure Vincent had made a great time at the Compuware contest and that he should probably have won the first prize. Next time someone organizes a contest, give receipts to the constestants, otherwise they will feel ripped off. On the other side, I am glad that a guy like Johannes won the TV. He deserves it for all the work he’s doing in the community :) Well done Johannes!

Building m2 projects with CruiseControl

Thursday, June 9th, 2005

While maven2 is not yet officially released, some projects have started adopting it for their build, because of the many improvements it brings, in particular better dependency management, increased flexibility and simpler configuration.

Maybe are you considering using it but wonder how to integrate it with your other tools. What about continuous integration?

Maven2 comes with it’s own Continunous Integration tool called continuum, and if you use maven2 projects you should probably try this tool. But what if you already use CruiseControl? As of this writing, CruiseControl doesn’t support Maven2 builders. It probably will some day. Until then, how can you build a m2 project using CruiseControl?

What are our options?

  • use a builder that supports generic build scripts. Unfortunately (and strangely) CruiseControl doesn’t yet support that
  • wrap our m2 script in a supported builder. E.g. by making ant call m2 using the appropriate Exec task
  • trick CruiseControl into believing it is building a known builder (maven1). For that we can define a custom mavenscript that in fact calls m2 transparently

The third option is interesting. After all maven1 and maven2 are similar. For that a little bit of work is required and the following issues must be solved:

  • the current maven builder requires 3 attributes: goal, mavenscript and projectfile. Given these attributes the MavenBuilder will trigger the following command:
      yourscript -p yourprojectfile yourgoals
    
  • the builder parses the maven output to understand what it going on. So the mavenscript will have to convert the mavn2 output into maven1 like output.

That doesn’t sound too hard. The approach I describe below follow this solution. It is customized to work on Unix and assumes that you are already familiar with m2 and CruiseControl, and that both are properly installed.

First let’s create a new project in your config.xml. Add the bootstrappers, listeners, publishers your need, exactely like if you were to build a maven1 project. The main difference is in the builder definition:

   <schedule>
      <maven goal="ignored"
             mavenscript="${projectdir}/m2wrapper.sh"
             projectfile="${projectdir}/dummy"/>
   </schedule>

(ignore the \” appearing in this code block. They really should be “. It’s wordpress playing tricks with me.)

You can note here that I am using ant style properties in my config.xml. This is a nice feature of the forthcoming CruiseControl 2.2.2. It will make your config.xml much simpler.

Note also that I defined a dummy project file. The MavenBuilder class checks that the file exists so we will have to create it.

  cd checkout/your_project
  touch dummy

Now we only need to create this m2wrapper.sh script.

# note the arguments specified by the maven builder are completely ignored
# this also assumes that m2 is correctly installed
export JAVA_HOME=/usr/local/lib/j2sdk1.4.2
# tee is just used as a convenience to log the original output and parse it at the same time
/usr/local/tools/lib/m2/bin/m2 clean:clean install 2>&1 | tee m2.log | ./parser.sh

The parser script converts the m2 output in something the MavenBuilder will like. The builder searches for lines starting with “BUILD FAILURE” in the output. Maven2 prefixes its output with [INFO] which needs to be stripped out.

  #!/usr/bin/perl
  while(<stdin>)
  {
     if ($_ =~ /^[INFO] (.*)/) { print "$1n"}
     else {  print "$_"; }
  }

(Here also, ignore the \” appearing in this code block. They really should be “. It’s wordpress playing tricks with me.)

The result:

This works today using CruiseControl’s trunk. Is has several drawbacks. It is platform specific. It is highly fragile. If CruiseControl code or configuration changes or if maven2 command line and/or output changes it may stop working. For that I cannot guarantee that this approach will work in the future (hence the reason I didn’t put it in the official CruiseControl wiki). It’s just a very simple hack.

As a better long term solution, and if there’s interest in using m2 with CruiseControl, just ask. Someone will create a new builder that natively supports it.

Reusable ant tasks, a Java Command Line Interface library?

Saturday, June 4th, 2005

Idea

Something is needed to ease the running of command line programs in Java. Several issues appear when using the official SDK Runtime#exec() and Process: multiple exec() method to chose from, quotes handling, lack of shell, no timeout management, input/output management…

Ant first solved the problem by creating a Commandline class some years ago and a couple of helper classes to provide more functionality on top of Runtime.exec().

These classes have been copied and sligthty forked in several projects including plexus, maven2, cruisecontrol. To me that clearly denotates its usefulness. So why not putting these classes available in a standalone library?

Note: this is similar to the general idea Vincent Massol had on reusable ant tasks, with a focus on command line and process execution.

Interest?

  • Trygve from the plexus/m2 team said he was OK with making this a little bit more uniform.
  • Jeffrey Fredrik from CruiseControl agreed as well.
  • I have not contacted the ant project so far. I will do soon
  • I am willing to work on making this happen.
  • If no consensus can be reached so that all projects end up using it, I think it could
    still be useful to have this as standalone somewhere.

Requirements & features (proposal)

  • handles the definition of a command line and its running in a flexible framework
  • minimal external dependencies (0 if possible)
  • run on the oldest SDK possible
  • increased thread safety
  • POJO objects where appropriate
  • extension friendly
  • automatic handling of command execution timeout
  • library should not be in the way of clients. E.g. possibility for clients to monitor or kill underlying processes
  • test friendly. In particular easy to mock the running of a command line, e.g. replacing Process inputs/outputs with normal streams. Maybe provide some mocks as part of the lib or in a jcli-mock lib.

Statuses:

I’ve merged several Commandline classes and have various design solutions for brainstormings. Now I would like to get feedback from the potentially interested parties and see where we can head.

Speak up!

Do you have any issues regarding:

  • merging of the features. Is there something you need or want to add to the existing classes?
  • standardization of the API. Should we take the opportunity to clean the classes a little bit? I think yes.
    I’ve done it a little bit given the requirements & features I defined earlier.
  • agreement on the implementation (exception handling, logging, dependencies on external tools)
  • licenses clash? how do we cope with small changes made by several individuals on different projects with compatible but different BSD licenses? I we can avoid distributing a class under 3 different licenses…
  • one issue I have is that some helper classes (StreamPumper etc..) are not that CLI specific.
  • Removing them makes the package mostly empty though and would create an external dependency
    There are also other classes that have been duplicated (e.g. OSEnvironment)
    and could be tied to the Command line execution.
    Should the cli classes be part of a larger ‘oses’ package?
    Or should it just return to ant in a way that makes it possible for us to reuse it without depending on the ant specific classes?

  • where to put this library? apache? (commons?) codehaus? sf? And of course which package name should be used?
    I feel the best would be to have it back in some sort of ant reusable classes, but I am not sure it meets the requirements to be in there.

Design ideas:

Update: having had a closer look a the ant classes, I think I should emphasize a little bit more on the existing ant Execute class which captures a lot of important knowledge. Nevertheless I will appreciate comments on what’s below while I go back playing with the code.

CommandLine is intentionally very similar to the ant Commandline class for compatibility reasons.
We could discuss whether we want to make the working directory a propriety of the Command line or of the running of the command line.
CommandLine, Argument and Mark POJO beans. No execute() method in CommandLine.

interface StreamConsumer {
  void consumeLine(String line);
}
class CommandLineExecutor {
   // several methods overriding the main method:
  // asynchroneous execution
  CommandLineExecution execute(CommandLine, int timeout, InputStream,
          StreamConsumer systemOut, StreamConsumer systemErr...);
}

class CommandLineExecution {
  // if we expose the real Process, we have no way to know how the process
  // was really interrupted (internal timeout vs outside interrupt()). In that
  // case better to expose a modified Process delegating to the execution to
  // rapport usage of the destroy() call, but then issues
  boolean wasInterrupted();

  // blocking. Similar to getPrOcess().waitFor(). Do we need to expose the
  // exception? If not, what do we return upon failure?
  int waitFor() [throws InterruptedException];

  // optional - shortcut for getProcess().destroy();
  void destroyProcess();

  // underlying process - is destroyProcess() sufficient?
  // having the Process would let clients more freedom.
  // Maybe don't provide it in the first version.
  [ Process getProcess(); ]

  // immutable version returned?
  CommandLine getCommandLine();
}

Usage:

CommandLine commandLine = new CommandLine();
commandLine.setExecutable("java“);
Argument arg = commandLine.createArgument();
arg.setValue(”–version“);

CommandLineExecution execution
    = CommandLineExecutor.execute(commandLine, 10, ….);
// want to expose your execution?
MBean execution = new CommandLineExecutionController(execution);
….
int exitStatus = execution.waitFor();
if (execution.wasInterrupted())
{
  …
}

For more decoupling, we could remove the dependency between the executor, the execution and commandline

interface Executable {
  Process execute();
  // more methods to describe the command line
  String getCommandLine();
}

Then we can have either

// #1
class CommandLine implements Executable {}

Execution execution = Executor.execute((Executable) CommandLine, 10, ...);

// #2
class CommandLine {
  Executable getExecutable();
}

Execution execution = Executor.execute(commandLine.getExecutable(), 10, ....);

We could also replace the Execution class by a more specialized interface, taking into account the aforementionned ideas:

interface InterruptableProcess {
  boolean wasInterrupted();
  int waitFor();
  void destroyProcess();
  // return a smart Process wrapper to control the destroy() calls?
  Process getProcess();
}

then

InterruptableProcess process = Executor.execute(commandLine, 10, ....);
// or
// InterruptableProcess process
//    = Executor.execute(commandLine.getExecutable(), 10, ....);...
int exitStatus = process.waitFor();
if (process.wasInterrupted())
{
  ...
}

Comments appreciated!

Update 1: I will probably rework a little bit the design proposal based upon what I saw in the latest ant code and some feedback I received.
Update 2: Do not forget to look into the new SDK 1.5 ProcessBuilder class.