Attaching shared library to deployed portlet

Some times you might not want to copy all the .jar files that your portlets require in the server shared lib instead you might want to attach them only to every deployed portlet.

Ex. Lets say you want to use a different JSF library in your portlets so instead of copying those .jars in shared/app you want to create a separate shared lib and attach it to every deploy portlet, you can configure Deployment service to solve this use case

Follow these steps

  • Create a shared lib containing your jars using Create shared library instructions

  • Now next step is to configure Deployment Service. For that first login into the WAS Admin Console. Go to Resources -> Resource Environment -> Resource Environment Provider

  • Click on the WP DeploymentService link it will take you the WP DeploymentService details like this

  • On this screen click on new and add new portletapp.shared.library.list property like this. In this value of the Value field should be name of the shared library or comma separated list of name of shared libs

    Click ok to save your changes.

  • Now restart the server for your changes to take effect

  • Once server is restarted you can deploy a portlet and once the portlet is deployed you will notice that the shared lib is attached to the .ear file of that portlet and portlet is aable to access the classes in that shared lib

No comments: