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:
LIBRARY | NAME | IMPLEMENTATION VERSION |
jsf | Sun Reference | 1.2-b20-FCS - or 1_2_03-rc2 |
jsf-ri | Sun Reference | 1.1.1 |
jsf-myfaces | MyFaces | 1.1.3 |
jsf-myfaces | MyFaces | 1.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:
- In the administration console navigate to the Deployments page using the left hand menu.
- Then select the Install button at the top of the deployments table
- 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.
- Make sure that the Install this deployment as a library is selected. Click the Next button on the Install Application Assistant page.
- Click the Next button on the Optional Settings page.
- 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.
- 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
So it's impossible to use the newest version of Mojarra(1.2_12) on wls 10.3 and annotations like @EJB in managed bean.
ReplyDeleteHi Luke,
ReplyDeletethanks for your comment. You are free to build up your own deployable library with the jsf implementation of your choice. You find a brief instruction how to do this in my JSF 2.0 on WLS post.
Rgds
Markus