Tag Archives: AIM

Implementing Web AIM Client

Here are some notes when I was struggling to develop a web AIM client:

1. Download AIM SDK, both Windows and Linux
In Linux environment, you may already have NSS/NSPR libraries installed, if not following instructions to install it. You only need to run:

cd dist/release/
ln -s /usr/lib/libnspr4.so .
ln -s /usr/lib/libnss3.so .
ln -s /usr/lib/libnssckbi.so .
ln -s /usr/lib/libplc4.so .
ln -s /usr/lib/libplds4.so .
ln -s /usr/lib/libsmime3.so .
ln -s /usr/lib/libsoftokn3.so .
ln -s /usr/lib/libssl3.so .
ln -s /usr/lib/libfreebl3.so .
export LD_LIBRARY_PATH=/usr/local/tomcat/lib/

2. Get a developer key to use AIM SDK. The developer web site does not accept external email account, so create a new one. In fact, more new AIM screen names are needed, as testing AIM requires it.

3. Try to compile and run samples/accjsample:

cd samples/accjsample
javac -cp ../../dist/release/accjwrap.jar AccJSample.java Prefs.java
java -cp ../../dist/release/accjwrap.jar:./ AccJSample username password developerkey

But you may get error messasge like:

UNKNOWNVALUE
com.aol.acc.AccException: IAccSession_SignOn
at com.aol.acc.AccSession.SignOn(Native Method)
at com.aol.acc.AccSession.signOn(AccSession.java:113)
at AccJSample.(AccJSample.java:47)
at AccJSample.main(AccJSample.java:22)

But if you go into dist/release/ directory, where *.so are located, and run:

/usr/local/java/bin/java -cp ../../dist/release/accjwrap.jar:../../samples/accjsample/ AccJSample username password developerkey

You may get things running correctly:

[5/5/08 8:34 AM]: OnStateChange: Connecting, ACC_S_OK
[5/5/08 8:34 AM]: OnStateChange: Validating, ACC_S_OK
[5/5/08 8:34 AM]: OnStateChange: Transferring, ACC_S_OK
[5/5/08 8:34 AM]: OnStateChange: Negotiating, ACC_S_OK
[5/5/08 8:34 AM]: OnStateChange: Starting, ACC_S_OK
[5/5/08 8:34 AM]: OnStateChange: Online, ACC_S_OK
[5/5/08 8:34 AM]: OnUserChange: ACC_S_OK

That is because *.so may not be loaded correctly if they are not in the current working directory.

Someone says that inaccurate time may cause problems, so run:

/etc/init.d/ntpd start

to synchronize your server’s time.

4. following, it comes to the time that developing AIM desktop client, and then converting it into Java Servlet based AIM client. So, tutorial “Creating AIM-Enabled Application in Java” series are recommended.

5. And time to deploy your web AIM client to tomcat servlet container.

If your Tomcat 6 server is on Windows, you may need to copy all dist/release/*.dll into your %CATALINA_HOME%/bin/ folder, copy dist/release/accjwrap.jar into %CATALINA_HOME%/lib and restart Tomcat services to get things done. Deploy accjwrap.jar directly into webapps folder is not recommended, because you may want to restart your servlet application frequently while loading and unloading *.dll modules may cause “already loaded in another classloader UnsatisfiedLinkError” problems for Tomcat, which may result that you need to restart your Tomcat server.

If your Tomcat 6 server is on Linux, you also need to copy all dist/release/*.so into your $CATALINA_HOME/bin/ folder, copy dist/release/accjwrap.jar into $CATALINA_HOME/lib. And you need to modify your catalina.sh and add two lines:

LD_LIBRARY_PATH=$CATALINA_HOME/bin
cd $CATALINA_HOME/bin

And then restart Tomcat server.

Related links:

Posted in Java, Tomcat | Tagged | 10 Comments