Friday, February 27, 2009

JSF Versions and Weblogic Server


We were playing with the JSF containers in WLS and stumbled upon some problems. I'll try to summarize the findings in one place here. Hope, this is helpfull for you.

If you create a new Weblogic Server Domain it does not come with any JSF libraries active. If your try to ship your webapplication with a separate JSF implementation, you are free to do this. Keep in mind, that the dependency injection mechanisms does not work with managed beans, if you do not use any of the WLS provided JSF containers.

Declaring something like this:
@EJB
private MySession session;

will lead to a java.lang.NullPointerException because of the missing depencency injection mechanisms. Would love to know any details about this. Maybe I'll find out more in the future..


The following ones are available with WLS 10gR3:







LIBRARYNAMEIMPLEMENTATION VERSION
jsfSun Reference1.2-b20-FCS - or 1_2_03-rc2
jsf-riSun Reference1.1.1
jsf-myfacesMyFaces1.1.3
jsf-myfacesMyFaces1.1.1


If you want to use any of them in your own webapplikation, you have to deploy the libraries and refer to them with the weblogic.xml depolyment descriptor:


  1. In the administration console navigate to the Deployments page using the left hand menu.

  2. Then select the Install button at the top of the deployments table

  3. Using the directory browser navigate to the $BEA_HOME/wlserver_10.3/common/deployable-libraries directory. Then select the apropriate war (e.g. jsf-1.2.war), and click the Next button.

  4. Make sure that the Install this deployment as a library is selected. Click the Next button on the Install Application Assistant page.

  5. Click the Next button on the Optional Settings page.

  6. Make sure that the Yes, take me to the deployment's configuration screen. is selected. Click the Finish button on the Review your choices and click Finish page.

  7. On the Settings for jsf(1.2,1.2.3.1) page set the Deployment Order to 99 so that it is deployed prior to auto deployed applications. Then click the Save button.



After this, you have to ensure that your application uses the right libraries by entering the needed parts into the deployment descriptor (weblogic-application.xml for an ear and weblogic.xml for any war file)

<library-ref>
<library-name>jsf</library-name>
<specification-version>1.2</specification-version>
<implementation-version>1.2</implementation-version>
<exact-match>false</exact-match>
</library-ref>

If you are wondering, if there is a posiblity to just deploy the .jar File as a Library: theoreticaly yes :) But: There is a restriction in place that prevents webarchives from accessing deployed .jar libraries. You can only access .jar libraries from ear or ejb.jar files. Webapplications are only allowed to access .war libraries. If you try it, you will get an error like this:

"xxxx" library reference is not allowed in the weblogic.xml file.
Only WAR libraries are allowed.
Unknown WebLogic Shared Library Framework Validation Problem