[ Team LiB ] Previous Section Next Section

Extending the Capability to Your JavaMail API

The JavaMail API was designed to be as extensible as possible. Other protocols not supplied with WebLogic Server 8.1, such as the POP3 or the Network News Transfer Protocol (NNTP), can be implemented through various third-party providers.

The POP3 protocol in particular is a commonly used protocol not included in JavaMail version 1.1.3 and subsequently WebLogic Server 8.1. If you want to use it, you have three options: upgrade your JavaMail API to the latest version (recommended), use the Sun POP3 extension, or install a third-party extension.

Upgrading Your JavaMail API Version

If you're going to be using the POP3 protocol, I recommend you upgrade the JavaMail API to version 1.3. Users have reported bugs with certain methods of the POP3 extension, and because it's just as simple to upgrade the entire API as it is to add an extension, you might as well get the whole package with all its other enhancements. The following steps outline the procedure:

  1. Download the latest JavaMail package (version 1.3 as of this writing) from Sun at:

    http://java.sun.com/products/javamail/index.html

    The JavaMail package is delivered as a Zip file, such as javamail-1_3.zip for version 1.3.

  2. Extract the contents of the javamail-1_3.zip file to a temporary directory. This will create a /javamail-1.3 subdirectory.

  3. In the /javamail-1.3 directory is the mail.jar file, which contains the class files for the API. This is the file you'll set in your WebLogic startup classpath. It can be referenced from anywhere on your hard drive, but to keep things organized, I recommend saving it to the same directory as your other WebLogic class files:

    
    
    C:/bea/weblogic81/server/lib
    
  4. The final step is to reference the new package in your WebLogic startup classpath. This can be done in the setWLSEnv.cmd script that sets your environment (recommended), or the StartWLS.cmd script that starts WebLogic Server. Both scripts are located in WebLogic's binary directory:

    
    
    C:/bea/weblogic81/server/bin
    

    The set CLASSPATH statement in my setWLSEnv.cmd file looks like the following:

    
    
    
    set CLASSPATH=%JAVA_HOME%\lib\tools.jar; %WL_HOME%\server\lib\mail.jar; %WL_HOME%\server
    graphics/ccc.gif\lib\weblogic_sp.jar; %WL_HOME%\server\lib\weblogic.jar; %WL_HOME%\server\lib\webservices
    graphics/ccc.gif.jar; %CLASSPATH%
    

CAUTION

Make sure that mail.jar is referenced before weblogic.jar and weblogic_sp.jar in your set CLASSPATH statement! When an application program is searching the classpath for a JavaMail class, it will look in the mail.jar file first (holding JavaMail API version 1.3 classes) before the weblogic.jar file (holding JavaMail API version 1.1.3 classes).


Installing the Sun POP3 Extension

Sun provides a free extension to bring POP3 capability to JavaMail API versions 1.1.3 and earlier. If you have an aversion to upgrading your JavaMail API but want to use POP3, this is your next best option. The installation procedure is similar to that of upgrading the API:

  1. Download the POP3 extension from Sun at http://java.sun.com/products/javamail/pop3.html. From there, you can obtain the package as a Zip file, pop31_1_1.zip.

  2. Extract the contents of the pop31_1_1.zip file to a temporary directory. This will create the subdirectory /pop3-1.1.1.

  3. In the /pop3-1.1.1 directory is the pop3.jar file, which contains the class files for the POP3 provider. This is the file you will set in your WebLogic startup classpath. It can be referenced from anywhere on your hard drive, but to keep things organized, I recommend saving it to the same directory as your other WebLogic class files:

    
    
    C:/bea/weblogic81/server/lib
    
  4. Finally, reference the pop3.jar file in your classpath. This can be done in the setWLSEnv.cmd script that sets your environment (recommended), or the StartWLS.cmd script that starts WebLogic Server. Both scripts are located in WebLogic binary directory:

    
    
    C:/bea/weblogic81/server/bin
    

    Add this pop3.jar before WebLogic Server libraries. The set CLASSPATH statement will resemble the following:

    
    
    
    set CLASSPATH=.;%JAVA_HOME%\lib\tools.jar; %WL_HOME%\server\lib\pop3.jar; %WL_HOME%\server
    graphics/ccc.gif\lib\weblogic.jar;%CLASSPATH%
    

Installing Third-Party Extensions

JavaMail extensions are constantly being developed by third parties to enhance and extend Java's email capabilities. Such extensions include support for Network News Transfer Protocol, additional MIME support, and JMS-to-email bridges, to name but a few. Sun maintains a list of third-party products on its Web site at

http://java.sun.com/products/javamail/Third_Party.html

The installation procedure for these extensions varies with each product, but most involve downloading the extension class files and making them available to the WebLogic startup classpath, as in the previous sections. Refer to the specific product you want to implement.

    [ Team LiB ] Previous Section Next Section