Maven, Forms Workflows and DSC’s

maven-logo-black-on-whiteFound this gem while I was converting an old Ant-based DSC project to a Maven build.

LiveCycle Maven Plugin

It gives you a Maven plugin to control a bunch of features in LiveCycle / Forms Workflows in the Maven build such as:

  • Configuration of LiveCycle / Forms Workflows services
  • Deploying DSC’s
  • Deploying LCA’s
  • Generating component.xml files
Advertisements

AEM Forms Workflows

Adobe_Experience_Manager_logo_SCREEN_RGB_128pxSince Adobe have moved on and deprecated all things named LiveCycle, I figured I should do the same. Those of us who have worked with LiveCycle knows it still looks and smells like LiveCycle, but has a shiny new icon and a new name1: AEM Forms Workflows. Which is a lot better than their previous effort at renaming the product2.

There’s no point changing the URL, but the site will be updated to include AEM Forms in the title as well so people can find it.

I have quite a bit to share on the new product and a lot of it is in flux or in snapshot builds I have of the product, so I will post up the generic hacks and workarounds that apply to GA versions of the product going forward plus some other cool stuff that brings LiveCycle AEM Forms into the new era of Adobe’s Enterprise Marketing platform.

1Ok… its not really new, I’ve just been slack busy working on AEM Forms projects
2 Adobe Digital Enterprise Platform – Adobe’s short-lived and much maligned name change for LiveCycle. Was renamed to LiveCycle ES3 after the horror of what they had done dawned on them. AEM Forms Workflows is still not great, but acceptable with the integration with AEM.

Removing HPROF dump files

LC_bugRevisiting the topic of Livecycle consuming everything in its path, I found another issue that features in Livecycle ES4 SP1. The symptoms are the usual symptoms; lack of disk space, server crashing, etc. After hunting down all of the extra large files in your system you might find a number of very large files in the following path:

[livecycle_install_dir]/crx-repository/launchpad/felix/bundle33/dumps

HPROF Files

Heap dump off

To turn this feature off, do the following:

  1. Browse to the AEM system console: http://host:port/lc/system/console
  2. Locate the bundle
    org.apache.felix.webconsole.plugins.memoryusage
  3. Stop the bundle

You can then stop Livecycle, delete the HPROF files and restart Livecycle. The bundle should not restart, but its worth checking anyway.

Configuring secure email endpoints in Livecycle

LC LogoA client of ours recently had issues configuring their Livecycle ES4 server to use SSL for an IMAP email endpoint. Turns out it wasn’t as straightforward as the Adobe documentation makes out. In particular, it doesn’t specify where the cacerts file was in their distribution. So I thought I would run through the process in a bit more detail here.

 cacerts?

cacerts is a truststore file that is found in the Java distribution that is used by the Livecycle application server. It contains certificate references for well-known certifying authorities such as VeriSign™.  A trust store is used by the Java Virtual Machine (JVM) to authenticate peers during secure communications over a network connection.

Usually finding the cacerts file is not a problem, unless you install the Turnkey edition of Livecycle. And especially if you have upgraded from ES4 to SP1. I just searched my local Livecycle ES4 SP1 distribution and it contained 5 different cacerts files! So how do you find which one you need?

In Windows, just open the System Properties > Advanced Tab > Environment Variables and look for Adobe_JAVA_HOME variable under the System Variables list. If you double-click to open it up, it will point to a JDK version (e.g. C:\Adobe LiveCycle ES4\Java\jdk1.7.0_25). From there, just look under /jre/lib/security and you should see the caerts file.

System Properties (Click for bigger image)

Mail server certificate file

Once you locate the cacerts file, you then need your client certificate to import into the trust store file. If it is a local certificate (for example, from your internal corporate network), you can use the following method to extract the CER file required. (Note: most corporate email servers will have a Web Mail client that you can browse to over HTTPS)

1. Connect to your Corporate Web Mail portal and view the certificate details (I’m using Gmail as an example here)

Cert_1 (Click for bigger image)

2. Click View certificates > Details Tab > Copy To file

Cert_2 (Click for bigger image)

3. Now Save the file somewhere as a Base-64 encoded X.509 CER file

Cert_3 (Click for bigger image)

Cert_4 (Click for bigger image)

Cert_5 (Click for bigger image)

Cert_6 (Click for bigger image)

Finish off

Now just follow the steps as outlined in the Adobe help page: http://help.adobe.com/en_US/livecycle/11.0/AdminHelp/WS92d06802c76abadb-5145d5d12905ce07e7-7edc.2.html

However, for step #3 use something similar to the following example for Livecycle ES4 SP1 Turnkey (assumes ES4 is installed in C:\Adobe) and once it is imported, you should be good to go (i.e. no restart required)

C:\Adobe\Adobe LiveCycle ES4\Java\jdk1.7.0_25\bin\keytool –import –file C:\Adobe\MyCert.cer -keystore C:\Adobe\Adobe LiveCycle ES4\Java\jdk1.7.0_25\jre\lib\security\cacerts

AEM 6.0 Released

Code Monkey

At the end of last week, AEM 6.0 was finally released. As both a LiveCycle and AEM developer this is very interesting news for me, since LiveCycle is being merged into the AEM product suite, under AEM Forms. This also includes Adaptive Forms – forms with a responsive design and a host of other cool features.

Here are some links where you can find more information on AEM 6.0:

AEM 6.0 Release Notes

AEM 6.0 Documentation

Sightly – The New AEM 6 Templating Language

Introduction to AEM Forms

AEM Forms Help

AEM Forms Forums

There’s a lot more information out there, but this is some good reading to get started.

View original post

Changing default server ports in Livecycle ES4 JBoss

JBoss Livecycle ES4 JBoss (including Turnkey) changed the underlying application server to JBoss EAP 5.1.0 and later to 5.2.0 in the SP1 release. This changed the way you alter the port vales for various services. Instead of looking in various different places for the port values, they amalgamated them all into one central configuration file.

The file is located in [server]/conf/bindingservice.beans/META-INF/bindings-jboss-beans.xml

Mastertheboss has a great page about the new Jboss port configuration for JBoss EAP 5.1+ – check it out!

 

Calculating Task Reminder, Escalation or Deadline days

Process Manager IconI recently had to set some reminders based on an actual time of the day (e.g. Midnight tonight and 12pm again tomorrow). This sounded easy until you realise that the Task Date object (the object used by Reminder, Escalation and Deadline) is not a Calendar or Date object, but a number of Days, Hours and Minutes until the Reminder was due. Awesome.

Below is an adaptation of a nice date calculation script from TechnoJeeves that allows you to calculate the number of days, hours and minutes between a certain date and time and transpose that into a Task Reminder object that Livecycle Process Manager can understand. You can also feed in a particular date string from a process variable and parse that if you want.

My example shows how to calculate the Hours and Minutes until midnight tonight (or tomorrow to be exact). There will never be any days involved as midnight is always less than 24 hours away.

Execute that script

To do this, you will need to create a Task Reminder variable called taskReminder.

This is the BeanShell script from my executeScript activity:

import java.util.Calendar;
import java.util.Date;
import java.util.GregorianCalendar;
import java.util.TimeZone;

/**
 * Calculate the absolute difference between two Date without
 * regard for time offsets
 *
 * @param d1 Date one
 * @param d2 Date two
 * @return The fields day, hour, minute, second and millisecond
 */
long[] getTimeDifference(Date d1, Date d2) {
        long[] result = new long[5];
        Calendar cal = Calendar.getInstance();
        cal.setTimeZone(TimeZone.getTimeZone("UTC"));
        cal.setTime(d1);

        long t1 = cal.getTimeInMillis();
        cal.setTime(d2);

        long diff = Math.abs(cal.getTimeInMillis() - t1);
        final int ONE_DAY = 1000 * 60 * 60 * 24;
        final int ONE_HOUR = ONE_DAY / 24;
        final int ONE_MINUTE = ONE_HOUR / 60;
        final int ONE_SECOND = ONE_MINUTE / 60;

        long d = diff / ONE_DAY;
        diff %= ONE_DAY;

        long h = diff / ONE_HOUR;
        diff %= ONE_HOUR;

        long m = diff / ONE_MINUTE;
        diff %= ONE_MINUTE;

        long s = diff / ONE_SECOND;
        long ms = diff % ONE_SECOND;
        result[0] = d;
        result[1] = h;
        result[2] = m;
        result[3] = s;
        result[4] = ms;

        return result;
}

// today 
Date now = new Date();
Calendar date = new GregorianCalendar();
// reset hour, minutes, seconds and millis for midnight tonight
date.set(Calendar.HOUR_OF_DAY, 0);
date.set(Calendar.MINUTE, 0);
date.set(Calendar.SECOND, 0);
date.set(Calendar.MILLISECOND, 0);
// next day midnight is tonight midnight
date.add(Calendar.DAY_OF_MONTH, 1);

//caclulate the absolute difference      
long[] diff = getTimeDifference(date.getTime(), now);

//get hours and minutes for the reminder
patExecContext.setProcessDataIntValue( "/process_data/taskReminder/object/reminder/@hours", (int)diff[1] );
patExecContext.setProcessDataIntValue( "/process_data/taskReminder/object/reminder/@minutes", (int)diff[2] );

//enable the reminder
patExecContext.setProcessDataBooleanValue( "/process_data/taskReminder/object/@selected", true );

Now just assign the taskReminder variable to the Task Reminder in the Assign Task activity and your Reminder will be sent at midnight tonight!

How to make JavaScript debugger in Designer work again

LC_bugIf you find that you can not debug your form JavaScript from within Designer, there is a good chance that Acrobat Pro is not configured correctly for debugging.

LiveCycle Designer attempts to preview PDFs by hooking into the current Adobe ActiveX Control add-on that is enabled inside Internet Explorer. This can be either Adobe Reader or Acrobat Pro. Acrobat Pro is required if you want to debug your JavaScript from within Designer. If you never see the Preview PDF option in Designer or it is greyed out, then try enabling the Adobe PDF Reader add-on within IE.

My problem was that I could not debug JavaScript from within Designer natively. Every time I tried to Preview certain PDFs, Designer would hang and FormDesigner.exe was left running when I closed Designer.

After many hours of hair pulling, uninstalling and re-installing Workbench, Designer, Acrobat (argh!) and generally going in circles I found that only forms that contained the FormBridge XFO were failing. Form Bridge is a JavaScript “bridge” library used to communicate externally with Workspace or Flex applications (Guides). It adds a script object to the hierarchy called ContainerFoundation_JS. When Preview PDF was invoked from Designer with this script added to the form, it would lock up.

The fix

It seems that if you set your JavaScript preferences in Acrobat Pro to Break when an exception is thrown – you’re gonna have a bad time…

Only use the Ignore or Trace settings, never Break as this actually breaks. Breaks Designer.

Acrobat Pro Preferences

Clean up after yourself

During this process and having to re-install everything multiple times, I was pointed in the direction of the Acrobat and Reader cleaner. Not to be confused with the Creative Cloud cleaner. The fact that any software requires a cleaner tool and doesn’t automatically clean up after itself both on installation and un-installation is a rant I choose not to go into right now for pure sanity reasons. Also be aware that the cleaner tool does not clean everything. I found remnants of Acrobat in my roaming profile under Windows 7 that even I could not delete and I was the local Administrator. </mini-rant>

Dropbox, Skype and Livecycle

command-prompt-glossyI recently noticed that Livecycle (JBoss) on my development laptop would frequently not start up correctly. It would throw all sorts of errors about ports already in use (1099, etc) and throw a complete wobbly. So I decided to dig around using TcpView and Process Explorer. It seems that Skype and Dropbox (to a lesser extent) would sometimes come in and steal some Livecycle ports when they run. Strangely, it didn’t reproduce every time I went looking for them but I saw enough to see that either one would try to grab the Naming Service port (1099) for some reason.

As both Skype and Dropbox started automatically on my laptop, I inevitably tried to run Livecycle without thinking and it would bomb out. So I decided it was easier to just quit both Dropbox and Skype until after Livecycle had started, then restart those processes when I needed them. They seemed to work fine without the RMI port anyway.

I knocked up a quick batch file to detect if either process was running and kill these apps before running Livecycle so I thought I’d share it. Props go to StackOverflow for the process detection script.

@ECHO OFF
tasklist /FI "IMAGENAME eq dropbox.exe" 2>NUL | find /I /N "dropbox.exe">NUL
if NOT "%ERRORLEVEL%"=="0" goto TEST_SKYPE
echo Dropbox is running...DIE!!
taskkill /f /im "dropbox.exe"

:TEST_SKYPE
tasklist /FI "IMAGENAME eq skype.exe" 2>NUL | find /I /N "skype.exe">NUL
if NOT "%ERRORLEVEL%"=="0" goto START_LC
echo Skype is running...DIE!!
taskkill /f /im "skype.exe"

:START_LC
net start "MySQL for Adobe LiveCycle ES4"
net start JBOSS_FOR_ADOBE_LIVECYCLE_ES4

:EXIT0
pause

CRXDE Lite code formatting

CRXDELite_Logo

One thing I always missed in CRXDE Lite was the lack of any code formatting tools. I always had to copy the code out into Notepad++ or Eclipse to format the code and then paste back into my JSP files. Not very convenient.

Today I accidentally stumbled across what I expect is an undocumented feature in CRXDE Lite – Code Formatting!

Shift-Tab

If you select any or all of the code on a page, and then hit Shift-Tab, it doesn’t tab the code back one tab stop (as you would expect), it actually formats the code.

Before

Before

After

After

Version

This was done with CRXDE Lite in CRX 2.4.23 (CQ 5.6.0.20130125) that comes with Adobe Livecycle ES4.  It seems to work in Chrome, Firefox and Intenet Exploder 10.

aemblog

Everything AEM aka CQ5 based on my experience listed here.

Adobe AEM The Right Way

Best practices, tips, and tricks for your Adobe AEM project

/home/bkondepudi

A WCM journey with Day/Adobe CQ

Technoracle (a.k.a. "Duane's World")

A multi-purpose toolkit for the Adobe LiveCycle and AEM Forms developer.

Adobe LiveCycle Blog

A multi-purpose toolkit for the Adobe LiveCycle and AEM Forms developer.

A multi-purpose toolkit for the Adobe LiveCycle and AEM Forms developer.

XFA@Mobile

A multi-purpose toolkit for the Adobe LiveCycle and AEM Forms developer.

Code Monkey

Ramblings of a Developer