Configuring WCM email actions with a local SMTP server

Posted: April 20th, 2009 | Author: Graham | Filed under: howto | Tags: , , , , | 1 Comment »

Wow, here goes, a post about WCM!

We often need to set up simple email system to test WCM’s email action. This feature is used in workflow. The system can be configured to email a user when they need to approve content to move to the next workflow stage, for example.

I like to set up a local smtp/pop3 server on the same machine that Portal is running on, then we don’t have to worry about DNS or MX records or anything nasty like that and can focus on the WCM features. This could be useful for you if you need to run a demo or something all on the same machine.

I did these steps on a Redhat 5 machine. My server’s fully qualified hostname is narrabeen.ilwwcm.au.ibm.com , for those following along at home.

First install postfix and dovecot . They are simple and secure and do just what we want. If you are familiar with another MTA, like sendmail, just use that instead.

yum install postfix dovecot ; yum remove sendmail

or for the non yum users out there

rpm -Uvh postfix.rpm dovecot.rpm ; rpm -e sendmail

Note that you should remove sendmail after you install postfix otherwise rpm will complain about dependency issues.

Dovecot works completely out of the box, just run :

service dovecot start

And test it from your machine by trying to telnet to port 110 on the server.

Cool, lets make some local users that we can send mail to.

useradd user1 ; passwd user1
useradd adminuser ; passwd adminuser

This creates local mailboxes on the server that we will address later as : <user>@<fullyqualifieddomainname> . In my case these addresses are user1@narrabeen.ilwwcm.au.ibm.com and adminuser@narrabeen.ilwwcm.au.ibm.com . Please note that WCM will not forward to user@localhost type addresses, so you will need to address your mail to a ‘proper’ domain.

Now the WCM part. Open your WCMConfigService.properties file. I am using 6.1.0.1 at the moment, but this is valid for any version of WCM. The config file named differently in 5.1 (connect.cfg), and located somewhere else (under Portal Home instead of in the profile) in 6.0, but the properties are quite similar. On 6.1 this is located in [PROFILE_PATH]/PortalServer/wcm/shared/app/config/wcmservices/WCMConfigService.properties
We are concerned with this paragraph:

# workflow - SMTP Mail Setup
connect.connector.mailconnector=defaultsmtpserver,defaultfromaddress,defaultreplytoaddress
connect.connector.mailconnector.defaultsmtpserver=mail.yourmailserver.com
connect.connector.mailconnector.defaultfromaddress=admin@yourmailserver.com
connect.connector.mailconnector.defaultreplytoaddress=admin@yourmailserver.com

Change mail.yourserver.com to your mail server , and the default addresses to adminuser@yourmailserver.com . The defaultfromaddress will be the user that WCM will send the mail as. You should make this a real address so if the user replies to the email, it won’t go bouncing around your email system for days. Restart Portal to make those changes take effect .

Now we need to link users in Portal to the email addresses we have created. Load up Portal, log in as your admin user and go to Administration -> Users and Groups .

Create a new user and enter the email address.

Entering Admin email address

Entering Admin email address

Edit your admin user too, and assign it the email address admin@localhost, which you created earlier.

Create a new library and assign the user manager access to the library. Go to the authoring portlet, click configure and select the library you just created. Logout and log in as the new user.

Now you’ll have to create all the basic stuff before you can create content. Start with the email action and enable all the options, so it will send an email to every account involved in the process. Now add the email action to the ‘entry’ section of the first workflow stage and add the workflow stage to a workflow. Create a presentation template, authoring template, site, site area and finally a piece of content. It should be in the draft stage now. Since the email action is in the entry section, it will be fired every time we create new content, which is good for testing the email action.

Email action on the first workflow stage

Email action on the first workflow stage

Configure up your POP3 client of choice and point it to your Portal/email server using the admin username and password (since the admin user will need to approve the content). I am using the excellent Thunderbird for this purpose. If everything has gone well, we should see an email sitting in Thunderbird.

Ding, new content to be approved!

Ding, new content to be approved!

As you can see, the email that appears is from wcmadmin@narrabeen.ilwwcm.au.ibm.com , which is the value I used for “defaultfromaddress” in the WCMConfigService.properties file.

What if it doesn’t work ? Email is like a series of tubes (with apologies to Ted Stevens) . You need to check that the email is being generated by WCM, and then if WCM is sending it to the right place, and *then* if postfix is sending it to dovecot. SystemOut doesn’t log emails that are sent out so it can be difficult to debug. This trace string is your friend if you’re not sure where to start. It should log WCM’s attempt to send the mail to postfix.

*=info: com.presence.connect.connector.*=all: com.aptrix.pluto.workflow.actions.EmailAction=all

To use the trace string, go to Administration -> Portal Analysis -> Enable Tracing and copy the trace string into the box. A trace.log file should appear in [PROFILE_ROOT]/logs/WebSphere_Portal/

If WCM is sending the email properly, you will see something like this in the trace.log :

[4/20/09 12:14:13:195 EST] 000001fa EmailAction   3   WorkflowAction EmailAction is adding "adminuser@narrabeen.ilwwcm.au.ibm.com" to list of recipients for mailtest7
[4/20/09 12:14:13:302 EST] 000001fa MailConnectio 3   MailConnector: Getting new SMTP transport
[4/20/09 12:14:13:680 EST] 000001fa MailConnectio 3   MailConnector: Mail Sent!

If the mail is still not turning up in the mailbox, we need to turn our attention to /var/log/maillog . By default both dovecot and postfix will log to this file.

Apr 20 10:47:11 narrabeen postfix/smtpd[25554]: connect from narrabeen.ilwwcm.au.ibm.com[127.0.0.1]
Apr 20 10:47:11 narrabeen postfix/smtpd[25554]: 1DB7D798040: client=narrabeen.ilwwcm.au.ibm.com[127.0.0.1]
Apr 20 10:47:11 narrabeen postfix/cleanup[25557]: 1DB7D798040: message-id=&lt;1803316092.1240188430966.JavaMail.root@narrabeen&gt;
Apr 20 10:47:11 narrabeen postfix/qmgr[30835]: 1DB7D798040: from=, size=1146, nrcpt=1 (queue active)
Apr 20 10:47:11 narrabeen postfix/smtpd[25554]: disconnect from narrabeen.ilwwcm.au.ibm.com[127.0.0.1]
Apr 20 10:47:11 narrabeen postfix/smtp[25558]: 1DB7D798040: to=, relay=none, delay=0.19, delays=0.08/0.11/0/0, dsn=5.4.6, status=bounced (mail for narrabeen.ilwwcm.au.ibm.com loops back to myself)

I had this problem when trying to set this up. Postfix does a number of checks to figure out whether to relay the mail to another mail server, or to keep it on the local server and route it to a local user. We want it to do the latter.
We need to change the value mydestination so it matches the mail server address we are using (everything to the right of the @ symbol in the email address) . Additionally we should change mynetworks_style from subnet (the default) to host, as we don’t want postfix to accept mail from any other host in our subnet or not.
If your postfix server is on a different machine to portal, you’d obviously skip this step.

mydestination = $myhostname, localhost.$mydomain, narrabeen.ilwwcm.au.ibm.com
mynetworks_style = host

To make these changes take effect run:

service postfix restart

Now create a new piece of content. Tailing /var/log/maillog helps to make sure the mail is correctly hitting postfix.

pr 20 12:14:13 narrabeen postfix/smtpd[29334]: connect from narrabeen.ilwwcm.au.ibm.com[127.0.0.1]
Apr 20 12:14:13 narrabeen postfix/smtpd[29334]: 9B60D798040: client=narrabeen.ilwwcm.au.ibm.com[127.0.0.1]
Apr 20 12:14:13 narrabeen postfix/cleanup[29337]: 9B60D798040: message-id=&lt;1790995136.1240193653304.JavaMail.root@narrabeen&gt;
Apr 20 12:14:13 narrabeen postfix/qmgr[26483]: 9B60D798040: from=, size=1142, nrcpt=2 (queue active)
Apr 20 12:14:13 narrabeen postfix/local[29338]: 9B60D798040: to=, relay=local, delay=0.17, delays=0.05/0.09/0/0.04, dsn=2.0.0, status=sent (delivered to mailbox)

Jackpot!

Another useful command to use when debugging postfix is postconf -n , which will print all the parameters that are currently in effect for the server.

Well, hope that made some sense, send me a message and let me know how you went.


java.lang.UnsatisfiedLinkError: /opt/WebSphere/AppServer/java/jre/bin/libawt.so: libXmu.so.6

Posted: April 1st, 2009 | Author: Graham | Filed under: howto | Tags: , , , | No Comments »

Excuse me for titling a post with an exception! Now that I have your attention…..

I’m doing a bit of work on Portal 6.0.  for a customer, and have installed my test environment on Redhat Enterprise 5.3 . I don’t often use a GUI for these machines and sometimes run into problems. On this one I ran the configure-wcm-authoring WPSConfig.sh task but navigated to the WCM Authoring Portlet and found a blank page. The portlet was on the page, but it wasn’t being rendered. A quick look through the SystemErr.log show the culprit:

[4/1/09 16:10:39:329 EST] 00000084 SystemErr     R java.lang.UnsatisfiedLinkError: /opt/WebSphere/AppServer/java/jre/bin/libawt.so: libXmu.so.6: cannot open shared object file: No such file or directory
at java.lang.ClassLoader$NativeLibrary.load(Native Method)
at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:2144)
at java.lang.ClassLoader.loadLibrary(ClassLoader.java:2004)
at java.lang.Runtime.loadLibrary0(Runtime.java:824)
at java.lang.System.loadLibrary(System.java:910)
at sun.security.action.LoadLibraryAction.run(LoadLibraryAction.java:76)
at java.security.AccessController.doPrivileged1(Native Method)
at java.security.AccessController.doPrivileged(AccessController.java(Compiled Code))
at sun.awt.NativeLibLoader.loadLibraries(NativeLibLoader.java:81)
at java.awt.Color.&lt;clinit&gt;(Color.java:280)
at com.ibm.psw.uil.nls.UilCommonResources.&lt;clinit&gt;(UilCommonResources.java:246)
at com.ibm.psw.uil.util.UilStatusInfoHelper$ESIData.&lt;init&gt;(UilStatusInfoHelper.java:1153)
at com.ibm.psw.uil.util.UilStatusInfoHelper.&lt;clinit&gt;(UilStatusInfoHelper.java:997)
at com.ibm.psw.wcl.components.table.WTable.createDefaultClassComparators(WTable.java:1007)
at com.ibm.psw.wcl.components.table.WTable.&lt;init&gt;(WTable.java:733)
at com.ibm.psw.wcl.components.table.WTable.&lt;init&gt;(WTable.java:707)
at com.ibm.psw.wcl.components.table.WTable.&lt;init&gt;(WTable.java:664)
at com.ibm.workplace.wcm.app.ui.portlet.widget.WBasicTable.&lt;init&gt;(WBasicTable.java:80)
at com.ibm.workplace.wcm.app.ui.portlet.widget.WRepositoryBrowserTable.&lt;init&gt;(WRepositoryBrowserTable.java:131)
at com.ibm.workplace.wcm.app.ui.portlet.widget.WRepositoryBrowser.createTable(WRepositoryBrowser.java:304)
at com.ibm.workplace.wcm.app.ui.portlet.widget.WRepositoryBrowser.initialise(WRepositoryBrowser.java:210)
at com.ibm.workplace.wcm.app.ui.portlet.widget.WRepositoryBrowser.&lt;init&gt;(WRepositoryBrowser.java:127)
at com.ibm.workplace.wcm.app.ui.portlet.core.view.MainRepositoryFormView.getRepositoryBrowser(MainRepositoryFormView.java:383)
at com.ibm.workplace.wcm.app.ui.portlet.core.view.MainRepositoryFormView.getRepositoryBrowserTable(MainRepositoryFormView.java:435)
at com.ibm.workplace.wcm.app.ui.portlet.basic.PageManager.getRepositoryTable(PageManager.java:468)

WRepositoryBrowser is the class that renders the main view of the authoring portlet. Looks like it requires some extra packages to work if you haven’t installed xorg with your Redhat Server. A quick search of pbone.net reveals I need two additional packages: libXmu-1.0.2-5.i386.rpm and libXtst-1.0.1-3.1.i386.rpm .  I always install compat-libstdc++-296, compat-libstdc++-33 and libXp on Redhat 5 machines as well. (I think if you don’t have  libXp you get a pretty similar error). I hadn’t seen this specific one before, I think it’s because I used the ’skipx’ directive in the kickstart file for the machine. Long story short, install those packages on your headless redhat machine.

I think this problem isn’t limited to Portal either. When I was trying to install IBM Http Server on the same machine, I kept getting the same error when the Install Shield installer would load (in -console mode, no less), so I guess it would be good to install these packages whenever you’re going to use Java Apps and use the skipx parameter.