Adding Log4j library in IzPack Installer

Questions and answers for all installation-related topics for Servoy products

Adding Log4j library in IzPack Installer

Postby erikd » Wed May 30, 2012 5:49 am

Hi, I have just completed our installer using the IzPack project. I can run the installer as a "Java Application" in Eclipse using the "com.izforge.izpack.installer.Installer" as Main class. It ran well and installed the database, app server, and the solution.

However, the problem arises when I try to execute the jar file as a stand-alone file. I saw the problem when I used "java -jar <installer_file>.jar" to start the installer in command prompt. It threw java.lang.NoClassDefFoundError: org/apache/log4j/spi/AppenderAttachable. I did not have this problem when I executed it in debug mode.

Here are my steps in creating the <installer_file>.jar:
1. I have recompiled IzPack using build.xml to include my custom panels and placed the compiled classes in in <path_to_compiled_izpack> folder. - No errors in console.
2. I created the <installer_file>.jar file through "com.izforge.izpack.compiler.Compiler" of the newly compiled IzPack with the following parameters:
"<path_to_config_files>\jar\install.xml"
-b "<path_to_config_files>\jar"
-o "<path_to_config_files>\jar\dist\tsm_7_installer.jar" -h "<path_to_compiled_izpack>\_dist"
- No errors in console.
3. "java -jar <installer_file>.jar" - log4j error in console

How do I include log4j in the IzPack custom panel? I added "<include name="log4j.jar"/>"in "<path id="classpath">" of the build.xml but still threw an error.
erikd
 
Posts: 445
Joined: Wed Aug 11, 2010 2:32 am

Re: Adding Log4j library in IzPack Installer

Postby erikd » Wed May 30, 2012 8:11 am

I already fixed the problem.

I added the following lines of code in the build.xml of IzPack.
<zipfileset src="${basedir}/lib/log4j.jar">
<include name="org/apache/log4j/*.class"/>
<include name="org/apache/log4j/chainsaw/*.class"/>
<include name="org/apache/log4j/config/*.class"/>
<include name="org/apache/log4j/helpers/*.class"/>
<include name="org/apache/log4j/jdbc/*.class"/>
<include name="org/apache/log4j/jmx/*.class"/>
<include name="org/apache/log4j/lf5/*.class"/>
<include name="org/apache/log4j/lf5/config/*.class"/>
<include name="org/apache/log4j/lf5/util/*.class"/>
<include name="org/apache/log4j/lf5/viewer/*.class"/>
<include name="org/apache/log4j/lf5/viewer/categoryexplorer/*.class"/>
<include name="org/apache/log4j/lf5/viewer/configure/*.class"/>
<include name="org/apache/log4j/lf5/viewer/images/*.class"/>
<include name="org/apache/log4j/net/*.class"/>
<include name="org/apache/log4j/nt/*.class"/>
<include name="org/apache/log4j/or/*.class"/>
<include name="org/apache/log4j/or/jms/*.class"/>
<include name="org/apache/log4j/or/sax/*.class"/>
<include name="org/apache/log4j/pattern/*.class"/>
<include name="org/apache/log4j/spi/*.class"/>
<include name="org/apache/log4j/varia/*.class"/>
<include name="org/apache/log4j/xml/*.class"/>
</zipfileset>
erikd
 
Posts: 445
Joined: Wed Aug 11, 2010 2:32 am


Return to Installation

Who is online

Users browsing this forum: No registered users and 5 guests