Tuesday, June 14, 2011

Adding an external JAR file to WCS.

JAR files are used to distribute Java applications or libraries.
There is always an interesting API that is required and need to import an external JAR file.

Steps.
1. Add the jar file to the enterprise project WC/lib.
2. Make an entry for JAR file in the Stores.war\META-INF\MANIFEST.MF (the file has specific formatting with a space before and after each line and also blank line at the end.
3. Add the jar file to the WebSphereCommerceServerExtensionsData classpath. Mak sure the exported flag is true.
<classpathentry exported="true" kind="lib" path="/WC/lib/custom/recaptcha4j.jar"/>
4. Build
5. Restart

JAR basic commands:

Unzip: Jar -xvf .jar

Zip: java -jar .jar

Troubleshoot:
When you start the server, make sure the jar file is added in the system out logs:
[6/14/11 15:39:10:087 PDT] 00000019 WebApp A SRVE0180I: [InitializationServlet] [/InitializationServlet] [Servlet.LOG]: InitServlet: ServletContext attributes:
C:\WCToolkitEE60_Raj\workspace\WC\lib\custom\recaptcha4j.jar

8 comments: