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

6 comments:

  1. Can you provide similar instructions for a production/staging environment?

    ReplyDelete
  2. Thanks a lot..you have saved my day

    ReplyDelete
  3. Thanks Raj.Its useful :-)

    ReplyDelete
  4. I have read your blog its very attractive and impressive. I like it your blog.

    Java Training in Chennai Core Java Training in Chennai Core Java Training in Chennai

    Java Online Training Java Online Training Core Java 8 Training in Chennai Core java 8 online training JavaEE Training in Chennai Java EE Training in Chennai

    ReplyDelete