powered by Jive Software

Branding Spark using Ant Builder / IzPack and AdvancedInstaller

Hi

After spending hours/days braning spark and building packaging it to an msi all for free (as some alternatives cost money)

I thought I would post how I did it. I will try answer any questions or issues I came across

Hope this is of SOME help, to SOMEONE!

Some how to documents here are old and dated.


Scope:

This document will help you setup a secure and free open source instantmessenger server & client, branded with your own company logos fullycustomisable. The environment of this document is:

Ubuntu 10.04 Server 64Bit VM & Windows 7 32Bit clients.

You will need to install the following free software (details givenbelow)

MySQL / Java RE / Notepad++ / TortoiseSVN / Ant Builder / IzPack /Launch4J / AdvancedInstaller

MySQLSetup

Step 1:** s**udoapt-get install mysql-server

Step 2: JDBC Driver is bundled with Openfire so we don’t need to worryabout it, you need to use the following values later on (ignore for now):

driver: com.mysql.jdbc.Driver

server: jdbc:mysql://[YOUR_HOST]/[DATABASE_NAME]

Step 3: Using MySQL 4.1.18 or later create a db for Openfire Tables

mysqladmincreate [dbname] //creates the database dbname, call yours anything

catopenfire_mysql.sql | mysql [dbname]; //imports the schema file

OpenfireServer Setup

Step 1: Ensuring MySQL is installed, install Java JRE (Java 5 or later,I installed 7)

sudoadd-apt-repository “deb http://archive.canonical.com/ lucid partner”

            sudoapt-get update

sudo apt-get install sun-java7-jre sun-java7-pluginsun-java7-fonts

java –version //To confirm install & Java Version

Step 2: Download Openfire

wget http://www.igniterealtime.org/downloads/download-landing.jsp?file=openfire/openf ire_3_7_1.tar.gz

//This tar.gz does NOT include JAVA JRE so be sureto follow Step 2

Step 3: Extract Openfire to /opt

tar-xzvf openfire_3_0_0.tar.gz
mv openfire /opt

Step 4: Start the Openfire Service

./opt/openfire/bin/openfirestart

Step 5: Launch the Openfire Admin Console to test

http://127.0.0.1:9090 or http://server.name:9090

Step 6: Go through Openfire Server Wizard

Page 1 LanguageSelection

-Select Language

Page 2: ServerSettings

-Domain: server.name

-Admin Console Port: 9090

-Secure Admin Port : 9091

Page 3: DatabaseSettings

-Standard Database Connection

-Database Driver: MySQL

-JDBC Driver Class: com.mysql.jdbc.Driver

-Database URL: jdbc.mysql://localhost:3306/openfire

-Username / Password: Your MySQLUsername & Password

Page 4: ProfileSettings

-DirectoryServer (LDAP)

-**Server Type: **Active Directory

-Host: IP Address of your AD server Port:289

-Administrator DN: uid=Administrator,ou=OU Name,dc=company,dc=local

-Password= AdministratorPassword

//Selectusers for AD to be administrators

//more infoon AD setup: here



Rebrandingof the Spark Client.


For the below example, we are going to rebrand spark and call ourclient “MyMessenger” havingspaces in your Client name can throw up problems later on so it’s easier toleave it out for now. Do not use underscores either.

Step 1: Download TortoiseSVNClient and Notepad++

Step 2 : Download the Source Code of Spark using TortoiseSVN, copy thesource code and create a copy in a folder on your desktop “MyMessenger” – we aregoing to work from here now.

Do NOThave spaces in this folder , this caused me problems later on.

svn cohttp://svn.igniterealtime.org/svn/repos/spark/trunk spark

Step 3: Using Notepad++ open the following files. Find and replace all “Spark”with “MyMessenger”

    1. build\build.xml
      
    1. src\resources\i18n\spark_i18n.properties (for English)
      
    1. src\java\org\jivesoftware\launcher\Installer.java
      
    1. src\java\org\jivesoftware\resource\default.properties (also enteryour server name for the value of HOST_NAME)
      
    1. src\java\org\jivesoftware\resource\spark.properties (also replace"1.0" in "Version 1.0 Release" with the version of Sparkyou're building)
      
    1. src\plugins\fastpath\src\resources\fastpath.properties (also replace"1.0" in "Version 1.0 Release" with the version of Sparkyou're building)
      

Step 4: Using Gimp / Photoshop / Paint.NET etc replace the followingimages – be sure to keep the dimensions, with your own cooperate images.

  1. **1. **spark.gif
  2. **2. **spark.ico
  3. **3. spark_100.jpg **(100 x 100)
  4. **4. **spark-16x16.png
  5. **5. **spark-32x32.png
  6. **6. **spark-60x60.png
  7. **7. **spark-64x64.png
  8. **8. spark.png **(244 x 188)
  9. **9. away.png **(16 x 16)
  10. **10. DoNotDisturb.png **(16 x 16)
  11. **11. **message.icns

Step 5: Install Apache Ant

Follow theinstructions here forthe installation of Ant

The most importantpart is step 4, set environmental variables JAVA_HOME to your Java Enviroment, Set ANT_HOME to the directory you unzipped Ant to. Skipping this stepwill cause Ant not to run correctly. Steps 5&6 I didn’t do.

Step 6: Ok you now have replaced the spark images with your companybranding. We will launch MyMessenger to see how it looks. To do this:

Open command prompt & cd to your build folder:

Desktop\MyMessenger-Code\build>ant release //Launch Ant

Desktop\MyMessenger-Code\target\build\bin>startup.bat //Run MyMessenger

Step 7: Once you’re happy, close MyMessenger & Download and Install izpack and launch4j

Step 8: Make the following changes to \build\build.xml

<propertyname=“installer.izpack.dir” value**=“c:\ProgramFiles\IzPack”**/>

            <propertyname="launch4j.dir" location=**"c:\\ProgramFiles\\Launch4j" **/>

Step 9: Now compile and create your exe file

From\MyMessenger\Build type the following:

MyMessenger\build>antinstaller.izpack

Yourcode should compile giving the final message “Build Successful”

Remember if your folder name is MyMessenger or My_Messenger it won’tcompile.

You will notice now you have two newfolders. \MyMessenger\Installer which contains your jar file and\MyMessenger\target which is your main folder containing your exe file \pluggins

Your executable file is located in \MyMessenger\target\build. //starter.exe is needed, don’t delete

You will also notice your newly compiled exe is called Spark.exe, letschange this

Step 10: Changing compiler to makeMyMessenger.exe

For me this was very trialand error, but my advice would be – make a change, run ant installer.izpack andbe sure it says “Build Successful” then make another etc…

In\MyMessenger\build\build.xml Ctrl&F and locate “Installer Ant Script”

Rename thefollowing from Spark to MyMessenger

installer.app_name

            installer.app_short_name

installer.product_name

In \MyMessenger\build\installer\izpack\launch4j.xmlchange the following lines:

C:\Users\xxxxxx\Desktop\MyMessenger/target/build//MyMessenger**.**exe

MyMessenger

MyMessenger

http://www.yourcompany.com

2.6.0.0

<txtProductVersion>2.6.0</txtProductVersion>

<productName>MyMessenger</productName>

<companyName>Company Name - You</companyName>

<internalName> MyMessenger </internalName>

<originalFilename> MyMessenger.exe</originalFilename>

You can change more but I THINK these are the basics for now. Run antinstaller.izpack again.

Step 11: Default Properties

This file is very important.From here you can customize what users can and cannot do. It is very wellcommented and self-explained. For example, I have hardcoded in HOST_NAME anddisabled it to be changed. This way the user doesn’t have to enter the host.Many changes are available.

\MyMessenger\src\java\org\jivesoftware\resource\default.properties

I have also black listed the OTR (Off the Record) pluggin, that allowsencrypted off the record chats:

PLUGIN_BLACKLIST_CLASS = org.jivesoftware.spark.otrplug.OTRPlugin

From here we can also remove buttons that aren’tneeded in a cooperate setting. Such as creating accounts etc.

EXAMPLE ERRORS:

Build Failed:

C:\Users…**build.xml868:**com.izforge.izpack.compiler.CompilerException:….C:\Users…/build/installer/spark-izpack.xml:76

The Errors can often be frustrating but the compiler points you in theright direction, in the above example, if you go to spark-izpack.xml and go to line 76, I still had spark.exe referenced ratherthan MyMessenger.exe

FinalStep: Package MSI for deployment


Let’s package up our exe and build files and create an msi fordeployment.

Download AdvancedInstaller

Advanced installer is free to create basic msi files. So lets createNEW – Installer – Simple

-Product Details: Enter as much information here as you require

-Install Parameters: Application Folder: [ProgramFilesFolder][ProductName]and the same under Application Shortcut Folder

-Files & folders : Application Folder – Right Click – Add Folderand add the \MyMessenger\target folder. Select the entire Target folder as youneed the plugins etc.

-Application Shortcut Folder: Select Application Shortcut Folder – right clickwhitespace on right pane – New Shortcut to – Installed File – Select yourMyMessenger.exe file.

-Desktop – same step as above. This will create a shortcut toMyMessenger on the desktop for the users.

Everything else is fine as is. Save As in MyMessenger Folder

Select Build – once built go to \MyMessenger\Project –SetupFile whereyou will find your msi ready to deploy.

Good Luck!

3 Likes

Thanks MJMC for a very detail post. I came up to step 9 but stuck there. :frowning:

I have my folder as TALK and when it go to TALK\Build and type the step 9 command I get a path not found

Once I’m in that folder …\TALK\Build> what exactly should I type?

Also when it comes to step 8 is there a specific location I need to place the below lines?

<propertyname=“installer.izpack.dir” value=“C:\Program Files\IzPack” />

<propertyname=“launch4j.dir” location=“C:\Program Files (x86)\Launch4j” />

Not a programing guy any help and advice will be greatly appreciated.

Thank you!

Hi Chaniska

Sorry for the delay in replying, I never got an email alert to say there was a reply to this thread

Let me know if you still need help?

Step 9 type - antinstaller.izpack

I got the packaged build and all are working but 2 issues.

One when i select the Launch on startup in the preference menu;

it write the registry with a extra blank see below.

EX: C:\Program Files (x86)\Chat**.**Chat.exe

cant find where that extra **.** coming from

Second issue is when a user try to excit it gives and error in the main windows saying Connection to server lost and just hangs there for a long time.

when i checked the logs it says Startup jar is not packed in file. But when i run using target\bin\startup it works all great.

Any help? thanks

Got an email this time to say you’d replied

Ok the start up on launch thing I’m currently looking at too: http://community.igniterealtime.org/thread/49016

I have see the startup jar error but can’t think off the top of my head,

I’m up to my eyes with work today so i’ll get back to you tomorrow try help as best as I can

How did you find the guide in general? I spent weeks trying to brand spark, hopefully it took some of that pain away for you.

Same here i went all over and did lot of trial and errors till I found ur post.

This was the most helpful post and all information under one roof thank for taking time to put this together.

Btw, Additional question. I’m using the embedded DB and can it handle around 80-150 clients at same time?

Hi

Do you still need help, is it exiting ok for you?

Also I use a MySQL DB so not sure about the embedded db, there’s documentation on the site about how many users it can handle.

Still need help

OK

I don’t think this is an issue with the branding etc but can you answer these:

1 - How many concurrent users do you have logged in

2 - How much Java Memory is used?

3 - Can you post the logs?

4 - Can you install the normal version of spark (non branded) and see can you exit?

  1. Currently only few test users around 6-10

  2. Its using around 103000k as for task manager (showing underthe custom application name)

  3. Logs from client or server?

  4. when normal version installed no issue and when logout the new instance comeup without an issue.

Thanks for the reply,

2- Java Memory from the Server not from the Client cheers

What’s the exact error message, also log from the client please cheers

  1. Java memory as in Openfire service is using similar amount

on client below is the main error i see

Feb 05, 2013 7:54:19 AM org.jivesoftware.spark.util.log.Log error

SEVERE: The startup class is not packaged in a jar file

Feb 05, 2013 8:24:07 AM org.jivesoftware.spark.util.log.Log error

SEVERE: Error Setting JTattoo

java.lang.ClassNotFoundException: com.jtattoo.plaf.luna.LunaLookAndFeel

at java.net.URLClassLoader$1.run(Unknown Source)

at java.net.URLClassLoader$1.run(Unknown Source)

at java.security.AccessController.doPrivileged(Native Method)

at java.net.URLClassLoader.findClass(Unknown Source)

at java.lang.ClassLoader.loadClass(Unknown Source)

at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)

at java.lang.ClassLoader.loadClass(Unknown Source)

at org.jivesoftware.Spark.loadLookAndFeel(Spark.java:285)

at org.jivesoftware.Spark.startup(Spark.java:177)

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)

at java.lang.reflect.Method.invoke(Unknown Source)

at org.jivesoftware.launcher.Startup.start(Startup.java:94)

at org.jivesoftware.launcher.Startup.main(Startup.java:44)

When i click on logout i get the below error on client windows then it get stuck and have to move it manully or click on exit.

I’ve never seen that error before - but I have seen it posted here several times, if you do a search for “your connection was closed due to an error”

Do a search of the several threads a few have some good troubleshooting steps.

The look and feel error comes since MAY BE cause i’m doing the testing on a Window 2008 environment.

I’m more worried about this below;

Feb 05, 2013 7:54:19 AM org.jivesoftware.spark.util.log.Log error

SEVERE: The startup class is not packaged in a jar file

will search and see will give it a shot tomorrow and if successful will let you know.

I think it’s something to do with the starter.exe, you need to include that when you are building your package

Final Step of the Advance Launcher from the guide:

-Files & folders : Application Folder – Right Click – Add Folderand add the \MyMessenger\target folder. Select the entire Target folder as youneed the plugins etc.

Last step i sued Inno Setup to build the package will try with advance installer also and try

Not sure I get what you mean, but the last step, you need everything from that Target folder, least to my knowledge you do

Otherwise pluggins etc wont work

Anyway - hope time so let me know tomorrow how it goes, good luck

What i ment was without using advance installer to build the MSI package i used “Inno Setup 5” to build it.

Sorry I can’t be any more help then if you didn’t use the guide

I used the advanced installer to build the final package and it sorted most of the issues like adding to startup and etc but i still get that connection issue when a user click on logout. aw i will keep looking for a solution.

Thanks,