[izpack-users] ClassCastException with custom listeners

Steve Dodge steve at robododge.com
Mon May 21 17:40:49 CEST 2007


I've built a compile listener and an installer listener.  Using  
IzPack 3.10.1.   The compile listener added a filename to the of a  
Velocity template to the additionalData map.  The Installer listener  
checks during afterFile() if the name of the file matches a Velocity  
template, and applies the template if so.  I am also using the  
standalone-compiler.jar. My install.xml has the following.

   <listeners>
    <listener
       compiler="nm.trw.utils.listener.CompileListener"
       installer="nm.trw.utils.listener.VelocityListener"
       jar="lib/tekPackListeners.jar"
       />

    <listener installer="AntActionInstallerListener"
               uninstaller="AntActionUninstallerListener"/>
    </listeners>

Using debug output, I verify the compile listener is being called  
correctly during compile time as it searches for <addititionalData>  
tags within the <fileset> and parses the data correctly.
During install, when the install panel is showing the progress bar, I  
get the following exception:

java.lang.ClassCastException: nm.trw.utils.listener.CompileListener
         at com.izforge.izpack.installer.Unpacker.getCustomActions 
(Unpacker.java:1139)
         at com.izforge.izpack.installer.Unpacker.run(Unpacker.java:295)
         at java.lang.Thread.run(Thread.java:613)

Looking at the code for Unpacker, it seems the CompileListener was  
improperly placed in the collection of InstallerListeners, thus  
ClassCastException.

Here are the <jars> that I had to add to make it work.
<jar src="lib/tekPackListeners.jar"/>
<jar src="lib/izevent-3.10.1.jar"/>
<jar src="lib/compiler-3.10.1.jar"/><!-- this one has to be here,  
izevent isn't enough,  otherwise ClassNotFoundException for  
CompilerListener interface
<jar src="lib/ant-1.6.5.jar"/>
<jar src="lib/ant-launcher-1.6.5.jar"/>
<jar src="lib/velocity-1.5.jar"/>

I think I'm missing something in the installation here.

Thanks,
Steve






Am I missing something in the setup here?  I cannot figure out how  
CompileListener makes it way into the






More information about the izpack-users mailing list